<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic APIERR_BADINDEX getting element in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/APIERR-BADINDEX-getting-element/m-p/32749#M7028</link>
    <description>&lt;DIV class="actalk-migrated-content"&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;Here is what my code is doing:&lt;BR /&gt;
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;ACAPI_Element_GetNum(API_TextID, &amp;amp;num);
for(ii=1;ii&amp;lt;=num;++ii)
{
   if(ACAPI_Element_Filter(API_TextID, ii, APIFilt_IsEditable))
   {
      memset(&amp;amp;element, 0, sizeof(API_Element));
      element.header.index = ii;
      element.header.typeID = API_TextID;
      err = ACAPI_Element_Get(&amp;amp;element);
      if(err == APIERR_BADINDEX)
      {
            // this is true when ii==num which should be a valid index, shouldn't it ?
      }
}

&lt;/PRE&gt;
&lt;/DIV&gt;</description>
    <pubDate>Mon, 07 Aug 2023 09:22:42 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-08-07T09:22:42Z</dc:date>
    <item>
      <title>APIERR_BADINDEX getting element</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/APIERR-BADINDEX-getting-element/m-p/32749#M7028</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;Here is what my code is doing:&lt;BR /&gt;
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;ACAPI_Element_GetNum(API_TextID, &amp;amp;num);
for(ii=1;ii&amp;lt;=num;++ii)
{
   if(ACAPI_Element_Filter(API_TextID, ii, APIFilt_IsEditable))
   {
      memset(&amp;amp;element, 0, sizeof(API_Element));
      element.header.index = ii;
      element.header.typeID = API_TextID;
      err = ACAPI_Element_Get(&amp;amp;element);
      if(err == APIERR_BADINDEX)
      {
            // this is true when ii==num which should be a valid index, shouldn't it ?
      }
}

&lt;/PRE&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 07 Aug 2023 09:22:42 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/APIERR-BADINDEX-getting-element/m-p/32749#M7028</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-08-07T09:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: APIERR_BADINDEX getting element</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/APIERR-BADINDEX-getting-element/m-p/32750#M7029</link>
      <description>&lt;BLOCKQUOTE&gt;adambutler wrote:&lt;BR /&gt;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.
&lt;/BLOCKQUOTE&gt;

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:&lt;BR /&gt;

&lt;BLOCKQUOTE&gt;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.&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Fri, 24 Feb 2006 07:53:52 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/APIERR-BADINDEX-getting-element/m-p/32750#M7029</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2006-02-24T07:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: APIERR_BADINDEX getting element</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/APIERR-BADINDEX-getting-element/m-p/32751#M7030</link>
      <description>Hello,&lt;BR /&gt;
&lt;BR /&gt;
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&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Adam</description>
      <pubDate>Mon, 27 Feb 2006 00:59:29 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/APIERR-BADINDEX-getting-element/m-p/32751#M7030</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-02-27T00:59:29Z</dc:date>
    </item>
  </channel>
</rss>

