SetObjectPropertyEx
The value of card gives the actual card of the values list.
The list values of integers is a list of handles to instances, this list
has a length as given in the values card.
The return value always should be 0, if not something is wrong in the way this property is called.
This call has the same behavior as SetObjectProperty, however needs to be
used in case properties are exchanged as a successive series of integers.
Note: the client application needs to make sure the cardinality of
the property is within the boundaries.
Syntax
public const string enginedll = @"engine.dll"; [DllImport(enginedll, EntryPoint = "SetObjectPropertyEx")] public static extern Int64 SetObjectPropertyEx(Int64 model, Int64 owlInstance, Int64 owlObjectProperty, ref Int64 values, Int64 card); [DllImport(enginedll, EntryPoint = "SetObjectPropertyEx")] public static extern Int64 SetObjectPropertyEx(Int64 model, Int64 owlInstance, Int64 owlObjectProperty, Int64[] values, Int64 card);
Property model
Size: 64 bit / 8 byte (value)Property owlInstance
Size: 64 bit / 8 byte (value)Property owlObjectProperty
Size: 64 bit / 8 byte (value)Property values
Size: 32 bit / 4 byte (reference)Property card
Size: 64 bit / 8 byte (value)
Example (based on pure API calls)
Here you can find code snippits that show how the API call SetObjectPropertyEx 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) { // // The following setting makes sure all instance handles are in an ordered list // In certain cases where several models are open or in case of conversion // between formats this can be handy and / or time efficient. // Int64 instanceCnt = 0; Engine.x86_64.OrderedHandles(model, (IntPtr) 0, (IntPtr) 0, out instanceCnt, 4, 4); System.Diagnostics.Debug.Assert(instanceCnt == 0); // // Classes // Int64 classAbcd = RDF.engine.CreateClass(model, "ABCD"); // // Object Properties (relations) // Int64 propertyAb = RDF.engine.CreateProperty(model, RDF.engine.OBJECTPROPERTY_TYPE, "Ab"); // // Instances // Int64 instanceAbcdI = RDF.engine.CreateInstance(classAbcd, (string) null), instanceAbcdII = RDF.engine.CreateInstance(classAbcd, (string) null); System.Diagnostics.Debug.Assert(instanceAbcdI == instanceCnt + 1); System.Diagnostics.Debug.Assert(instanceAbcdII == instanceCnt + 2); // // Set Properties // { RDF.engine.SetObjectPropertyEx(model, instanceAbcdI, propertyAb, ref instanceAbcdII, 1); Int64[] valuesAb = { instanceAbcdI, instanceAbcdII, instanceAbcdI }; RDF.engine.SetObjectPropertyEx(model, instanceAbcdII, propertyAb, ref valuesAb[0], 3); } // // Get Properties // { Int64 card = 0; IntPtr valuesPtr = IntPtr.Zero; RDF.engine.GetObjectPropertyEx(model, instanceAbcdI, propertyAb, out valuesPtr, out card); System.Diagnostics.Debug.Assert(card == 1); if (card > 0) { Int64[] valuesAb = new Int64[card]; System.Runtime.InteropServices.Marshal.Copy(valuesPtr, valuesAb, 0, (int) card); System.Diagnostics.Debug.Assert(valuesAb[0] == instanceAbcdII); } } { Int64 card = 0; IntPtr valuesPtr = IntPtr.Zero; RDF.engine.GetObjectPropertyEx(model, instanceAbcdII, propertyAb, out valuesPtr, out card); System.Diagnostics.Debug.Assert(card == 3); if (card > 0) { Int64[] valuesAb = new Int64[card]; System.Runtime.InteropServices.Marshal.Copy(valuesPtr, valuesAb, 0, (int) card); System.Diagnostics.Debug.Assert(valuesAb[0] == instanceAbcdI && valuesAb[1] == instanceAbcdII && valuesAb[2] == instanceAbcdI); } } // // The same can be applied to existing classes and properties // // // Classes // Int64 classCollection = RDF.engine.GetClassByName(model, "Collection"), classCube = RDF.engine.GetClassByName(model, "Cube"); // // Object Properties (relations) // Int64 propertyObjects = RDF.engine.GetPropertyByName(model, "objects"); // // Datatype Properties (attributes) // Int64 propertyLength = RDF.engine.GetPropertyByName(model, "length"); // // Instances (creating) // Int64 instanceCollectionI = RDF.engine.CreateInstance(classCollection, (string) null), instanceCollectionII = RDF.engine.CreateInstance(classCollection, (string) null), instanceCube = RDF.engine.CreateInstance(classCube, (string) null); System.Diagnostics.Debug.Assert(instanceCollectionI == instanceCnt + 3); System.Diagnostics.Debug.Assert(instanceCollectionII == instanceCnt + 4); System.Diagnostics.Debug.Assert(instanceCube == instanceCnt + 5); double length = 1.0; RDF.engine.SetDatatypePropertyEx(model, instanceCube, propertyLength, ref length, 1); Int64[] values = { instanceCollectionII, instanceCube, instanceCube }; RDF.engine.SetObjectPropertyEx(model, instanceCollectionI, propertyObjects, ref values[0], 3); RDF.engine.SetObjectPropertyEx(model, instanceCollectionII, propertyObjects, ref instanceCube, 1); // // CollectionI contains 3 cubes and CollectionII contains 1 cube // // // The resulting model can be viewed in 3D-Editor.exe // RDF.engine.SaveModel(model, "c:\\created\\myFile.bin"); RDF.engine.CloseModel(model); } }