InformationModel.MakeObject<T>(browseName, objectTypeId)
Creates a project object of the type indicated in the second argument and returns a C# object of the specified <T>
type.
Tip: At design time, the API functions only if the specified type is a predefined type (contained in the FTOptix modules).
static T MakeObject<T>(QualifiedName browseName, NodeId objectTypeId);
Arguments
T
- An
IUAObject
C# class that corresponds to the class of the C# object to return. -
browseName
(QualifiedName) - The
BrowseName
of the new object. -
objectTypeId
(NodeId) - A
NodeID
of the type from which the new object is derived.
Returns
T
- A C# object that corresponds to the project object created.
Example
The following example shows an API that creates a NewMotor
object of the Motor
type, searched with the Find
method, and then specified using NodeID
that returns a Motor
C# object:
var motortype = Project.Current.Find("Motor");
var myObj = InformationModel.MakeObject<Motor>("NewMotor", motortype.NodeId);
Owner.Add(myObj);