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

How do I know the input parameters when create an element

Anonymous
Not applicable
Such as "API_MeshType" in v11,when I attampt to create it using "ACAPI_Element_Creat",I don't know what are the input parameters to set before creating.How do I?

I'm sorry to my bad English!
2 REPLIES 2
Ralph Wessel
Mentor
wcyoot wrote:
Such as "API_MeshType" in v11,when I attampt to create it using "ACAPI_Element_Creat",I don't know what are the input parameters to set before creating.How do I?
A detailed answer would be too long. Basically you need to fill in the structure for the type of element you want to create, e.g. if you want to create a line you need to fill in the 'API_LineType' structure of the union called 'API_Element'.

The easiest way is to first use 'ACAPI_Element_GetDefaults', which fills in all the default settings for the element. You can then set the values of specific fields as required before calling 'ACAPI_Element_Create'.

Take a look at the 'Element_Test' example bundled with the API dev kit too.
Ralph Wessel BArch
Akos Somorjai
Graphisoft
Graphisoft
wcyoot wrote:
Such as "API_MeshType" in v11,when I attampt to create it using "ACAPI_Element_Creat",I don't know what are the input parameters to set before creating.How do I?
Yep, Ralph is right. All element structures contain settings-like parameters (those are the ones that you see when you open the Settings dialog in ArchiCAD for that element), and geometrical members (those are filled in via user input, for example when the user draws a wall by clicking at the two ends). The settings parameters can be filled with ACAPI_Element_GetDefaults(), but the geometrical parameters should be filled by your add-on. In the case of a wall, at least the begC and endC members of API_WallType should contain valid coordinates.

Hope this helps,

Akos