We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

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

Creating/Adding polygon (holes) in a zone [SOLVED]

ReignBough
Enthusiast
Figure 1

I have the following zones, walls and a polygon (using polyline). The polygon is used as the boundary for the main zone.

Figure 2 (manual)
  •  
  • I created the main zone polygon (MZP) by following the vertices of the polyline as the guide.
  •  
  • Then, I started adding subpolygon (holes) in to it that are the same sizes as the other zones. That is, 1 zone is to 1 subpolygon.
Figure 3 (API)
  •  
  • Using the API, I created the MZP using the polyline's elem.polyLine.poly and its corresponding polygon values on memo (coords, pends, parcs, vertexIDs).
  •  
  • Then, I go through all the existing zone elements and add/insert (APIAny_InsertSubPolyID) their polygon (elem[idx].zone.poly and the corresponding memo values) to MZP.
Question

How can I generate the same output as the manual? What I mean is, I still want to have those (2) small zones using the API.
~ReignBough~
ARCHICAD 26 INT (from AC18)
Windows 11 Pro, AMD Ryzen 7, 3.20GHz, 32.0GB RAM, 64-bit OS
1 REPLY 1
ReignBough
Enthusiast
I found a clipper that will do the operations I needed, which includes difference, intersection, XOR and union.

But of course, you still need to create the zone and holes using ACAPI_Element_Create() and ACAPI_Goodies(APIAny_InsertSubPolyID) based on the polygons created by the clipper.
~ReignBough~
ARCHICAD 26 INT (from AC18)
Windows 11 Pro, AMD Ryzen 7, 3.20GHz, 32.0GB RAM, 64-bit OS