SetNameOfPropertyW

Sets/updates the name of the property, if no error it returns 0.
In case property does not exist it returns 1, when name cannot be updated 2.

Syntax

//   Visual Studio for Windows
public:
__int64 __declspec(dllexport) __stdcall SetNameOfPropertyW(
            __int64             rdfProperty,
            const wchar_t       * name
        );

//   Linux, OS-X and non-Visual Studio Windows solutions
public:
int64_t SetNameOfPropertyW(
            int64_t             rdfProperty,
            const wchar_t       * name
        );    

Property rdfProperty

Size: 64 bit / 8 byte (value)
This attribute represents a handle to the property, this can be either a datatype property (attribute), an object property (relation) or non-defined property. The handle will be static during the life-time of the model, when the model (or part of it) is saved and opened again, the handle will most probably be different.

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

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

#include 

int64_t model = CreateModel();

if (model) {
    //
    //  Classes
    //
    int64_t classCollection = GetClassByNameW(model, L"Collection"),
            classCube = GetClassByNameW(model, L"Cube");

    //
    //  Object Properties (relations)
    //
    int64_t propertyAbcd = CreatePropertyW(model, OBJECTPROPERTY_TYPE, L"abcd"),
            propertyObjects = GetPropertyByNameW(model, L"objects");

    //
    //  Datatype Properties (attributes)
    //
    int64_t propertyLength = GetPropertyByNameW(model, L"length"),
            propertyEfgh = CreatePropertyW(model, DATATYPEPROPERTY_TYPE_DOUBLE, L"efgh");

    //
    //  Instances (creating)
    //
    int64_t instanceCollection = CreateInstance(classCollection, nullptr),
            instanceCube = CreateInstance(classCube, nullptr);

    double  length = 2.,
            efgh = 1.7;

    SetDatatypeProperty(instanceCube, propertyLength, &length, 1);
    SetDatatypeProperty(instanceCollection, propertyEfgh, &efgh, 1);

    assert(GetVolume(instanceCollection, 0, 0) == 0.);

    wchar_t * propertyNameI = nullptr;
    GetNameOfPropertyW(propertyAbcd, &propertyNameI);

    wchar_t * propertyNameII = nullptr;
    GetNameOfPropertyW(propertyEfgh, &propertyNameII);

    SetNameOfPropertyW(propertyAbcd, L"InverseRelationControledByThirdParty");

    SetObjectProperty(instanceCube, propertyAbcd, &instanceCollection, 1);
    SetObjectProperty(instanceCollection, propertyObjects, &instanceCube, 1);

    assert(GetVolume(instanceCollection, 0, 0) == 8.);

    wchar_t * propertyNameIII = nullptr;
    GetNameOfPropertyW(propertyAbcd, &propertyNameIII);

    //
    //  The retrieved property names have the following values 
    //      propertyNameI   :  'abcd'
    //      propertyNameII  :  'efgh'
    //      propertyNameIII :  'InverseRelationControledByThirdParty'
    //

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