07/13/2021
Is there something special I need to do to add a PropertyState<type> as a child to a BaseObjectState while the server is running. In other words dynamically. I have C# code that looks like this
BaseObjectState layer = new BaseObjectState(m_layers);
layer.NodeId = new NodeId(id++, NamespaceIndex);
layer.BrowseName = new QualifiedName(layerName, NamespaceIndex);
layer.DisplayName = layer.BrowseName.Name;
layer.TypeDefinitionId = ObjectTypeIds.FolderType;
m_layers.AddChild(layer);
PropertyState<double> velocityNode = new PropertyState<double>(layer);
velocityNode.NodeId = new NodeId(id++, NamespaceIndex);
velocityNode.BrowseName = new QualifiedName(“Velocity”, NamespaceIndex);
velocityNode.DisplayName = velocityNode.BrowseName.Name;
velocityNode.TypeDefinitionId = VariableTypeIds.PropertyType;
velocityNode.ReferenceTypeId = ReferenceTypeIds.HasProperty;
velocityNode.DataType = DataTypeIds.Double;
velocityNode.ValueRank = ValueRanks.Scalar;
velocityNode.Value = velocity;
layer.AddChild(velocityNode);
Â
The Layer Node shows up correctly in the address space, but whenever I click to expand it and see it’s VelocityNode PropertyState I get a BadNodeIdUnknown error. How can this be avoided?
1 Guest(s)