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

Add-on development (API DevKit 21)

Anonymous
Not applicable
Hello,
I would like to develop an addOn which get all the elements of a wall in order to use them to generate automatically an object I created before. I am a begginer and it'd be nice if I can receive some assistance
Thank you for your help !
Regards.
5 REPLIES 5
dfintha
Graphisoft Alumni
Graphisoft Alumni
Hello,

If I understand you well, you'd like to reuse the settings of a previously placed Wall instance to create similar new ones.
This can be done by creating a favorite with the ACAPI_Favorite_Create function, and then using it to fill the default
settings of a new element with the ACAPI_Favorite_GetDefaults function.
If you want to reuse the settings directly without creating a favorite, you can use the ACAPI_Element_Change function
with the withdel argument set to false. This way, the function creates a copy of the wall, and applies the changes to
the copied element.

Best regards,
Dénes
Anonymous
Not applicable
dfintha wrote:
Hello,

If I understand you well, you'd like to reuse the settings of a previously placed Wall instance to create similar new ones.
This can be done by creating a favorite with the ACAPI_Favorite_Create function, and then using it to fill the default
settings of a new element with the ACAPI_Favorite_GetDefaults function.
If you want to reuse the settings directly without creating a favorite, you can use the ACAPI_Element_Change function
with the withdel argument set to false. This way, the function creates a copy of the wall, and applies the changes to
the copied element.

Best regards,
Dénes
Hello,
Thank you for your answer. I talked to my friend and he would like to get information from a wall (length,height,number of windows, position, etc...) and then, I will draw it in GDL. To sum up, I need a fonction that would allow me to get this information in order to use it in GDL code (just like the wall accessories addon but with my own object, not a Wall Framing object) .
I'm still searching but if you have an idea, it would be great !
Best regards.
Anonymous
Not applicable
dfintha wrote:
Hello,

If I understand you well, you'd like to reuse the settings of a previously placed Wall instance to create similar new ones.
This can be done by creating a favorite with the ACAPI_Favorite_Create function, and then using it to fill the default
settings of a new element with the ACAPI_Favorite_GetDefaults function.
If you want to reuse the settings directly without creating a favorite, you can use the ACAPI_Element_Change function
with the withdel argument set to false. This way, the function creates a copy of the wall, and applies the changes to
the copied element.

Best regards,
Dénes
Hello,
Thank you Dénes for your answer !
I'm interesting in these functions, however, there is no examples on the website and I don't know how to use them. I'm still searching but can you give me an example of their use please. That would help me much.
Best Regards.
Cédric.
dfintha
Graphisoft Alumni
Graphisoft Alumni
Hello,

If you'd like to use values calculated in your C++ code, your best choice might be using parameters describing these values
in your GDL object, and then creating an Object instance with your Library Part and customized parameters.

To do so, you'll have to use ACAPI_LibPart_Search to find your Library Part's index, ACAPI_LibPart_GetParams to get the
default parameter list, which you can change for the instance to be placed, and ACAPI_Element_Create to create an object instance.

Documentation for these functions can be found in the installed DevKit's Documentation folder, or
at http://archicadapi.graphisoft.com. The latter requires you to log in to the site.

Best regards,
Dénes
Anonymous
Not applicable
dfintha wrote:
Hello,

If you'd like to use values calculated in your C++ code, your best choice might be using parameters describing these values
in your GDL object, and then creating an Object instance with your Library Part and customized parameters.

To do so, you'll have to use ACAPI_LibPart_Search to find your Library Part's index, ACAPI_LibPart_GetParams to get the
default parameter list, which you can change for the instance to be placed, and ACAPI_Element_Create to create an object instance.

Documentation for these functions can be found in the installed DevKit's Documentation folder, or
at http://archicadapi.graphisoft.com. The latter requires you to log in to the site.

Best regards,
Dénes
Thank you,
I understand the steps but I don't manage to search my library part. I tried to create a LibPart variable and modify his file name. However, I can't modify it because the type of the filename is GS:uchar_t and I don't understand how to use it (there is no documentation of this type in the site). Can you help me with this step please ?
Thank you for your answers.
Best regards.