BIM Coordinator Program (INT) April 22, 2024

Find the next step in your career as a Graphisoft Certified BIM Coordinator!

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

ACAPI_Command_Call

Anonymous
Not applicable
I am trying to find info about the second argument to ACAPI_Command_Call.

    GSErrCode  ACAPI_Command_Call (
        const API_ModulID*     mdid,
        GSType                 cmdID,
        Int32                  cmdVersion,
        GSHandle               params,
        GSPtr                  resultData,
        bool                   silentMode
    );

Parameters
cmdID 
[in] the identifier of the command to be executed.

Examples have shown me two options - 'OBJO' and 'GDCO'.
- - What exactly is the 'identifier of the command'? I thought it would be the function name from the Add-on I was calling from that I want to run remotely. When I provide that, I get an error of "Too many characters for in character constant". So I am thinking there is a #define somewhere that might explain it a little more. No luck finding that.
- - What are the options, only the 2 I list above? And what do they mean?
- - How do I know when to use each option?

thanks -
3 REPLIES 3
Anonymous
Not applicable
As I dig into this a little more, I get to ACAPI_Register_SupportedService, which registers a command that can be used by other add-ons. Documentation on this shows an example:

err = ACAPI_Register_SupportedService ('DWFO', 4L);

that introduces another value for cmdID - - 'DWFO'. Any ideas on this one? My first thought is that when I use this to register the command, I can provide a logical name of my choice to be referenced later on by ACAPI_Command_Call.

Also, '4L' is the command version of the supported service - can you point me to further documentation of that for translation?

Please and thank you -
Hi! I haven't used this myself yet but I read through the documentation on it because I thought I could need it. I hope my thoughts on it can help a little anyway. I think the most important documentation page is: https://archicadapi.graphisoft.com/documentation/communication-manager.

Regarding the `cmdId` I also think that it's an identifier of your choice when you register the command. `cmdVersion` is also a version of your choice. I think of it as kind of like Archicad versions. E.g. You could add more functionality in your version 2 of your add-on and another add-on can then check if version 2 of is installed and use that extra functionality. "4L" in that example stands for version 4 where the number type is "long".

"parameters" seem to be the actual parameters to the command. Those parameters are then handled by an installed command handler (cf. https://archicadapi.graphisoft.com/documentation/acapi_install_modulcommandhandler and https://archicadapi.graphisoft.com/documentation/apimodulcommandproc) and the return values are stored in "resultData".

For code you can take a look at the API example projects Communication_Manager and Communication_Client.

Hope this helps a little bit
Bernd Schwarzenbacher - Archicad Add-On Developer - Get Add-Ons & Archicad Tips on my Website: Archi-XT.com
Anonymous
Not applicable
Bernd,

Thanks for the information. I will look in to this when I can circle back around to that project.
It already sounds helpful though.
Learn and get certified!