CreateInstance
If the owlClass input is zero or not a class handle 0 will be returned,
Syntax
public const string enginedll = @"engine.dll"; [DllImport(enginedll, EntryPoint = "CreateInstance")] public static extern Int64 x86_CreateInstance(Int64 owlClass, string name); [DllImport(enginedll, EntryPoint = "CreateInstance")] public static extern Int64 x64_CreateInstance(Int64 owlClass, string name); public static Int64 CreateInstance(Int64 owlClass, string name) { if (IntPtr.Size == 4) { var _result = x86_CreateInstance(owlClass, name); return _result; } else { return x64_CreateInstance(owlClass, name); } } [DllImport(enginedll, EntryPoint = "CreateInstance")] public static extern Int64 x86_CreateInstance(Int64 owlClass, byte[] name); [DllImport(enginedll, EntryPoint = "CreateInstance")] public static extern Int64 x64_CreateInstance(Int64 owlClass, byte[] name); public static Int64 CreateInstance(Int64 owlClass, byte[] name) { if (IntPtr.Size == 4) { var _result = x86_CreateInstance(owlClass, name); return _result; } else { return x64_CreateInstance(owlClass, name); } }
Property owlClass
Size: 64 bit / 8 byte (value)Property name
Size: 64 bit / 8 byte (reference)
Example (based on pure API calls)
Here you can find code snippits that show how the API call CreateInstance can be used.
using RDF; // include at least engine.cs within your solution static void Main(string[] args) { Int64 model = RDF.engine.CreateModel(); if (model != 0) { // // Classes // Int64 classArc3D = RDF.engine.GetClassByName(model, "Arc3D"); // // Datatype Properties (attributes) // Int64 propertyRadius = RDF.engine.GetPropertyByName(model, "radius"), propertyStart = RDF.engine.GetPropertyByName(model, "start"), propertySize = RDF.engine.GetPropertyByName(model, "size"), propertySegmentationParts = RDF.engine.GetPropertyByName(model, "segmentationParts"); // // Instances (creating) // Int64 myInstanceArc3D = RDF.engine.CreateInstance(classArc3D, (string) null); double Pi = 2.0 * Math.Acos(0.0), radius = 2.1, start = 0.0, size = 2.0 * Pi; Int64 segmentationParts = 36; RDF.engine.SetDatatypeProperty(myInstanceArc3D, propertyRadius, ref radius, 1); RDF.engine.SetDatatypeProperty(myInstanceArc3D, propertyStart, ref start, 1); // in this case we could also do without, i.e. default value RDF.engine.SetDatatypeProperty(myInstanceArc3D, propertySize, ref size, 1); // in this case we could also do without, i.e. default value RDF.engine.SetDatatypeProperty(myInstanceArc3D, propertySegmentationParts, ref segmentationParts, 1); // // The resulting model can be viewed in 3D-Editor.exe // RDF.engine.SaveModel(model, "c:\\created\\myFile.bin"); RDF.engine.CloseModel(model); } }