<?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 Selection handling in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/Selection-handling/m-p/572233#M8773</link>
    <description>&lt;P&gt;Hello! I've been trying to modify an element selection, but I'm having no success pulling the desired guids. It counts the elements in the selection.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ACAPI_Element_GetElemList (API_WallID, &amp;amp;elemList); would work but actually only selects things accoding to the first ever selection. After that, it'll only modify the elements first selected. can't reset selection.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;element.header.guid = elemList[i].guid; did the trick, selNeigs[I].guid won't, it compiles without warnings though.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;I've tried&amp;nbsp;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;ACAPI_Selection_GetSelectedElement(&amp;amp;selNeigs, &amp;amp;elemList); but it's not recognized.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;    API_SelectionInfo    selectionInfo;
    GS::Array&amp;lt;API_Neig&amp;gt; selNeigs;
//    GS::Array&amp;lt;API_Guid&amp;gt; elemList;
    
    ACAPI_Selection_Get (&amp;amp;selectionInfo, &amp;amp;selNeigs, false, false);
    
    GSErrCode err = ACAPI_CallUndoableCommand ("Wall change",
                                               [&amp;amp;] () -&amp;gt; GSErrCode {


//        ACAPI_Selection_GetSelectedElement(&amp;amp;selNeigs, &amp;amp;elemList);           
//             err = ACAPI_Element_GetElemList (API_WallID, &amp;amp;elemList);
        
        for (uint32 i = 0; i &amp;lt; selNeigs.GetSize () &amp;amp;&amp;amp; err == NoError; ++i) {
            API_Element element = {};
            element.header.guid = selNeigs[i].guid;
//            element.header.guid = elemList[i].guid;
            
            if (ACAPI_Element_Get (&amp;amp;element) == NoError) {
                /* do what you want */
                
                ACAPI_Element_Get (&amp;amp;element);
//                FlipWall(element.header.guid);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 16 Sep 2024 12:36:35 GMT</pubDate>
    <dc:creator>vdentello</dc:creator>
    <dc:date>2024-09-16T12:36:35Z</dc:date>
    <item>
      <title>Selection handling</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Selection-handling/m-p/572233#M8773</link>
      <description>&lt;P&gt;Hello! I've been trying to modify an element selection, but I'm having no success pulling the desired guids. It counts the elements in the selection.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ACAPI_Element_GetElemList (API_WallID, &amp;amp;elemList); would work but actually only selects things accoding to the first ever selection. After that, it'll only modify the elements first selected. can't reset selection.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;element.header.guid = elemList[i].guid; did the trick, selNeigs[I].guid won't, it compiles without warnings though.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;I've tried&amp;nbsp;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;ACAPI_Selection_GetSelectedElement(&amp;amp;selNeigs, &amp;amp;elemList); but it's not recognized.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;    API_SelectionInfo    selectionInfo;
    GS::Array&amp;lt;API_Neig&amp;gt; selNeigs;
//    GS::Array&amp;lt;API_Guid&amp;gt; elemList;
    
    ACAPI_Selection_Get (&amp;amp;selectionInfo, &amp;amp;selNeigs, false, false);
    
    GSErrCode err = ACAPI_CallUndoableCommand ("Wall change",
                                               [&amp;amp;] () -&amp;gt; GSErrCode {


//        ACAPI_Selection_GetSelectedElement(&amp;amp;selNeigs, &amp;amp;elemList);           
//             err = ACAPI_Element_GetElemList (API_WallID, &amp;amp;elemList);
        
        for (uint32 i = 0; i &amp;lt; selNeigs.GetSize () &amp;amp;&amp;amp; err == NoError; ++i) {
            API_Element element = {};
            element.header.guid = selNeigs[i].guid;
//            element.header.guid = elemList[i].guid;
            
            if (ACAPI_Element_Get (&amp;amp;element) == NoError) {
                /* do what you want */
                
                ACAPI_Element_Get (&amp;amp;element);
//                FlipWall(element.header.guid);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2024 12:36:35 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Selection-handling/m-p/572233#M8773</guid>
      <dc:creator>vdentello</dc:creator>
      <dc:date>2024-09-16T12:36:35Z</dc:date>
    </item>
    <item>
      <title>Re: Selection handling</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Selection-handling/m-p/572501#M8775</link>
      <description>&lt;P&gt;Made it work with a lot of trial and error.&amp;nbsp;&lt;BR /&gt;This time, it was able to request the guids from the selected Neigs without using:&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;ACAPI_Selection_GetSelectedElement&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Actually, I declared GSErrCode err = NoError; &amp;nbsp;and then just tried err = ACAPI_Selection_Get instead and it did the trick. For reference, the way it actually worked (selection_get will also work before callUndoable):&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;    GSErrCode err = NoError;
    API_SelectionInfo   selectionInfo;
    GS::Array&amp;lt;API_Neig&amp;gt; selNeigs;



    err = ACAPI_CallUndoableCommand ("Wall change",
                                               [&amp;amp;] () -&amp;gt; GSErrCode {

    err = ACAPI_Selection_Get (&amp;amp;selectionInfo, &amp;amp;selNeigs, false, false);

        for (uint32 i = 0; i &amp;lt; selNeigs.GetSize () &amp;amp;&amp;amp; err == NoError; ++i) {
            API_Element element = {};
            element.header.guid = selNeigs[i].guid;

            if (ACAPI_Element_Get (&amp;amp;element) == NoError) {
                /* do what you want */
                
                ACAPI_Element_Get (&amp;amp;element);
    //                FlipWall(element.header.guid);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2023 15:03:39 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Selection-handling/m-p/572501#M8775</guid>
      <dc:creator>vdentello</dc:creator>
      <dc:date>2023-10-24T15:03:39Z</dc:date>
    </item>
    <item>
      <title>Re: Selection handling</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Selection-handling/m-p/572556#M8776</link>
      <description>&lt;P&gt;Hi Vítor,&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;ACAPI_Selection_GetSelectedElement&lt;/STRONG&gt; is only available since AC27. So if you are using &amp;lt;=AC26 you'll have to use &lt;STRONG&gt;ACAPI_Selection_Get&lt;/STRONG&gt; as you've found.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2023 20:23:35 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Selection-handling/m-p/572556#M8776</guid>
      <dc:creator>BerndSchwarzenbacher</dc:creator>
      <dc:date>2023-10-24T20:23:35Z</dc:date>
    </item>
    <item>
      <title>Re: Selection handling</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Selection-handling/m-p/572690#M8782</link>
      <description>&lt;P&gt;In any case,&amp;nbsp;&lt;STRONG&gt;ACAPI_Selection_GetSelectedElement&lt;/STRONG&gt; would have to take an input from an auxiliary function as it seems?&amp;nbsp;&lt;STRONG&gt;ACAPI_Selection_Get&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;actually outs outs the neighs, that could be converted.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2023 12:45:35 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Selection-handling/m-p/572690#M8782</guid>
      <dc:creator>vdentello</dc:creator>
      <dc:date>2023-10-25T12:45:35Z</dc:date>
    </item>
    <item>
      <title>Re: Selection handling</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Selection-handling/m-p/572824#M8794</link>
      <description>&lt;P&gt;Ups sry! you are right. &lt;STRONG&gt;ACAPI_Selection_Get&lt;/STRONG&gt; stays the same in AC27.&lt;/P&gt;
&lt;P data-unlink="true"&gt;The AC26 equivalent to &lt;STRONG&gt;ACAPI_Selection_GetSelectedElement&lt;/STRONG&gt; is &lt;STRONG&gt;ACAPI_Goodies(&lt;/STRONG&gt;&lt;STRONG&gt;APIAny_GetSelectedElementID,...)&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2023 10:12:16 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Selection-handling/m-p/572824#M8794</guid>
      <dc:creator>BerndSchwarzenbacher</dc:creator>
      <dc:date>2023-10-26T10:12:16Z</dc:date>
    </item>
  </channel>
</rss>

