License Delivery maintenance is expected to occur on Saturday, November 30, between 8 AM and 11 AM CET. This may cause a short 3-hours outage in which license-related tasks: license key upload, download, update, SSA validation, access to the license pool and Graphisoft ID authentication may not function properly. We apologize for any inconvenience.
Archicad C++ API
About Archicad add-on development using the C++ API.
SOLVED!

Zone Quantities Documentation

poco2013
Mentor
Got Area quantities for zones by following the examples - Thanks Tibor.

But now looking for the documentation on setting the masks for the new functions. Can not find:

ACAPI_ELEMENT_QUANTITY_MASK_SET in the developer site docs under the ACAPI functions.
Is this a omission? if so is there another site that documents this?
Gerry

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

Accepted Solutions
Solution
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
ACAPI_ELEMENT_QUANTITY_MASK_SET is just a macro, defined in APIdefs_Elements.h header file. You're right there isn't any documentation for those macros.
Masks are for optimization, to set which member you want to retrieve, so ARCHICAD doesn't have to calculate each quantity.
The API uses ACAPI_ELEMENT_MASK_CHECK macro to check the given quantity must be calculated or not. If we look into that macro we can see that it checks whether the given member (named 'varnam') is zero or not (it's no matter what type the member has, because we cast it):
#define	ACAPI_ELEMENT_MASK_CHECK(rec,typ,varnam)	(*((char *) &((typ *) &rec)->varnam) != 0)
So now it's obvious that a member should be set to anything but zero to force ARCHICAD to calculate it. That's why ACAPI_ELEMENT_MASK_SET macro sets '-1' value.

Thank you for the feedback, I totally agree with you that it would be useful to have help how to use those mask handling macros! We will do our best and update the documentation with more details about this topic.

View solution in original post

2 REPLIES 2
Solution
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
ACAPI_ELEMENT_QUANTITY_MASK_SET is just a macro, defined in APIdefs_Elements.h header file. You're right there isn't any documentation for those macros.
Masks are for optimization, to set which member you want to retrieve, so ARCHICAD doesn't have to calculate each quantity.
The API uses ACAPI_ELEMENT_MASK_CHECK macro to check the given quantity must be calculated or not. If we look into that macro we can see that it checks whether the given member (named 'varnam') is zero or not (it's no matter what type the member has, because we cast it):
#define	ACAPI_ELEMENT_MASK_CHECK(rec,typ,varnam)	(*((char *) &((typ *) &rec)->varnam) != 0)
So now it's obvious that a member should be set to anything but zero to force ARCHICAD to calculate it. That's why ACAPI_ELEMENT_MASK_SET macro sets '-1' value.

Thank you for the feedback, I totally agree with you that it would be useful to have help how to use those mask handling macros! We will do our best and update the documentation with more details about this topic.
poco2013
Mentor
Thanks Again Tibor
Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27