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

Zone Areas

poco2013
Mentor
Is there any way to obtain the measured and calculated areas of Zones using the API. I can obtain the zone structure of 'API_Zone_Type' for each zone but it does not appear to contain a area parameter.

Need to compare zone areas to obtain FAR's and other factors and would prefer to do it within a "Add-on'. if someone could point me in the right direction?
Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
You can retrieve the calculated quantities of an element using ACAPI_Element_GetQuantities function.
This function returns the area of the given zone:
double GetAreaOfZone (const API_Guid& zoneGuid)
{
	API_ElementQuantity	quantity = {};
	API_Quantities		quantities = {};
	API_QuantitiesMask	mask;

	ACAPI_ELEMENT_QUANTITY_MASK_CLEAR (mask);
	ACAPI_ELEMENT_QUANTITY_MASK_SET (mask, zone, area);

	quantities.elements = &quantity;
	ACAPI_Element_GetQuantities (zoneGuid, nullptr, &quantities, &mask);

	return quantity.zone.area;
}

View solution in original post

2 REPLIES 2
Solution
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
You can retrieve the calculated quantities of an element using ACAPI_Element_GetQuantities function.
This function returns the area of the given zone:
double GetAreaOfZone (const API_Guid& zoneGuid)
{
	API_ElementQuantity	quantity = {};
	API_Quantities		quantities = {};
	API_QuantitiesMask	mask;

	ACAPI_ELEMENT_QUANTITY_MASK_CLEAR (mask);
	ACAPI_ELEMENT_QUANTITY_MASK_SET (mask, zone, area);

	quantities.elements = &quantity;
	ACAPI_Element_GetQuantities (zoneGuid, nullptr, &quantities, &mask);

	return quantity.zone.area;
}
poco2013
Mentor
Worked perfectly - Completely missed this.

Thanks
Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27