We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

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

can't make ACAPI_Element_Create work

zaza95
Participant

Hello, I'm pretty new to archicad api coding. I'm trying to do what I think to be a very simple task, create an object via api. I'm doing a sample code that should create an object in coordinates (0,0). I'm using an object that is already part of default archicad library (Culla.gsm for italian archicad). Could someone help me find what I'm doing wrong? I want also to say that, for now, I'm using a DEMO version of Archicad, please tell me if this could also be the cause of the issue.

When I run the add-on,  I get error code -2130313112 when calling ACAPI_Element_Create. This is the case without memo. If I de-comment memo and call ACAPI_Element_Create with memo archicad crashes.

 

I'm pasting the code I wrote:


Immagine 2024-11-04 212800.png


Immagine 2024-11-05 105752.png

 

Thanks in advance

 

Operating system used: Windows 11

1 REPLY 1
Ralph Wessel
Mentor

I recommend starting from some of the example projects - use them to see how the API works and then extend them a bit for experimentation. Some good places to start for creating objects are "Element_test" and "LibPart_Test". Both have examples for creating an object instance, e.g. a window.

Ralph Wessel BArch
Software Engineer Speckle Systems

Setup info provided by author