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.

How to specify code flow on ADK version?

pagliu96
Contributor

Hello everybody guys, my question is the following:

 

I saw that in the `ACAPIinc.h` file there are many constants for the software version like `ServerMainVers_xxx`, now I', doing the migration to AC27 and I saw that there are some old code blocks that are signaling through intellisense a compiler error.

 

Basically they can't find the new functions definition wrapped by the `MigrationHeader.h`, but they actually shouldn't search for it since that piece of code should be for AC25.

 

#include "PluginIpcCommandTask.h"

#if defined(ServerMainVers_2500)
#include "Utilities.h"

#include <spdlog/spdlog.h>

#include "GSRoot/StringConversion.hpp"
#include "HTTP/Client/ClientConnection.hpp"
#include "HTTP/Client/Request.hpp"
#include "HTTP/Client/Response.hpp"
#include "MemoryOBinaryChannel.hpp"
#include "JSON/JSON/JDOMParser.hpp"
#include "JSON/JSON/JDOMWriter.hpp"
#include "JSON/JSON/Value.hpp"

namespace knauf::archicad::plannersuite {

PluginIpcCommandTask::PluginIpcCommandTask(CommandId commandId, const std::string& commandParams)
    : commandId(commandId), commandParams(commandParams) {
    GSErrCode err = ::ACAPI_Goodies(APIAny_GetHttpConnectionPortID, &connectionPort);
    if (err != NoError) {
        throw;
    }
}

... doing other stuff

#endif

 

 Somehow I'm not using correctly the constants, since they are all enabled (this piece of code shouldn't be considered since I'm working on AC27 ADK Solution).

 

Thanks in advance 🙂 

P.S.: I know that by placing the migration header I would solve the intellisense error, but actually I don't really solve the underlying issue.

pagliu96_0-1709047377256.png

3 REPLIES 3
Joel Buehler
Enthusiast

im sorry im kinda having troubles to understand the question. waht is a adk? do you mean SKD?

i can only comment on this:  you state that you do a migration to AC27:

 

"I', doing the migration to AC27"

 

but you are using the ACAPI_Goodies API Call, that does not exist anymore.  

 

https://graphisoft.github.io/archicad-api-devkit/modules.html

 

i think your call is now in the AC27 API named "ACAPI_Command_GetHttpConnectionPort()"

 

i didnt knew that there is a migration header. haha. cool stuff. 

 

check out the goodies example. there is no API Call left that has the name goodies in it. 

 

JoelBuehler_0-1709139170255.png

as a comment: i really like that they renamed those functions. "goodie" was as meaningless as a namingconvetion can be. 

and i like that knauf is working on a plugin 😉 

 

kolioi
Booster

If you build for AC27 then ServerMainVers_2700 is defined but all previous versions are also defined (why?).

So, instead of writing code like this

#if defined(ServerMainVers_2500)
   // code for AC25
#endif

you can do this

#if !defined (ServerMainVers_2700)
    // code for AC26 and older versions
#endif

 

Thanks for both the answer guys, this is what I was searching for.

 

#if !defined (ServerMainVers_2700)
    // code for AC26 and older versions
#endif

 

The code between the pre-compiled headers is working until AC26, and not only for AC26.

 

Have a nice day!

Learn and get certified!