GetPropertyByNameW

Returns a handle to the objectTypeProperty or dataTypeProperty as stored inside.
When there is no property with such a name the return value is 0 (note that GetModellingStyle(..) can change this behavior).

Syntax

public const string enginedll = @"engine.dll";

[DllImport(enginedll, EntryPoint = "GetPropertyByNameW")]
public static extern Int64 GetPropertyByNameW(Int64 model, string name);

[DllImport(enginedll, EntryPoint = "GetPropertyByNameW")]
public static extern Int64 GetPropertyByNameW(Int64 model, byte[] name);    

Property model

Size: 64 bit / 8 byte (value)
The handle to the model. The model handle is static during its existance. Several models can be opened simultaniously within one session. Different models are always independent, threads are allowed to be running on different models simultaniously.

Property name

Size: 64 bit / 8 byte (reference)
This attribute represents the name of the property; either a datatype property or a relation (given as wchar_t array / Unicode). The name is given by the host and the attribute is not changed.

Example (based on pure API calls)

Here you can find code snippits that show how the API call GetPropertyByNameW 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.GetClassByNameW(model, System.Text.Encoding.Unicode.GetBytes("Arc3D"));

        //
        //  Datatype Properties (attributes)
        //
        Int64   propertyRadius = RDF.engine.GetPropertyByNameW(model, System.Text.Encoding.Unicode.GetBytes("radius")),
                propertyStart = RDF.engine.GetPropertyByNameW(model, System.Text.Encoding.Unicode.GetBytes("start")),
                propertySize = RDF.engine.GetPropertyByNameW(model, System.Text.Encoding.Unicode.GetBytes("size")),
                propertySegmentationParts = RDF.engine.GetPropertyByNameW(model, System.Text.Encoding.Unicode.GetBytes("segmentationParts"));

        //
        //  Instances (creating)
        //
        Int64   myInstanceArc3D = RDF.engine.CreateInstanceW(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.SaveModelW(model, System.Text.Encoding.Unicode.GetBytes("c:\\created\\myFile.bin"));
        RDF.engine.CloseModel(model);
    }
}