<?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 do I change the group of an element? in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/How-do-I-change-the-group-of-an-element/m-p/86433#M7437</link>
    <description>&lt;DIV class="actalk-migrated-content"&gt;Hi. I'm developing an Archicad add-on that is supposed to automatically change values and coordinates in a plan. At a certain point I have to change data inside a text object which is member of a group. Since the content field can't be changed while the object is in a group, the element must first get out of the group, apply the changes and then get back in. I keep getting the APIERR_BADPARS error from ACAPI_Element_Change function. The code goes like this:&lt;BR /&gt;&lt;BR /&gt;
&lt;PRE&gt;... //element processing

long g=0;
g=elem.header.groupId;

ACAPI_ELEMENT_MASK_CLEAR (mask);
ACAPI_ELEMENT_MASK_SET (mask, API_TextType, head);
elem.text.head.groupId=0;
err = ACAPI_Element_Change (&amp;amp;elem, &amp;amp;mask, NULL, 0, true);

... // text object content change based on ACAPI_Goodies - APIAny_ChangeContentID. This works fine on non-grouped text elements.

ACAPI_ELEMENT_MASK_CLEAR (mask);
ACAPI_ELEMENT_MASK_SET (mask, API_TextType, head);
elem.text.head.groupId=g;
err = ACAPI_Element_Change (&amp;amp;elem, &amp;amp;mask, NULL, 0, true);&lt;/PRE&gt;
The code above lies within an undo session. &lt;BR /&gt;&lt;BR /&gt;I cant' figure out the trick, so .. any help would be apreciated. &lt;IMG style="display: inline;" src="https://community.graphisoft.com/legacyfs/online/emojis/icon_biggrin.gif" border="0" /&gt;&lt;/DIV&gt;</description>
    <pubDate>Mon, 07 Aug 2023 08:27:38 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-08-07T08:27:38Z</dc:date>
    <item>
      <title>How do I change the group of an element?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-do-I-change-the-group-of-an-element/m-p/86433#M7437</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;Hi. I'm developing an Archicad add-on that is supposed to automatically change values and coordinates in a plan. At a certain point I have to change data inside a text object which is member of a group. Since the content field can't be changed while the object is in a group, the element must first get out of the group, apply the changes and then get back in. I keep getting the APIERR_BADPARS error from ACAPI_Element_Change function. The code goes like this:&lt;BR /&gt;&lt;BR /&gt;
&lt;PRE&gt;... //element processing

long g=0;
g=elem.header.groupId;

ACAPI_ELEMENT_MASK_CLEAR (mask);
ACAPI_ELEMENT_MASK_SET (mask, API_TextType, head);
elem.text.head.groupId=0;
err = ACAPI_Element_Change (&amp;amp;elem, &amp;amp;mask, NULL, 0, true);

... // text object content change based on ACAPI_Goodies - APIAny_ChangeContentID. This works fine on non-grouped text elements.

ACAPI_ELEMENT_MASK_CLEAR (mask);
ACAPI_ELEMENT_MASK_SET (mask, API_TextType, head);
elem.text.head.groupId=g;
err = ACAPI_Element_Change (&amp;amp;elem, &amp;amp;mask, NULL, 0, true);&lt;/PRE&gt;
The code above lies within an undo session. &lt;BR /&gt;&lt;BR /&gt;I cant' figure out the trick, so .. any help would be apreciated. &lt;IMG style="display: inline;" src="https://community.graphisoft.com/legacyfs/online/emojis/icon_biggrin.gif" border="0" /&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 07 Aug 2023 08:27:38 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-do-I-change-the-group-of-an-element/m-p/86433#M7437</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-08-07T08:27:38Z</dc:date>
    </item>
    <item>
      <title>Re: How do I change the group of an element?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-do-I-change-the-group-of-an-element/m-p/86434#M7438</link>
      <description>&lt;BLOCKQUOTE&gt;Marius wrote:&lt;BR /&gt;Since the content field can't be changed while the object is in a group, the element must first get out of the group, apply the changes and then get back in.&lt;/BLOCKQUOTE&gt;
Marius,&lt;BR /&gt;
&lt;BR /&gt;
I haven't studied the rest of your code yet, but would it solve your problem if you simply suspended groups (see APITool_SuspendGroups) while you do this?</description>
      <pubDate>Sun, 01 Jul 2007 13:37:40 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-do-I-change-the-group-of-an-element/m-p/86434#M7438</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2007-07-01T13:37:40Z</dc:date>
    </item>
  </channel>
</rss>

