<?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 How to copy element without click event? in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-copy-element-without-click-event/m-p/397748#M8571</link>
    <description>&lt;P&gt;Below is sample code from AC Element Test, Is there anyone know could it possible to copy an element without click event by looping thru all select element's guid instead?&lt;/P&gt;
&lt;DIV&gt;&lt;LI-CODE lang="cpp"&gt;=================

void Do_CopyElem (void)
{
API_Element element = {};
API_ElementMemo memo = {};
GSErrCode err;

API_ElemType type;
API_Guid guid;
if (!ClickAnElem ("Click an element", API_ZombieElemID, nullptr, &amp;amp;type, &amp;amp;guid)) {
WriteReport_Alert ("No element was clicked");
return;
}

element.header.type = type;
element.header.guid = guid;

err = ACAPI_Element_Get (&amp;amp;element);
if (err == NoError)
err = ACAPI_Element_GetMemo (element.header.guid, &amp;amp;memo);
if (err != NoError) {
ErrorBeep ("ACAPI_Element_Get/Memo", err);
return;
}

if (err == NoError) {
element.header.floorInd ++;
err = ACAPI_Element_Create (&amp;amp;element, &amp;amp;memo);
if (err != NoError)
ErrorBeep ("ACAPI_Element_Create", err);
}

// ---- consistency check
if (err == NoError)
CompareElems (element, memo);
// ----

ACAPI_DisposeElemMemoHdls (&amp;amp;memo);
}
=================
&lt;/LI-CODE&gt;&lt;/DIV&gt;</description>
    <pubDate>Tue, 17 Sep 2024 10:47:30 GMT</pubDate>
    <dc:creator>Newbie</dc:creator>
    <dc:date>2024-09-17T10:47:30Z</dc:date>
    <item>
      <title>How to copy element without click event?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-copy-element-without-click-event/m-p/397748#M8571</link>
      <description>&lt;P&gt;Below is sample code from AC Element Test, Is there anyone know could it possible to copy an element without click event by looping thru all select element's guid instead?&lt;/P&gt;
&lt;DIV&gt;&lt;LI-CODE lang="cpp"&gt;=================

void Do_CopyElem (void)
{
API_Element element = {};
API_ElementMemo memo = {};
GSErrCode err;

API_ElemType type;
API_Guid guid;
if (!ClickAnElem ("Click an element", API_ZombieElemID, nullptr, &amp;amp;type, &amp;amp;guid)) {
WriteReport_Alert ("No element was clicked");
return;
}

element.header.type = type;
element.header.guid = guid;

err = ACAPI_Element_Get (&amp;amp;element);
if (err == NoError)
err = ACAPI_Element_GetMemo (element.header.guid, &amp;amp;memo);
if (err != NoError) {
ErrorBeep ("ACAPI_Element_Get/Memo", err);
return;
}

if (err == NoError) {
element.header.floorInd ++;
err = ACAPI_Element_Create (&amp;amp;element, &amp;amp;memo);
if (err != NoError)
ErrorBeep ("ACAPI_Element_Create", err);
}

// ---- consistency check
if (err == NoError)
CompareElems (element, memo);
// ----

ACAPI_DisposeElemMemoHdls (&amp;amp;memo);
}
=================
&lt;/LI-CODE&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 17 Sep 2024 10:47:30 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-copy-element-without-click-event/m-p/397748#M8571</guid>
      <dc:creator>Newbie</dc:creator>
      <dc:date>2024-09-17T10:47:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to copy element without click event?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-copy-element-without-click-event/m-p/400268#M8630</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;Yes you should take a look at &lt;A href="https://graphisoft.github.io/archicad-api-devkit/group___element.html#gad0a3cc26ebbcb18613c2d3df01eb7384" target="_self"&gt;ACAPI_ElementList_GetList&lt;/A&gt; for that. Use &lt;CODE&gt;API_ZombieElemID&lt;/CODE&gt; if you want to get elements of all types. Something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;GS::Array&amp;lt;API_Guid&amp;gt; allElements;
ACAPI_Element_GetElemList (API_ZombieElemID, &amp;amp;allElements);
for (auto elemGuid : allElements) {
    // Do your stuff here
}
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Hope that helps!&lt;BR /&gt;Bernd&lt;/P&gt;</description>
      <pubDate>Sat, 30 Sep 2023 07:40:44 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-copy-element-without-click-event/m-p/400268#M8630</guid>
      <dc:creator>BerndSchwarzenbacher</dc:creator>
      <dc:date>2023-09-30T07:40:44Z</dc:date>
    </item>
  </channel>
</rss>

