GetPropertyByName

Returns a handle to the objectTypeProperty or dataTypeProperty as stored inside.
When the property does not exist yet and the name is unique the property will be created on-the-fly and the handle will be returned.
When the name is not unique and given to a class or instance 0 will be returned.

Syntax

//   Visual Studio for Windows
public:
__int64 __declspec(dllexport) __stdcall GetPropertyByName(
            __int64             model,
            const char          * name
        );

//   Linux, OS-X and non-Visual Studio Windows solutions
public:
int64_t GetPropertyByName(
            int64_t             model,
            const char          * 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: 32 bit / 4 byte (reference)
This attribute represents the name of the property; either a datatype property or a relation (given as char array / ASCII). The name is given by the host and the attribute is not changed.

Example

Here you can find code snippits that show how the API call GetPropertyByName can be used.

#include 

int64_t model = CreateModel();

if (model) {
    //
    //  Classes
    //
    int64_t classArc3D = GetClassByName(model, "Arc3D");

    //
    //  Datatype Properties (attributes)
    //
    int64_t propertyRadius = GetPropertyByName(model, "radius"),
            propertyStart = GetPropertyByName(model, "start"),
            propertySize = GetPropertyByName(model, "size"),
            propertySegmentationParts = GetPropertyByName(model, "segmentationParts");

    //
    //  Instances (creating)
    //
    int64_t myInstanceArc3D = CreateInstance(classArc3D, nullptr);

    double  Pi = 2. * acos(0.),
            radius = 2.1,
            start = 0.,
            size = 2. * Pi;
    int64_t segmentationParts = 36;
        
    SetDatatypeProperty(myInstanceArc3D, propertyRadius, &radius, 1);
    SetDatatypeProperty(myInstanceArc3D, propertyStart, &start, 1);     //  in this case we could also do without, i.e. default value
    SetDatatypeProperty(myInstanceArc3D, propertySize, &size, 1);       //  in this case we could also do without, i.e. default value
    SetDatatypeProperty(myInstanceArc3D, propertySegmentationParts, &segmentationParts, 1);

    //
    //  The resulting model can be viewed in 3D-Editor.exe
    //
    SaveModel(model, "c:\\created\\myFile.bin");
    CloseModel(model);
}