The Global ARCHICAD Community

Stay informed. Get help. Share your knowledge.

Discussions about using GRAPHISOFT's tools (API DevKit) for independent software developers

Moderators: Barry Kelly, Karl Ottenstein, LaszloNagy, ejrolon, gkmethy, Tibor Lorántfy, MOREH Tamas, Akos Somorjai, Ed Brown, Mihály Palenik

User avatar
By poco2013
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?
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):
Code: Select all
#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.