2022-08-18 02:43 PM - edited 2022-08-18 02:44 PM
Dear Graphisoft-Community,
I'm currently trying to build my first C++ AddOn, but I'm struggeling a bit.
I'm trying to set a property for selected elements, but the part where I set doesn't seem to work.
My current code looks/works somewhat like this:
1) I get the selected Elements with ACAPI_Selection_Get
static void getSelectedElements(GS::Array<API_Neig>& selNeigs)
{
GSErrCode err;
API_SelectionInfo selectionInfo;
err = ACAPI_Selection_Get(&selectionInfo, &selNeigs, true);
}
2) Looking for the Property I want to edit (2 Steps)
This method finds the wanted PropertyGroup by its name
This method above gets used in the following:
propertyDefintion will then have the information for our user-defined property ["Identifizierung","Bezeichnung"]
With the selected Neigs and the propertyDefinition accuired i wanted to use
to get the property of the Element and edit it
but after I call
none of the selected Elements have a changed their value of Bezeichnung.
So how can i edit a property of an element? What am i missing?
And on a side note, this my very first AC/C++ AddOn, so if you get any recommendations for my code (readability, performance or general things) those are much appreciated 🙂
Solved! Go to Solution.
2022-08-31 11:57 AM
For anyone with the same problem as me:
I think I used the wrong method.
I started using ACAPI_ElementList_ModifyPropertyValue() which resulted in change
2022-08-20 12:16 AM
Hi Dayiz
You may just need to encapsulate in an 'Undo' session.. this has got me a few times. 😀
});
2022-08-24 04:17 PM
Hello Ben,
Thanks four your help, i tried it out and encapsulated the important bits of the addon:
the method "numberBezeichnung()" then gets called in MenuCommandHandler.
But when i execute the AddOn, no values get changed. To check if my selection works i added the line
DG::InformationAlert(GS::ValueToUniString(selNeigs.GetSize()), "", "Ok");
which returns me after executing the addon the amount of the selected elements, which works.
Any idea why that still happens?
2022-08-31 11:57 AM
For anyone with the same problem as me:
I think I used the wrong method.
I started using ACAPI_ElementList_ModifyPropertyValue() which resulted in change