Syntax
public const string enginedll = @"engine.dll"; [DllImport(enginedll, EntryPoint = "GetNameOfPropertyWEx")] public static extern IntPtr GetNameOfPropertyWEx(Int64 model, Int64 rdfProperty, out IntPtr name); public static string GetNameOfPropertyWEx(Int64 model, Int64 rdfProperty) { IntPtr name = IntPtr.Zero; GetNameOfPropertyWEx(model, rdfProperty, out name); return System.Runtime.InteropServices.Marshal.PtrToStringUni(name); }
Property model
Size: 64 bit / 8 byte (value)Property rdfProperty
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 snippets that show how the API call GetNameOfPropertyWEx 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 properties handled 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 propertyCnt = 0; RDF.Engine.OrderedHandles(model, (IntPtr) null, out propertyCnt, (IntPtr) null, 2, 2); // // Classes // Int64 classCollection = RDF.Engine.GetClassByNameW(model, System.Text.Encoding.Unicode.GetBytes("Collection")), classCube = RDF.Engine.GetClassByNameW(model, System.Text.Encoding.Unicode.GetBytes("Cube")); // // Object Properties (relations) // Int64 propertyAbcd = RDF.Engine.CreatePropertyW(model, RDF.Engine.OBJECTPROPERTY_TYPE, System.Text.Encoding.Unicode.GetBytes("abcd")), propertyObjects = RDF.Engine.GetPropertyByNameW(model, System.Text.Encoding.Unicode.GetBytes("objects")); System.Diagnostics.Debug.Assert(propertyAbcd == propertyCnt + 1); System.Diagnostics.Debug.Assert(propertyObjects > 0 && propertyObjects <= propertyCnt); // // Datatype Properties (attributes) // Int64 propertyLength = RDF.Engine.GetPropertyByNameW(model, System.Text.Encoding.Unicode.GetBytes("length")), propertyEfgh = RDF.Engine.CreatePropertyW(model, RDF.Engine.DATATYPEPROPERTY_TYPE_DOUBLE, System.Text.Encoding.Unicode.GetBytes("efgh")); System.Diagnostics.Debug.Assert(propertyLength > 0 && propertyLength <= propertyCnt); System.Diagnostics.Debug.Assert(propertyEfgh == propertyCnt + 2); // // Instances (creating) // Int64 instanceCollection = RDF.Engine.CreateInstance(classCollection, (string) null), instanceCube = RDF.Engine.CreateInstance(classCube, (string) null); double length = 2.0, efgh = 1.7; RDF.Engine.SetDatatypeProperty(instanceCube, propertyLength, ref length, 1); RDF.Engine.SetDatatypeProperty(instanceCollection, propertyEfgh, ref efgh, 1); System.Diagnostics.Debug.Assert(RDF.Engine.GetVolume(instanceCollection, (IntPtr) 0, (IntPtr) 0) == 0.0); IntPtr propertyNamePtrI = IntPtr.Zero; RDF.Engine.GetNameOfPropertyWEx(model, propertyAbcd, out propertyNamePtrI); string propertyNameI = System.Runtime.InteropServices.Marshal.PtrToStringUni(propertyNamePtrI); IntPtr propertyNamePtrII = IntPtr.Zero; RDF.Engine.GetNameOfPropertyWEx(model, propertyEfgh, out propertyNamePtrII); string propertyNameII = System.Runtime.InteropServices.Marshal.PtrToStringUni(propertyNamePtrII); RDF.Engine.SetNameOfPropertyWEx(model, propertyAbcd, System.Text.Encoding.Unicode.GetBytes("InverseRelationControledByThirdParty")); RDF.Engine.SetObjectProperty(instanceCube, propertyAbcd, ref instanceCollection, 1); RDF.Engine.SetObjectProperty(instanceCollection, propertyObjects, ref instanceCube, 1); System.Diagnostics.Debug.Assert(RDF.Engine.GetVolume(instanceCollection, (IntPtr) 0, (IntPtr) 0) == 8.0); IntPtr propertyNamePtrIII = IntPtr.Zero; RDF.Engine.GetNameOfPropertyWEx(model, propertyAbcd, out propertyNamePtrIII); string propertyNameIII = System.Runtime.InteropServices.Marshal.PtrToStringUni(propertyNamePtrIII); // // The retrieved property names have the following values // propertyNameI : 'abcd' // propertyNameII : 'efgh' // propertyNameIII : 'InverseRelationControledByThirdParty' // // // The resulting model can be viewed in 3D-Editor.exe // RDF.Engine.SaveModelW(model, System.Text.Encoding.Unicode.GetBytes("c:\\created\\myFile.bin")); RDF.Engine.CloseModel(model); } }