cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Streamline your workflows and master BIM coordination! Program starts April 28!

Archicad C++ API
About Archicad add-on development using the C++ API.
SOLVED!

How to edit parameters of the element on the scene

Not applicable
Seems like this piece of code is getting lights from the scene correctly, but the values are not saved into objects. What else am I supposed to do in order to change parameters on the element?
Thanks for the help.
 
GS::Array<API_Guid> elemList;
        ACAPI_Element_GetElemList(API_LampID, &elemList, APIFilt_OnActFloor, APIVarId_Light, APINULLGuid);
        for (const auto& e : elemList) {
            API_Element element;
            BNZeroMemory(&element, sizeof(API_Element));
            element.header.guid = e;
            if (ACAPI_Element_Get(&element, 0) == NoError) {
                element.lamp.lightColor = API_RGBColor{ 1.f, 0.f, 0.f };
                element.lamp.lightIsOn  = true;
            }
        }
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Use ACAPI_Element_Change to write the change back to the database.
Ralph Wessel BArch
Central Innovation

View solution in original post

2 REPLIES 2
Solution
Use ACAPI_Element_Change to write the change back to the database.
Ralph Wessel BArch
Central Innovation
Not applicable
Thanks! To make this post more helpful, you have to wrap the actual element changing logic into ACAPI_CallUndoableCommand because in another case you get APIERR_NEEDSUNDOSCOPE and no changes will occur.