Archicad C++ API
About Archicad add-on development using the C++ API.

How do I move a zone?

Anonymous
Not applicable
Hi!

I could use a bit of help on something that should be simple (and probably is). I'm trying to move a zone to a new X,Y location. I have been able to successfully change the polygon of the zone, as well as modify walls, slabs, and pretty much everything else. But whenever I try to move a zone, the zone stamp refuses to move. I've even tried looking up the zone stamp object itself & moving it...but that gives an error indicating the operation was illegal.

From the documentation, it seems like something as simple as the following code snipet should work...but it doesn't. Amy I missing something obvious?

Any/all suggestions are appreciated.

Thanks.

-larry


		element.header.typeID = API_ZoneID;
		element.header.unId = entityid;

		err = ACAPI_Element_Get (&element);
		if (err != NoError)
			return entityid;

		ACAPI_ELEMENT_MASK_CLEAR (mask);
		ACAPI_ELEMENT_MASK_SET (mask, API_ZoneType, pos);
		ACAPI_ELEMENT_MASK_SET (mask, API_ZoneType, refPos);
		element.zone.pos.x = centerpoint_x;
		element.zone.pos.y = centerpoint_y;
		element.zone.refPos.x = centerpoint_x;
		element.zone.refPos.y = centerpoint_y;

		err = ACAPI_Element_Change (&element, &mask, NULL, 0, true);	
	
3 REPLIES 3
Andras Babos
Graphisoft Alumni
Graphisoft Alumni
Hi!

Unfortunately repositioning the zone stamp using the zone's pos parameter does not work. Individual object replacement should work however, as far as I can tell. How did you try to go about it?

Andras.
Anonymous
Not applicable
hi,
i have a similar problem. Im trying simply to change a colour of a dimension pen. compiler suceeded, but nothing happens. I thing there is a problem in defining the mask. Here is my code:
API_Element			element, mask;
						
						BNZeroMemory (&element, sizeof (API_Element));
						
						element.header.guid = guid;
						err = ACAPI_Element_Get (&element);
						if (err != NoError){
							ErrorBeep ("ACAPI_Element_Get", err);
							return;
						}
			
						if (err == NoError) {
							ACAPI_ELEMENT_MASK_CLEAR (mask);
							ACAPI_ELEMENT_MASK_SET (mask, API_DimensionType, defNote.notePen);
							
							element.dimension.defNote.notePen=3;
							
							err = ACAPI_Element_Change (&element, &mask, NULL, 0, true);
Thanks
Ralph Wessel
Mentor
santi wrote:
Im trying simply to change a colour of a dimension pen.
element.dimension.defNote.notePen=3;
defNote contains the default text settings for the dimension, i.e. it will only apply to newly added dimension text and not existing text. The pen settings for placed dimensions are in the memo linked to the dimension element.
Ralph Wessel BArch
Software Engineer Speckle Systems