BIM Coordinator Program (INT) April 22, 2024

Find the next step in your career as a Graphisoft Certified BIM Coordinator!

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

ACAPI_Element_Delete issue

Anonymous
Not applicable
Hello,
i'm trying to use the ACAPI_Element_Delete function which requires an "ACAPI_Elem_Head **" value as first parameter in order to delete the right element (as written in the Database Overview).

In my code, i first set the variable "API_Element *currentElement;" which contains my element's adress :
"currentElement = &element;"

I then try to use the "ACAPI_Element_Delete" function :
"ACAPI_Element_Delete(*currentElement->header, 1);"

But i've got C2100 error : illegal indirection.

Do you see where is my mistake ?

Thanks a lot.
1 REPLY 1
Ralph Wessel
Mentor
atila-diffusion wrote:
i'm trying to use the ACAPI_Element_Delete function which requires an "ACAPI_Elem_Head **" value as first parameter in order to delete the right element (as written in the Database Overview).
In my code, i first set the variable "API_Element *currentElement;" which contains my element's adress :
"currentElement = &element;"
I then try to use the "ACAPI_Element_Delete" function :
"ACAPI_Element_Delete(*currentElement->header, 1);"
You're trying to dereference a variable that isn't a pointer, i.e. currentElement->header is a ACAPI_Elem_Head structure (not a pointer to one). Even if it was, you need to provide a pointer to a pointer (a handle) to the data. Try something like this:
API_Elem_Head* head = &element.header;
GSErrCode err = ACAPI_Element_Delete(&head, 1);
Ralph Wessel BArch
Learn and get certified!