<?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 Re: question about getting an element's attribute in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/question-about-getting-an-element-s-attribute/m-p/266235#M4026</link>
    <description>I have resolved this. The problem was that I was passing the element layer index, instead of the composite one. This was my solution:&lt;BR /&gt;

          &lt;PRE&gt; if(typeIDs&lt;I&gt; == API_WallID){ // Its a wall
                compIndex = element.wall.composite;
            }
            
            if(typeIDs&lt;I&gt; == API_SlabID){ // Its a slab
                compIndex = element.slab.composite;
            }
            
            if(typeIDs&lt;I&gt; == API_RoofID){ // Its a roof
                compIndex = element.roof.shellBase.composite;
            }&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 09 Feb 2018 13:43:34 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-02-09T13:43:34Z</dc:date>
    <item>
      <title>question about getting an element's attribute</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/question-about-getting-an-element-s-attribute/m-p/266234#M4025</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;Hello Archicad developers!&lt;BR /&gt;&lt;BR /&gt;I have a little trouble with getting the names of each element's composite. The issue is that each time I cycle through my elements it returns the first element's composite name. I suspect that I don't use the &lt;STRONG&gt;ACAPI_Element_Get&lt;/STRONG&gt; function in the right way. &lt;BR /&gt;&lt;BR /&gt;Here is part of my code:&lt;BR /&gt;
&lt;PRE&gt; API_Element element;
    vector &amp;lt;elementsList&amp;gt; eL;
    GS::Array&amp;lt;API_ElemTypeID&amp;gt; typeIDs = {API_WallID, API_SlabID, API_RoofID}; // the types we are going to look for
 
    for(int i=0; i &amp;lt; typeIDs.GetSize(); i++){

        GS::Array&amp;lt;API_Guid&amp;gt; elemListGuid;
        ACAPI_Element_GetElemList (typeIDs&lt;I&gt;, &amp;amp;elemListGuid); // get the elements for each type
        
        for(int k=0; k &amp;lt; elemListGuid.GetSize(); k++){
            WriteReport("element number %i", k);
            
           
            GSErrCode         err2;
            
            BNZeroMemory (&amp;amp;element, sizeof (API_Element));
            element.header.typeID = typeIDs&lt;I&gt;;
            element.header.guid   = elemListGuid.Get(k); // GUID OF EACH ELEMENT
            
            err2 = ACAPI_Element_Get (&amp;amp;element); // GETTING THE ELEMENT ???
            
            if (err2 != NoError) {
                WriteReport_Alert ("Unknown element");
                return;
            }
            else{
                // we have element!
            }
            
            
            API_Attribute     attrib;
            GSErrCode         err3;
            
            BNZeroMemory (&amp;amp;attrib, sizeof (API_Attribute));
            
            attrib.header.typeID = API_CompWallID;
            attrib.header.index  = element.header.layer + 1; 
            
            err3 = ACAPI_Attribute_Get (&amp;amp;attrib);
            
            if (err3 == NoError){
               WriteReport_Alert("BINGO!! name is %s", attrib.header.name); // HERE IT ALWAYS PRINTS THE FIRST ELEMENT COMPOSITE NAME...
            }

        }
    }&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 12 Jul 2023 15:50:14 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/question-about-getting-an-element-s-attribute/m-p/266234#M4025</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-07-12T15:50:14Z</dc:date>
    </item>
    <item>
      <title>Re: question about getting an element's attribute</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/question-about-getting-an-element-s-attribute/m-p/266235#M4026</link>
      <description>I have resolved this. The problem was that I was passing the element layer index, instead of the composite one. This was my solution:&lt;BR /&gt;

          &lt;PRE&gt; if(typeIDs&lt;I&gt; == API_WallID){ // Its a wall
                compIndex = element.wall.composite;
            }
            
            if(typeIDs&lt;I&gt; == API_SlabID){ // Its a slab
                compIndex = element.slab.composite;
            }
            
            if(typeIDs&lt;I&gt; == API_RoofID){ // Its a roof
                compIndex = element.roof.shellBase.composite;
            }&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Feb 2018 13:43:34 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/question-about-getting-an-element-s-attribute/m-p/266235#M4026</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-02-09T13:43:34Z</dc:date>
    </item>
  </channel>
</rss>

