Possible to add property definitions on project open/new?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2019-07-29
11:32 PM
- last edited on
‎2022-10-04
04:25 PM
by
Daniel Kassai
‎2019-07-29
11:32 PM
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
I assume this is explained here in the docs of CallUndoableCommand :
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
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
Labels:
- Labels:
-
Add-On (C++)
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2019-07-29 11:47 PM
‎2019-07-29
11:47 PM
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.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2019-07-31 12:40 AM
‎2019-07-31
12:40 AM
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
Central Innovation
Central Innovation
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2019-07-31 04:14 PM
‎2019-07-31
04:14 PM
Thanks! Really appreciate the help, seems I miss things in the docs all the time...