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

Possible to add property definitions on project open/new?

cfranklin
Newcomer
Hi again,

Curious as to if I can create a few new property definitions from a project event, so all projects with the add-on will have these new properties to have their values set later on elements.

It seems the only hangup is that
ACAPI_Property_CreatePropertyDefinition()
needs undoable scope, but calling that command via CallUndoableCommand from any of the project events (ACAPI_Notify_CatchProjectEvent) causes a crash.

I assume this is explained here in the docs of CallUndoableCommand :
Add-ons may not call this function from their element database event handler callback, because those notifications are sent from within an existing database transaction."


Does this mean that its impossible to create properties from callbacks of project events? I have no issues creating properties from a CatchNewElement callback...

Thanks
3 REPLIES 3

cfranklin
Newcomer
One other thing... Its strange that this causes a crash but creating a property group does not. I can successfully create a property group from a project open event just fine.

Ralph Wessel
Mentor
I'm not certain whether this operation is supported during that notification, but there is an alternative solution. Take a look at the documentation for ACAPI_Command_CallFromEventLoop. Use this function to instruct ARCHICAD to call your add-on at a point when it is suitable to handle functions that might otherwise be context-sensitive. There is example code with the documentation.
Ralph Wessel BArch

cfranklin
Newcomer
Thanks! Really appreciate the help, seems I miss things in the docs all the time...

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!