Developer forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Building an addon for different AC versions

kuvbur
Booster

I made a small open source add-on for synchronizing properties and parameters of GDL objects. It works in version 24, but I would like to release an add-on for other versions. What is the best way to organize the assembly and testing of an add-on for different versions of Archicad (provided that the code is compatible with other versions)?

https://github.com/kuvbur
1 ACCEPTED SOLUTION

Solution
Viktor Kovacs
Graphisoft Alumni
Graphisoft Alumni

Archicad API is relatively stable, but sometimes there are changes that won't compile with a newer version of the Development Kit. The question here is how to handle this situation.

There are two ways:

  1. Keep a separate source for different versions (like a GitHub branch for all versions). In this case you don't have to deal with version-specific codes, but on the other hand you have to maintain the rest of the the code in multiple places.
  2. Use one source code for both versions. In this case it is easier to handle the code, but on the other hand you have to deal with different versions in the same code.

The selected solution depends on your code. If you have relatively small codebase the second one is recommended. You can have compiler flags to determine the version of base Archicad, so you can write something like this:

 

#if defined (ServerMainVers_2500)
	using MemoryIChannel = GS::MemoryIChannel;
	using MemoryOChannel = GS::MemoryOChannel;
#else
	using MemoryIChannel = IO::MemoryIChannel;
	using MemoryOChannel = IO::MemoryOChannel;
#endif

 

or this:

 

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

 

This is how the Maze Generator Add-On is implemented.

From the build point of view I would generate projects with cmake to different folders inside the Build folder (like Build/AC24 and Build/AC25). With this solution you will have separate projects for the same code base.

 

View solution in original post

2 REPLIES 2

Solution
Viktor Kovacs
Graphisoft Alumni
Graphisoft Alumni

Archicad API is relatively stable, but sometimes there are changes that won't compile with a newer version of the Development Kit. The question here is how to handle this situation.

There are two ways:

  1. Keep a separate source for different versions (like a GitHub branch for all versions). In this case you don't have to deal with version-specific codes, but on the other hand you have to maintain the rest of the the code in multiple places.
  2. Use one source code for both versions. In this case it is easier to handle the code, but on the other hand you have to deal with different versions in the same code.

The selected solution depends on your code. If you have relatively small codebase the second one is recommended. You can have compiler flags to determine the version of base Archicad, so you can write something like this:

 

#if defined (ServerMainVers_2500)
	using MemoryIChannel = GS::MemoryIChannel;
	using MemoryOChannel = GS::MemoryOChannel;
#else
	using MemoryIChannel = IO::MemoryIChannel;
	using MemoryOChannel = IO::MemoryOChannel;
#endif

 

or this:

 

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

 

This is how the Maze Generator Add-On is implemented.

From the build point of view I would generate projects with cmake to different folders inside the Build folder (like Build/AC24 and Build/AC25). With this solution you will have separate projects for the same code base.

 

View solution in original post

ReignBough
Booster

We use #2 on the recommended solution. We started on AC18 and currently AC25. But we currently supporting AC21 above (since our current projects use these versions). Whenever new AC version is/will be released, we made sure that the add-ons that we have will be compatible to that new version.

 

If ever you will be supporting lower version of AC (below 24 in your op), I recommend you to start to the lowest version first, then go up to the latest version. When we have new add-on, we define which AC versions will be supported, and start coding to the lowest version. After completing the add-on (or even one functionality of it), we start migrating to the next version and change anything that might conflict to the newer version (renamed functions, new functions, removed/obsolete functions, etc.).

~ReignBough~
ARCHICAD 24 INT 4018 FULL (from AC18)
Windows 10 Pro, Intel Core i7-4790 CPU @ 3.60GHz, 32.0GB RAM, 64-bit OS

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!