Types of custom structures and enums #981
-
Hi folks, For some reason, I'm unable to upload the image here ("Something went really wrong, and we can't process that file"). I'm running one application that is reading that definition to decode the nodeset contents (if it is a custom one). Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I think you mix something up. valtype = server.nodes.base_variable_type.add_variable_type(idx, f"{idx}:MyStructVariableType", snode1)
val = await server.nodes.objects.add_variable(idx, "my_struct", ua.Variant(ua.MyStruct(), ua.VariantType.ExtensionObject))
val.add_reference(valnode, ua.ObjectIds.HasTypeDefinition, val) |
Beta Was this translation helpful? Give feedback.
I think you mix something up.
HasTypeDefinition
in the case of a Variable means, you provide a VariableType on the server as Template. In your case you can create a MyStructVariableType and add HasTypeDefinition to your variable.In the server-custom-structures-and-enums.py like this: