Create UserDefined without connecting to controller

Lets say I have a RECORD in my controller like:

    num value1;
    string value2;

Now I want to create a UserDefined that resembles this record in my C# code without connecting to the controller (I know what's inside it, so I don't need to grab it from the controller). I know how to do it when connecting to the controller:

                RapidData data = _controller.Rapid.GetRapidData("T_ROB1", "MyRecord");
                UserDefined userdef = (UserDefined)data.Value;

But how can I create the same UserDefined in just my C# code without connecting to the controller. I started by trying to clone a UserDefined like this (to get a feeling on how to create it from a DataNode):

                DataNode node = userdef.ToStructure();
                UserDefined userdef2 = new UserDefined();

But this results in exception: "ABB.Robotics.Controllers.RapidDomain.RapidDataFormatException: 'String was not recognized as a valid UserDefined'"

Anybody know how to do this?
Sign In or Register to comment.