2024 Technology Preview Program:
Master powerful new features and shape the latest BIM-enabled innovations
2020-08-04
04:09 PM
- last edited on
2021-09-15
09:54 AM
by
Noemi Balogh
Solved! Go to Solution.
2020-08-04 06:52 PM
Tomer1 wrote:Assuming that when you say, "File.pln is opened", that means even if the user opens the project:
The activation point is after the file is loaded.
Example of the wanted process:
1. File.pln is opened on a computer with my addon
2. After the file done loading, the addon executes some scripts
2020-08-04 04:27 PM
2020-08-04 04:41 PM
Ralph wrote:I didn’t check the python api because I know it doesn’t have all the feature that the c++ api provide.
GS has introduced Python and JSON development features that are primarily supporting external apps driving Archicad. Do you think they might support the actions you intend to perform on the open project?
2020-08-04 05:02 PM
Tomer1 wrote:Yes, it's certainly possible with the C++ API - and has the potential to be lot better too. I just wanted to be certain the alternatives had been considered.
I didn’t check the python api because I know it doesn’t have all the feature that the c++ api provide.
I practically really Prefer to only use the c++ api for everything, including what I’m asking here. I have a large and complicated addon with more than 20 classes..
Isn’t it possible to do it with the c++ api?
2020-08-04 05:20 PM
Ralph wrote:The activation point is after the file is loaded.
Tomer1 wrote:Yes, it's certainly possible with the C++ API - and has the potential to be lot better too. I just wanted to be certain the alternatives had been considered.
I didn’t check the python api because I know it doesn’t have all the feature that the c++ api provide.
I practically really Prefer to only use the c++ api for everything, including what I’m asking here. I have a large and complicated addon with more than 20 classes..
Isn’t it possible to do it with the c++ api?
First, what is the intended activation point for your process, i.e. does it need to be triggered by an external application or can it be started within Archicad and then query an external application for the intended process parameters?
2020-08-04 06:52 PM
Tomer1 wrote:Assuming that when you say, "File.pln is opened", that means even if the user opens the project:
The activation point is after the file is loaded.
Example of the wanted process:
1. File.pln is opened on a computer with my addon
2. After the file done loading, the addon executes some scripts
2020-08-05 08:23 AM
Ralph wrote:File.pln is opened means that I opened AC file (Archicad was closed and I double clicked a pln file). Will it work?
Tomer1 wrote:Assuming that when you say, "File.pln is opened", that means even if the user opens the project:
The activation point is after the file is loaded.
Example of the wanted process:
1. File.pln is opened on a computer with my addon
2. After the file done loading, the addon executes some scripts
1) When the add-onInitialisefunction is called (when it's loaded), call ACAPI_Notify_CatchProjectEventso Archicad notifies you when project events occur, e.g. opening/saving/closing etc.
2) When Archicad invokes the callback with a project event, check the event type isAPINotify_Open
3) You could immediately run whatever process is required on receivingAPINotify_Open, but it's safer to ask Archicad to notify your add-on as soon as it's safe for all kinds of activity (some actions can otherwise cause a crash or be ignored). We do this if we want to display some UI component to the user (e.g. show a palette), validate project content or ensure add-on preferences are loaded/valid.
4) To delay processing until an appropriate moment, you can request a callback from Archicad usingACAPI_Command_CallFromEventLoop. The documentation for this function has a code example you can use. Your callback handler can implement whatever process you need to action on the project. If you intend to modify the project, don't forget to fold your process into ACAPI_CallUndoableCommand
2020-08-05 09:31 AM
Tomer1 wrote:Yes, the notification works for any action that opens a project.
File.pln is opened means that I opened AC file (Archicad was closed and I double clicked a pln file). Will it work?