GetNameOfPropertyW
Syntax
public const string enginedll = @"engine.dll"; [DllImport(enginedll, EntryPoint = "GetNameOfPropertyW")] public static extern IntPtr GetNameOfPropertyW(Int64 rdfProperty, out IntPtr name); public static string GetNameOfPropertyW(Int64 rdfProperty) { IntPtr name = IntPtr.Zero; GetNameOfPropertyW(rdfProperty, out name); return System.Runtime.InteropServices.Marshal.PtrToStringUni(name); }
Property rdfProperty
Size: 64 bit / 8 byte (value)Property name
Size: 32 bit / 4 byte (reference)
Example (based on pure API calls)
Here you can find code snippits that show how the API call GetNameOfPropertyW 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 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")); // // 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")); // // 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.GetNameOfPropertyW(propertyAbcd, out propertyNamePtrI); string propertyNameI = System.Runtime.InteropServices.Marshal.PtrToStringUni(propertyNamePtrI); IntPtr propertyNamePtrII = IntPtr.Zero; RDF.engine.GetNameOfPropertyW(propertyEfgh, out propertyNamePtrII); string propertyNameII = System.Runtime.InteropServices.Marshal.PtrToStringUni(propertyNamePtrII); RDF.engine.SetNameOfPropertyW(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.GetNameOfPropertyW(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); } }