How do I change the group of an element?
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2007-06-29
02:29 PM
- last edited on
2023-08-07
10:27 AM
by
Doreena Deng
2007-06-29
02:29 PM
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:
I cant' figure out the trick, so .. any help would be apreciated.
... //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 (&elem, &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 (&elem, &mask, NULL, 0, true);The code above lies within an undo session.
I cant' figure out the trick, so .. any help would be apreciated.

Labels:
- Labels:
-
Add-On (C++)
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2007-07-01 03:37 PM
2007-07-01
03:37 PM
Marius wrote:Marius,
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 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?
Ralph Wessel BArch
Central Innovation
Central Innovation