APIERR_BADINDEX getting element
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2006-02-24
01:57 AM
- last edited on
2023-08-07
11:22 AM
by
Doreena Deng
2006-02-24
01:57 AM
Hello,
I've found on several drawings in ArchiCAD 9 an ACAPI_Element_Get returns APIERR_BADINDEX. Just wondering how this could happen? It doesn't happen in ArchiCAD 7.
Here is what my code is doing:
I've found on several drawings in ArchiCAD 9 an ACAPI_Element_Get returns APIERR_BADINDEX. Just wondering how this could happen? It doesn't happen in ArchiCAD 7.
Here is what my code is doing:
ACAPI_Element_GetNum(API_TextID, &num); for(ii=1;ii<=num;++ii) { if(ACAPI_Element_Filter(API_TextID, ii, APIFilt_IsEditable)) { memset(&element, 0, sizeof(API_Element)); element.header.index = ii; element.header.typeID = API_TextID; err = ACAPI_Element_Get(&element); if(err == APIERR_BADINDEX) { // this is true when ii==num which should be a valid index, shouldn't it ? } }
Labels:
- Labels:
-
Add-On (C++)
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2006-02-24 08:53 AM
2006-02-24
08:53 AM
adambutler wrote:The number returned by ACAPI_Element_Get is the highest index used in the database, which is not necessarily the number of elements in the database. The documentation states:
I've found on several drawings in ArchiCAD 9 an ACAPI_Element_Get returns APIERR_BADINDEX. Just wondering how this could happen? It doesn't happen in ArchiCAD 7.
Please note that the returned number does not necessarily match the number of existing elements of that type, as the ArchiCAD database may contain deleted elements as well; see the ACAPI_Element_Filter function for more details.
Ralph Wessel BArch
Central Innovation
Central Innovation
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2006-02-27 01:59 AM
2006-02-27
01:59 AM
Hello,
My concern is that I am filtering the elements, so this element with a bad index is not deleted. I think I will have to go through my code and 'continue' if I get a badindex result from an ACAPI_Element_Get
Thanks,
Adam
My concern is that I am filtering the elements, so this element with a bad index is not deleted. I think I will have to go through my code and 'continue' if I get a badindex result from an ACAPI_Element_Get
Thanks,
Adam