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.

Add-on not loading in ArchiCAD 27

kency
Booster

Hello all,

 

We have been developing an Add-on using dev kit version 25 and Archicad 25. The same code was built successfully with ArchiCAD devkit 26 and we could load it successfully in ArchiCAD 26.

 

However, for version 27, the build with devkit 27 was successful but the add-on is not being loaded.  Anything that we should be considering?

kency_0-1704452209500.png

 

4 REPLIES 4

Hi Kency,


Here are a few things that changed that you might want to double check:

  • Since AC27 the Add-On needs to be compiled using C++17.
    But I think your compilation would have already failed if you didn't have this setup correctly.
  • There was a preview of the SDK for the technical preview and there was an update later. Make sure to use the latest 27.3001 SDK.
  • Since you are on macOS, double check that your deployment version is at least 10.15 (check in CMake setup and used Info.plist). Although this might not be the issue, since AC26 has the same version here.
  • Also the library path changed for AC27. On macOS it's now: <DEVKITDIR>/Support/Lib/libACAP_STAT.a
  • On macOS you have to make sure to use compatible binary versions. Id suggest making universal binaries so it works with both the Intel & Apple Silicon versions of Archicad.

This is all I can think of for now. If none of this works, maybe you can reduce your Add-On to a minimal example (remove all code with functionality, just leave in the barebones Add-On structure with your compilation setup) that you can share for us to debug.

Best,
Bernd

Bernd Schwarzenbacher - Archicad Add-On Developer - Get Add-Ons & Archicad Tips on my Website: Archi-XT.com
kency
Booster

I think I was doing it incorrectly earlier. When I tried now the compilation failed. Meanwhile, I was checking the CMake template project that ArchiCAD provides https://github.com/GRAPHISOFT/archicad-addon-cmake

What does the RFIX* and RINT folders mean?

To my knowledge the R stands for "Resources".
RFIX are fixed resources. In the sense that they are independent of the language.
So there are RFIX.win fixed resources for Windows and RFIX.mac fixed resources for macOS.

RINT are resources localized to an international language version (analogous to Archicad INT version).

Bernd Schwarzenbacher - Archicad Add-On Developer - Get Add-Ons & Archicad Tips on my Website: Archi-XT.com
kency
Booster

Sharing the mistakes and changes that I did so that it helps someone else.

  • We were already developing in Archicad 26. So instead of clearing the Build folder(which already existed for 26) while the cmake command, only the xcode project name was changed.  Thereby the 27 xcode project was able to get the dev kit of 26. Clearing the Build folder and rebuilding failed the build for me. For which we had to make few changes as mentioned in below points. Takeaway: Keep separate Build folder for different versions

 

cmake -B Build27 -G "Xcode" -DAC_API_DEVKIT_DIR=/Applications/Graphisoft\ Archicad\ API\ DevKit\ 27.3001/Support -DAC_ADDON_NAME=AddOn . 

 

 

  • There were quite a few changes in the function names from Archicad27 for which there is a header file in DevKit ACAPI_Migration.hpp(including this conditionally with the pre processor directive gave errors.) See comments for https://community.graphisoft.com/t5/Archicad-C-API/ACAPI-MigrationHeader-hpp/td-p/576765
  •  We have to write wrapper functions for handling API_OverriddenAttribute, API_AttributeIndex etc. Check below code snippet below for examples of such functions. We have included the following the MigrationUtils.hpp.

MigrationUtils.hpp

 

#ifndef MIGRATIONUTILS_HPP
#define MIGRATIONUTILS_HPP

#include "ACAPinc.h"
#if defined(ServerMainVers_2700)
#include "MigrationHeader27.hpp"
#endif

void SetAPIElementType (API_Element& element, API_ElemTypeID elemTypeId);
API_AttributeIndex GetAttributeIndex(Int32 index);
bool IsAttributeIndexPositive(API_AttributeIndex index);
API_OverriddenAttribute GetOverriddenAttribute(API_AttributeIndex attrIndex);
#endif

 

 

MigrationUtils.cpp

 

 

 

#include "MigrationUtils.hpp"

void SetAPIElementType (API_Element& element, API_ElemTypeID elemTypeId)
{
#ifdef ServerMainVers_2600
	element.header.type = API_ElemType (elemTypeId);
#else
	element.header.typeID = elemTypeId;
#endif
}

API_AttributeIndex GetAttributeIndex(Int32 index) {
#ifdef ServerMainVers_2700
    return ACAPI_CreateAttributeIndex(index);
#else
    return index;
#endif
}

bool IsAttributeIndexPositive(API_AttributeIndex index) {
#ifdef ServerMainVers_2700
    return index.IsPositive();
#else
    return index > 0;
#endif
}

API_OverriddenAttribute GetOverriddenAttribute(API_AttributeIndex attrIndex) {
#ifdef ServerMainVers_2700
    APIOptional<API_AttributeIndex> optional = {};
    optional.value = attrIndex;
    optional.hasValue = true;
    return optional;
#else
    API_OverriddenAttribute overriddenAttribute = {};
    overriddenAttribute.attributeIndex = attrIndex;
    overriddenAttribute.overridden = true;
    return overriddenAttribute;
#endif
}
​

 

 

Let me know if there is any other better approach 🙂 

Learn and get certified!