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

Custom Property UserUndefined

guillaumeks1
Participant

Hello,

 

I'm working on an add-on for AC24.

The base of our add-on is the Browser_Control example.

We are selecting an element in the model and we are importing properties information for the selected element.

We cannot create a new Property Group like its done with Property_Test.

API_PropertyGroup group;
group.guid = APINULLGuid;
group.name = "PROPERTY GROUP NAME" + guid.ToUniString();
ACAPI_Property_CreatePropertyGroup(group);

is not working.

 

Moreover, we would like to set property definition default value to Undefined:

definition.defaultValue.basicValue.variantStatus = API_VariantStatusUserUndefined;

is not working.

 

Thank you for your help.

6 REPLIES 6
Viktor Kovacs
Graphisoft
Graphisoft

Please make sure that you are calling ACAPI_Property_CreatePropertyGroup in an undoable command scope (ACAPI_CallUndoableCommand).

 

More information here (check the Undo Scope) section:

https://archicadapi.graphisoft.com/Archicad-maze-generator-add-on-tutorial-part-1

Thank you for your answer.

Well I think so. Please find below our code:

guillaumeks1_0-1634303872029.png

 

This function only shows the palette, it doesn't do any modification in the database. After the palette is opened, the undo scope closes.

 

You have to wrap the code with ACAPI_CallUndoableCommand where the real modification happens.

guillaumeks1
Participant

Thank you for your answer.

Sorry, I am quite new in Cpp and Archicad API. Like said before, our Add On is based on the Browser_Control.

We use it in order to add data from a web server.

All of our code is in the function BrowserPalette::RegisterACAPIJavaScriptObject. We try to wrap it with  ACAPI_CallUndoableCommand however without success.

guillaumeks1_0-1634572705289.png

 

guillaumeks1
Participant

Hello Viktor,

Sorry to insist, but we still cannot succeed in wrapping the BrowserPalette::RegisterACAPIJavascriptObject() or any JSFunction inside  ACAPI_CallUndoableCommand in the case of the Browser_Control example.

Any idea?

Thank you for your assistance.

Viktor Kovacs
Graphisoft
Graphisoft

Could you please attach the wrapping code?