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

How to get zone's points in ArchiCAD API?

thanh
Booster

Hello everyone,

I'm trying to create Fills based on zone points.

Everything is okay with the code below when I get the zone points and create Fill according to those points:

 

list<Point>* points = GetPointsInElement(eleZone, eleZone.zone.poly);

//-----------------------------------------------------------------

list<Point>* GetPointsInElement(API_Element element, API_Polygon poly)
{
API_ElementMemo memo{};

GSErrCode err = ACAPI_Element_GetMemo(element.header.guid, &memo);

if (err != NoError) throw;

list<Point>* points = new list<Point>();

if (memo.coords) {

for (Int32 i = 1; i <= poly.nCoords; i++) {
API_Coord point = (*memo.coords)[i];
points->push_back(Point(point.x, point.y, 0));
}
}
ACAPI_DisposeElemMemoHdls(&memo);
delete points;
return (NULL);
}
//-------------------------
 
But when the zone's calculated area is different from zone's Measured Area (like the image below), then the shapes of Fill and Zone are no longer the same. 
 
The border of the Zone is a red line between the walls (like the image below), but when creating a Fill based on the points of the zone, the border of the Fill is a blue line and lies inside the walls.
 
Do you know where I'm wrong? And can you help me solve this problem?
Thank you very much.
 
received_884534646716334.png

 

received_1551925112013654.png

4 REPLIES 4
Akos Somorjai
Graphisoft
Graphisoft

Hi,

 

Please look at the `additionalPolyCoords` member of the element memo.

 

Best, Akos

Hi @Akos Somorjai ,

 I tried it, But the result isn't right. all coordinates equal zero.

Please help me.

 

received_1039981480657253.png

Linh
Contributor

@Akos Somorjai  I also got the same error. Can you help me ?

Hi,

 

Please take a look at the Do_DumpZone() function in Element_Snippets.cpp (Element_Test example). The ACAPI_Database(APIDb_RoomReductionsID, …) code shows that at the end of that function.

 

Best, Akos

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!