2024-04-29 01:18 PM - edited 2024-05-22 10:36 AM
API means "Application Programming Interface,"; a software environment that programmers can use to create tools (or "add-ons") enhancing the functionality of Archicad.
While Archicad's functionality grows rapidly, version by version, it cannot and should not satisfy only some of the various needs of the A/E/C market in one shrink-wrapped solution. It cannot because the needs of some local or specialized markets are widespread (and sometimes contradictory) and should not because even if we manage to do so, the result would be a confusing and, thus, largely unusable software giant.
Graphisoft's development policy is to keep Archicad relatively "lean and mean"; that is, to provide only what can be regarded as universally (= worldwide) needed in Archicad — the core A/E/C functionality. The API Development Kit allows the creation of necessary custom functionality in the form of add-ons. It is important to note that having add-ons does not necessarily mean that users have to "assemble" their solutions from bits and pieces. These add-ons can be a part of the Archicad installer and can be indistinguishable for users from the "hard-wired" core functionality. In fact, there are already several functions in Archicad that were created using the API (e.g., the DXF/DWG I/O or the construction grid function) and part of the standard installation (see more at the "3. Examples" section below).
There are three main areas where additional functionality is needed.
API development is not the only way to provide extra functionality or to customize Archicad. From the very early days, Archicad offered customization possibilities through GDL programming, and GDL has remained an essential tool for customization. API add-ons can naturally reach GDL objects, and in fact - as explained in the "3. Examples" section below - the combined use of GDL objects and API add-ons is one of the most potent ways to enhance Archicad's functionality. Besides, the listing functions can be customized as well. These three programming environments provide a wide range of tools with the help of which one can successfully tackle the various problems in the A/E/C market. GDL and listing programming are not part of the current discussion. Please refer to the appropriate manual (part of the Archicad package) to learn about them.
API developers have to be experienced in C or C++ programming languages. Of course, knowing how but not what to develop is not enough. Therefore, having a thorough knowledge of Archicad's functionality is a prerequisite.
The API Development Kit aims to provide our development partners with a way to develop add-ons that can access and modify the Virtual Building's database. The API software tools can be divided into four major groups according to their functionality:
In most cases, the main reason behind creating an add-on is to perform changes in the Virtual Building's database. These functions provide practically unlimited access to the Virtual Building database elements, notably to:
Developers can also access other information related to the Virtual Building database, e.g.:
Using these tools, one can receive information and change, create, and delete any elements in the Archicad database. That is, using API, one can write a tool that, e.g., after the user selects a wall and activates the API command, checks the wall's geometric parameters and - by calculating and assigning the necessary parameters to a previously written GDL object - replaces it with a library item containing the detailed geometric data of a curtain wall.
To perform changes in the Virtual Building database, the user must first be able to communicate his intentions to the add-on; that is, a graphical user interface is necessary. The API offers a greatly enhanced array of tools to let developers select the most suitable interface solution for a given problem. The following possibilities are at the disposal of developers:
Creating new menu items
API developers can create new menu items within the standard Archicad menu structure (more than 15 possible insertion points). Moreover, developers can create entirely new menus also. Standard menu-enhancement methods are also possible such as:
Dialog boxes
API commands can open dialog boxes (modal dialogs and palettes). Here all the standard Archicad interface elements are at the developers' disposal. This feature allows developers to access the standard Archicad Interface Toolbox (called DG library) and provide an "Archicad look and feel" interface using the standard interface components (pen palettes, layer popups, etc.).
Palettes
API commands can also open palettes that can stay open during the entire operation if necessary. Similarly, developers can also access and use the DG Library for modal dialog boxes.
Note: using this feature, new toolboxes can also be created for API tools.
Graphical input from Archicad
A rich set of methods support graphical input from an Archicad project during an API command. It is possible to force the user to give geometric input of a point, line, arc, or polygon. You can also create your pet palette.
Cursor control
Developers can also control cursor attributes (shapes, sensitivity, plane) while the graphical input services run.
New windows
Developers can freely open new text and drawing windows and use Archicad's all-2D drafting engine for creating any drawing or diagram.
Note: It is impossible to alter or hide parts of the standard Archicad interface; only additions can be created to accommodate the new API add-ons.
While user actions entirely control some API add-ons through the GUI, developers may wish to start an event automatically without any user interaction. Naturally, the two methods can be combined. Thus the API add-ons can be tightly integrated into Archicad's working environment by linking standard Archicad events with API add-on actions.
These functions allow various user actions to be monitored and used as a "trigger" for other add-on actions. Developers are capable of getting information about the following events:
The sole purpose of these tools is to make development easier, faster, and less prone to errors.
In the following, we would like to present three API add-on examples that Graphisoft developed. These tools are very different in their functionality (I/O extension, architectural detailing, general modeling, respectively), in their packaging (universally bundled add-on, mostly bundled with locally different content and free "goodie" downloadable from Graphisoft's websites), and naturally in their appearance. They represent Archicad's API's versatility, and we hope it will inspire our developer partners in their work.
This add-on is responsible for Archicad's DWG, and DXF read and write functionality. It is a standard part of all Archicad packages. Therefore it may sound illogical to implement it as an add-on. However, DWG and DXF formats often change and usually do not coincide with our usual upgrade cycle. Despite this, we must be able to keep up with these changes as quickly as possible for the convenience of our users. The DWG/DXF I/O add-on allows us to adjust the DWG or DXF output without changing Archicad's source code (which would be a lot more time-consuming process).
The add-on's interface is relatively simple, but the technology behind it is rather complex.
Similarly, API developers can create I/O add-ons to practically any CAD or CG software if the necessary information is available.
RoofMaker - as its name suggests - creates roofs for Archicad projects. The architect first designs the roof with Archicad's Roof tool, then, using RoofMaker's parametric features, with a few clicks, they can create a complex roof structure with beams, rafters, etc. The new roof objects (placed by the API) are parametric GDL library parts and, therefore, can be easily modified later.
However, the problem is that roof structures are different in Europe and the US (not to speak about complex Japanese roofs !), and it would not be easy to accommodate all in one tool (and keep the interface simple…). For this reason, we decided that - instead of hard-coding a roof-creation tool into Archicad - RoofMaker should be an add-on customized to the major local markets. Thus - thanks to the API's plug-in architecture - we could satisfy local demands without compromising the unity of the core application.
It is essential to note that besides the API add-on that places the GDL objects, a fair amount of GDL programming is involved in the development of RoofMaker. This pattern - an API add-on placing and defining previously loaded GDL objects - is one of the most typical and robust add-on solutions, combining the strength of GDL and API.
Archicad is often criticized that while GDL is a very versatile tool for complex geometry, the average user needs help learning GDL scripting. Profiler is an add-on tool that combines GDL's flexible geometry with the ease of use of the Archicad interface. With Profiler, users can utilize the power of GDL's "Rotate" and "Sweep" commands without opening the GDL editor. In this case, however, the API does not simply give parameters to previously loaded GDL objects but creates them on the fly (users must name them, of course). This way, Profiler can maintain higher flexibility in creating free-form elements.
In the longer term, it may become necessary for Archicad to accommodate such functionality in the core application. However, we decided not to make Profiler part of the package but keep it a "goodie," an add-on tool that can be freely downloaded from Graphisoft's websites.
The Archicad API is a mature, modern development environment that allows Graphisoft and its partners to create a wide range of add-ons for the benefit of users. We at Graphisoft - not only the developer but at the same time the user of the API technology - are committed to continuously upgrading the API Development Kit along with the subsequent releases of Archicad.
We welcome any report of possible bugs or suggestions on improving API functionality. Graphisoft will do its best to incorporate these requests into future releases of the API Development Kit.