CreateModel
References inside to other ontologies will be included.
A handle to the model will be returned, or 0 in case something went wrong.
Syntax
public const string enginedll = @"engine.dll"; [DllImport(enginedll, EntryPoint = "CreateModel")] public static extern Int64 CreateModel();
Example (based on pure API calls)
Here you can find code snippits that show how the API call CreateModel can be used.
using RDF; // include at least engine.cs within your solution ... public void CreateContent() { Int64 model = RDF.engine.CreateModel(); if (model != 0) { // // Classes // Int64 classBooleanOperation = RDF.engine.GetClassByName(model, "BooleanOperation"), classCube = RDF.engine.GetClassByName(model, "Cube"), classCylinder = RDF.engine.GetClassByName(model, "Cylinder"), classMatrix = RDF.engine.GetClassByName(model, "Matrix"), classTransformation = RDF.engine.GetClassByName(model, "Transformation"); // // Object Properties (relations) // Int64 propertyFirstObject = RDF.engine.GetPropertyByName(model, "firstObject"), propertyMatrix = RDF.engine.GetPropertyByName(model, "matrix"), propertyObject = RDF.engine.GetPropertyByName(model, "object"), propertySecondObject = RDF.engine.GetPropertyByName(model, "secondObject"); // // Datatype Properties (attributes) // Int64 property_41 = RDF.engine.GetPropertyByName(model, "_41"), propertyLength = RDF.engine.GetPropertyByName(model, "length"), propertyRadius = RDF.engine.GetPropertyByName(model, "radius"), propertySegmentationParts = RDF.engine.GetPropertyByName(model, "segmentationParts"), propertyType = RDF.engine.GetPropertyByName(model, "type"); // // Instances // Int64 instanceBooleanOperation = RDF.engine.CreateInstance(classBooleanOperation, (string) null), instanceCube = RDF.engine.CreateInstance(classCube, (string) null), instanceCylinder = RDF.engine.CreateInstance(classCylinder, (string) null), instanceMatrix = RDF.engine.CreateInstance(classMatrix, (string) null), instanceTransformation = RDF.engine.CreateInstance(classTransformation, (string) null); RDF.engine.SetObjectProperty(instanceTransformation, propertyObject, ref instanceCylinder, 1); RDF.engine.SetObjectProperty(instanceTransformation, propertyMatrix, ref instanceMatrix, 1); double length = 1.8, radius = 1.3, offsetX = 4.2; Int64 segmentationParts = 36; RDF.engine.SetDatatypeProperty(instanceCylinder, propertyLength, ref length, 1); RDF.engine.SetDatatypeProperty(instanceCylinder, propertyRadius, ref radius, 1); RDF.engine.SetDatatypeProperty(instanceCylinder, propertyFirstObject, ref segmentationParts, 1); RDF.engine.SetDatatypeProperty(instanceMatrix, property_41, ref offsetX, 1); // // Saves only the Transformation and (indirectly) related instances // RDF.engine.SaveInstanceTreeW(instanceTransformation, System.Text.Encoding.Unicode.GetBytes("c:\\created\\TranformedCylinder.bin")); RDF.engine.SetObjectProperty(instanceBooleanOperation, propertyFirstObject, ref instanceCube, 1); RDF.engine.SetObjectProperty(instanceBooleanOperation, propertySecondObject, ref instanceCylinder, 1); length = 2.1; Int64 type = 1; RDF.engine.SetDatatypeProperty(instanceCube, propertyLength, ref length, 1); RDF.engine.SetDatatypeProperty(instanceBooleanOperation, propertyType, ref type, 1); // // Saves all instances // RDF.engine.SaveModelW(model, System.Text.Encoding.Unicode.GetBytes("c:\\created\\TranformedCylinderAndCubeWithSubtractedCylinder.bin")); // // Saves only the Boolean Operation and (indirectly) related instances // RDF.engine.SaveInstanceTreeW(instanceBooleanOperation, System.Text.Encoding.Unicode.GetBytes("c:\\created\\CubeWithSubtractedCylinder.bin")); RDF.engine.CloseModel(model); } }