Archicad C++ API
About Archicad add-on development using the C++ API.

Batch Conversion of ArchiCAD GSM Files to other file types

Anonymous
Not applicable
Hello,

I am looking for ways to automatically convert GSM files to other file types, preferably such as OBJ, 3DS or alike. Looking through the API, I have not really found any pointers on where to go. I would like to do this without user input, if possible.

Is such a form of batch conversion possible? Or do you know of any methods to use the API/other means to convert between file types away from Archicad's format?

Kind regards,
M. Strobl
3 REPLIES 3
Ralph Wessel
Mentor
mstrobl wrote:
I am looking for ways to automatically convert GSM files to other file types, preferably such as OBJ, 3DS or alike. Looking through the API, I have not really found any pointers on where to go. I would like to do this without user input, if possible.
Is such a form of batch conversion possible? Or do you know of any methods to use the API/other means to convert between file types away from Archicad's format?
This is possible, but not easy. You also need to consider how worthwhile it will be, given that the objects will lose all their 'intelligence' (parameters and scripts) and become pure geometry with the default parameters for the object - is this useful?

If so, it is relatively simply to obtain the geometry of a batch of library parts. Simply iterate through the objects in the loaded library, placing one instance in the model, extracting the 2D/3D geometry, and finally deleting the instance. That leaves the problem of exporting the data in the required format. The DXF/DWG add-on can be driven by another add-on to export data in those formats, but I don't know about the add-ons for 3DS of OBJ. You may need to look for a 3rd party resource for that (or - worst case - develop your own).

Take a look at ACAPI_Element_ShapePrims to extract 2D geometry, and the ModelAccess API for 3D geometry.
Ralph Wessel BArch
Software Engineer Speckle Systems
Anonymous
Not applicable
If so, it is relatively simply to obtain the geometry of a batch of library parts. Simply iterate through the objects in the loaded library, placing one instance in the model, extracting the 2D/3D geometry, and finally deleting the instance. That leaves the problem of exporting the data in the required format. The DXF/DWG add-on can be driven by another add-on to export data in those formats, but I don't know about the add-ons for 3DS of OBJ. You may need to look for a 3rd party resource for that (or - worst case - develop your own).

Take a look at ACAPI_Element_ShapePrims to extract 2D geometry, and the ModelAccess API for 3D geometry.
Thank you very much for your help, Ralph!

This sounds very much like what I need. However, I would like to automate the process further. What I'd like to do is to automatically convert more than one model, if possible with no user interaction at all.

To give an example, a very ideal scenario would be if I could instruct ArchiCAD via the command line to load a model and then to execute my plugin.

Thanks again,

take care
Martin
Ralph Wessel
Mentor
mstrobl wrote:
I would like to automate the process further. What I'd like to do is to automatically convert more than one model, if possible with no user interaction at all.
To give an example, a very ideal scenario would be if I could instruct ArchiCAD via the command line to load a model and then to execute my plugin.
You can open a project with ACAPI_Automate and APIDo_OpenID, so that part is straight-forward. However, if you want to drive this from outside ArchiCAD, this is not directly supported by the API. There are work-arounds, but nothing officially supported (yet). I have made this work in the past using UI methods (in the API and host OS) to communicate externally with an ArchiCAD add-on.
Ralph Wessel BArch
Software Engineer Speckle Systems