<?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: How can I apply override surfaces? in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/How-can-I-apply-override-surfaces/m-p/659996#M10282</link>
    <description>&lt;P&gt;&lt;a href="https://community.graphisoft.com/t5/user/viewprofilepage/user-id/12284"&gt;@Oleg&lt;/a&gt;&amp;nbsp; FYI Auto Spam was hiding the message.&lt;/P&gt;</description>
    <pubDate>Sat, 19 Apr 2025 18:44:39 GMT</pubDate>
    <dc:creator>Eduardo Rolon</dc:creator>
    <dc:date>2025-04-19T18:44:39Z</dc:date>
    <item>
      <title>How can I apply override surfaces?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-can-I-apply-override-surfaces/m-p/659847#M10276</link>
      <description>&lt;P&gt;For now,&amp;nbsp; in my Archicad addon, I need to apply override surfaces for these ("Outside Face Surface", "Internal Face Surface" &amp;amp; "Edge Surface") to be linked together with AC API. (they should be same material)&lt;BR /&gt;&lt;BR /&gt;So I have tried to use this code, but I am always get "GSErrCode" of "-2130312307".&amp;nbsp;&lt;BR /&gt;ChatGPT said it's read-only access issue, so I have tried the code after saving the project file.&amp;nbsp;&lt;BR /&gt;I am already purchased license so there should be no such problem.&lt;BR /&gt;&lt;BR /&gt;Here is my code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;void ApplySameOverrideSurface()
{
GS::Array&amp;lt;API_Guid&amp;gt; elemList;
GSErrCode err = ACAPI_Element_GetElemList(API_ZombieElemID, &amp;amp;elemList, APIFilt_OnVisLayer);
if (err != NoError)
return;

for (const API_Guid&amp;amp; guid : elemList) {
API_Element element;
BNZeroMemory(&amp;amp;element, sizeof(API_Element));
element.header.guid = guid;

if (ACAPI_Element_Get(&amp;amp;element) != NoError)
continue;

int type;
#if AC_VERSION &amp;gt;= 26
type = element.header.type.typeID;
#else
type = element.header.typeID;
#endif

API_AttributeIndex index;
index = CreateAttributeIndex(1);

API_Element mask;
ACAPI_ELEMENT_MASK_CLEAR(mask);

bool pass = type == API_WallID || API_ObjectID;

if (pass == false)
continue;

switch (type)
{
case API_WallID:
//element.wall.composite != CreateAttributeIndex(0) ? index = element.wall.composite : index = element.wall.buildingMaterial;
element.wall.oppMat = element.wall.buildingMaterial;
element.wall.refMat = element.wall.buildingMaterial;
element.wall.sidMat = element.wall.buildingMaterial;

ACAPI_ELEMENT_MASK_SET(mask, API_WallType, oppMat);
ACAPI_ELEMENT_MASK_SET(mask, API_WallType, refMat);
ACAPI_ELEMENT_MASK_SET(mask, API_WallType, sidMat);
break;
case API_ObjectID:
element.object.mat = index;
element.object.useObjMaterials = false;
ACAPI_ELEMENT_MASK_SET(mask, API_ObjectType, mat);
ACAPI_ELEMENT_MASK_SET(mask, API_ObjectType, useObjMaterials);
break;
}

//// Now apply changes
err = ACAPI_Element_Change(&amp;amp;element, &amp;amp;mask, nullptr, 0, true);
if (err != NoError) {
DBPrintf("Failed to override surface for element: %s\n", APIGuidToString(guid).ToCStr().Get());
}
}
}&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;If anyone knows the reason, please let me know about it asap.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Kind Regards,&lt;BR /&gt;Vladica Zivic&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" color="grey"&gt;Operating system used: &lt;EM&gt;Windows &lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 799px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/86021i22CF2926FC1AAC7E/image-dimensions/799x669?v=v2" width="799" height="669" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 803px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/86022i2E8FFD4BA957B00B/image-dimensions/803x233?v=v2" width="803" height="233" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Apr 2025 21:23:12 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-can-I-apply-override-surfaces/m-p/659847#M10276</guid>
      <dc:creator>VladicaZivic</dc:creator>
      <dc:date>2025-04-21T21:23:12Z</dc:date>
    </item>
    <item>
      <title>Re: How can I apply override surfaces?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-can-I-apply-override-surfaces/m-p/659850#M10277</link>
      <description>&lt;P&gt;Here are the screenshots.&lt;BR /&gt;Kind Regards,&lt;BR /&gt;Vladica&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot_2.png" style="width: 804px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/86023i2D5EBA82B0CFE941/image-dimensions/804x111?v=v2" width="804" height="111" role="button" title="Screenshot_2.png" alt="Screenshot_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot_3.png" style="width: 801px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/86024i1C31AFD85BA55540/image-dimensions/801x683?v=v2" width="801" height="683" role="button" title="Screenshot_3.png" alt="Screenshot_3.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Apr 2025 21:23:40 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-can-I-apply-override-surfaces/m-p/659850#M10277</guid>
      <dc:creator>VladicaZivic</dc:creator>
      <dc:date>2025-04-21T21:23:40Z</dc:date>
    </item>
    <item>
      <title>Re: How can I apply override surfaces?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-can-I-apply-override-surfaces/m-p/659957#M10278</link>
      <description>&lt;P&gt;&lt;SPAN class="aNeGP0gI0B9AV8JaHPyH" data-src-align="0:2"&gt;Don&lt;/SPAN&gt;&lt;SPAN&gt;'t &lt;/SPAN&gt;&lt;SPAN class="aNeGP0gI0B9AV8JaHPyH" data-src-align="3:6"&gt;believe&lt;/SPAN&gt; ChatGPT&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;API ErrorCode:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE class="markdownTable"&gt;
&lt;TBODY&gt;
&lt;TR class="markdownTableRowOdd"&gt;
&lt;TD class="markdownTableBodyNone"&gt;&lt;CODE&gt;APIERR_NEEDSUNDOSCOPE&lt;/CODE&gt;&lt;/TD&gt;
&lt;TD class="markdownTableBodyNone"&gt;-2130312307&lt;/TD&gt;
&lt;TD class="markdownTableBodyNone"&gt;8106038D&lt;/TD&gt;
&lt;TD class="markdownTableBodyNone"&gt;The called command should be encapsulated in a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A class="el" href="https://community.graphisoft.com/group___command.html#gab7bf9e1351986b4bb6c69dab76766f1a" target="_blank"&gt;ACAPI_CallUndoableCommand&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;scope.&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&lt;BR /&gt;You need to call the&amp;nbsp;&lt;SPAN&gt;ACAPI_Element_Change in a ACAPI_CallUndoableCommand.&lt;BR /&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Apr 2025 16:04:36 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-can-I-apply-override-surfaces/m-p/659957#M10278</guid>
      <dc:creator>Oleg</dc:creator>
      <dc:date>2025-04-18T16:04:36Z</dc:date>
    </item>
    <item>
      <title>Re: How can I apply override surfaces?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-can-I-apply-override-surfaces/m-p/659958#M10279</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Dont belive ChatGPT&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;API ErrorCide:&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;TABLE class="markdownTable"&gt;
&lt;TBODY&gt;
&lt;TR class="markdownTableRowOdd"&gt;
&lt;TD class="markdownTableBodyNone"&gt;&lt;CODE&gt;APIERR_NEEDSUNDOSCOPE&lt;/CODE&gt;&lt;/TD&gt;
&lt;TD class="markdownTableBodyNone"&gt;-2130312307&lt;/TD&gt;
&lt;TD class="markdownTableBodyNone"&gt;8106038D&lt;/TD&gt;
&lt;TD class="markdownTableBodyNone"&gt;The called command should be encapsulated in a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A class="el" href="https://community.graphisoft.com/group___command.html#gab7bf9e1351986b4bb6c69dab76766f1a" target="_blank"&gt;ACAPI_CallUndoableCommand&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;scope.&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;Some functions like the ACAPI_Element_Change should be called in a&amp;nbsp;ACAPI_CallUndoableCommand.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Apr 2025 16:14:00 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-can-I-apply-override-surfaces/m-p/659958#M10279</guid>
      <dc:creator>Oleg</dc:creator>
      <dc:date>2025-04-18T16:14:00Z</dc:date>
    </item>
    <item>
      <title>Re: How can I apply override surfaces?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-can-I-apply-override-surfaces/m-p/659961#M10280</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I &lt;/SPAN&gt;&lt;SPAN class="aNeGP0gI0B9AV8JaHPyH" data-src-align="7:7"&gt;tried&lt;/SPAN&gt;&lt;SPAN&gt; to reply&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="aNeGP0gI0B9AV8JaHPyH" data-src-align="0:6"&gt;twice&lt;/SPAN&gt;&lt;SPAN class="aNeGP0gI0B9AV8JaHPyH" data-src-align="23:1"&gt;,&lt;/SPAN&gt; &lt;SPAN class="aNeGP0gI0B9AV8JaHPyH" data-src-align="25:2"&gt;but&lt;/SPAN&gt;&lt;SPAN&gt; the &lt;/SPAN&gt;&lt;SPAN class="aNeGP0gI0B9AV8JaHPyH" data-src-align="28:6"&gt;answers&lt;/SPAN&gt;&lt;SPAN&gt; were &lt;/SPAN&gt;&lt;SPAN class="aNeGP0gI0B9AV8JaHPyH" data-src-align="35:2"&gt;not&lt;/SPAN&gt; &lt;SPAN class="aNeGP0gI0B9AV8JaHPyH" data-src-align="38:13"&gt;published&lt;/SPAN&gt;&lt;SPAN class="aNeGP0gI0B9AV8JaHPyH" data-src-align="51:1"&gt;.&lt;/SPAN&gt;&lt;SPAN&gt; I'll &lt;/SPAN&gt;&lt;SPAN class="aNeGP0gI0B9AV8JaHPyH" data-src-align="53:8"&gt;try&lt;/SPAN&gt; &lt;SPAN class="aNeGP0gI0B9AV8JaHPyH" data-src-align="62:7"&gt;again&lt;/SPAN&gt;&lt;SPAN class="aNeGP0gI0B9AV8JaHPyH" data-src-align="69:1"&gt;.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="aNeGP0gI0B9AV8JaHPyH" data-src-align="69:1"&gt;Error&amp;nbsp;-2130312307 is:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;APIERR_NEEDSUNDOSCOPE "The called command should be encapsulated in a ACAPI_CallUndoableCommand scope"&lt;BR /&gt;&lt;BR /&gt;Some functions should be called in a&amp;nbsp; ACAPI_CallUndoableCommand.&lt;BR /&gt;See documentation on&amp;nbsp;ACAPI_CallUndoableCommand and examples.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Apr 2025 16:42:14 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-can-I-apply-override-surfaces/m-p/659961#M10280</guid>
      <dc:creator>Oleg</dc:creator>
      <dc:date>2025-04-18T16:42:14Z</dc:date>
    </item>
    <item>
      <title>Re: How can I apply override surfaces?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-can-I-apply-override-surfaces/m-p/659996#M10282</link>
      <description>&lt;P&gt;&lt;a href="https://community.graphisoft.com/t5/user/viewprofilepage/user-id/12284"&gt;@Oleg&lt;/a&gt;&amp;nbsp; FYI Auto Spam was hiding the message.&lt;/P&gt;</description>
      <pubDate>Sat, 19 Apr 2025 18:44:39 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-can-I-apply-override-surfaces/m-p/659996#M10282</guid>
      <dc:creator>Eduardo Rolon</dc:creator>
      <dc:date>2025-04-19T18:44:39Z</dc:date>
    </item>
  </channel>
</rss>

