cancel
Showing results for 
Search instead for 
Did you mean: 
EN
cancel
Showing results for 
Search instead for 
Did you mean: 
poco2013
Mentor

Zone Quantities Documentation

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 Solution

Accepted Solutions
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.

Go to post

2 Replies 2
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

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!