Save data into the Element records


This paper give hints on:

  • how you can assign additional information to, or
  • with other words how you can save own data into

any elements placed onto the floor plan.

 

Limitations

All ARCHICAD elements can hold extra information (the previous 128-byte limit has been removed in ARCHICAD 8). The registration table is global for the whole project; add-ons are identified by their module ID. It means that one add-on can save the same number of bytes to any kind of element.

 

Requirements

The structure of the user data is unified for ARCHICAD 8, and it contains the following required fields:

  • The version number of the data — this enforces future compatibility.
  • The platform where the data was stored.
  • And, of course, the data itself, which can contain an arbitrary number of bytes.

 

Data Structure

The registration table is saved into the project file. ARCHICAD never deletes any registration data. This ensures that your custom data will be preserved, even if your add-on is not installed. It can happen if the user moves a project onto another ARCHICAD installation. If you pass a nullptr handle in the appropriate part of the user data, the custom data will be erased.

The registration itself does not ensure that the data structure of every database element will be extended automatically by the requested number of bytes. These extra bytes are allocated on your request only.

To add your extra bytes to a given element, you should call the ACAPI_Element_SetUserData function, and you can get your data assigned to any element with the ACAPI_Element_GetUserData function. On the parameter list you have to pass an API_ElementUserData structure to store the requested data.