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

Element Quantities is zero

ReignBough
Enthusiast
Tried the following on AC22:

API_ElementQuantity eq;
GS::Array<API_CompositeQuantity> qcq;
API_Quantities q;
API_QuantityPar qp;
API_QuantitiesMask qm;
ACAPI_ELEMENT_QUANTITY_MASK_CLEAR(qm);
ACAPI_ELEMENT_QUANTITY_MASK_SETFULL(qm);
qp.minOpeningSize = 0.00;
q.elements = &eq;
q.composites = &qcq;
err = ACAPI_Element_GetQuantities(elem.header.guid, &qp, &q, &qm);
int cqCnt = qcq.GetSize();

It is inside a loop, where each element is being check, in this case, if it is wall or column. Then, will try to get the quantities of building material and/or surface of the element (depends on the input of the user).

There are no error (err = NoError) but the cqCnt is always zero on any model structure type (basic, composite, or profile)

EDIT: Also for AC21. AC20 is okay.
~ReignBough~
ARCHICAD 26 INT (from AC18)
Windows 11 Pro, AMD Ryzen 7, 3.20GHz, 32.0GB RAM, 64-bit OS
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
leilei
Enthusiast
Hi ,Maybe you are not using ACAPI_ELEMENT_COMPOSITES_QUANTITY_MASK_SETFULL(mask);
I am working normally in AC22.
	
        GSErrCode			err = NoError;
	API_ElementQuantity	quantity;
	API_QuantitiesMask	mask;
	API_Quantities		quantities;
	API_QuantityPar		par;
	GS::Array<API_CompositeQuantity>         composites;
	quantities.composites = &composites;
	quantities.elements = &quantity;
	par.minOpeningSize = 0.3;
	ACAPI_ELEMENT_QUANTITY_MASK_SET(mask, column, coreVolume);
	ACAPI_ELEMENT_COMPOSITES_QUANTITY_MASK_SETFULL(mask);
	err = ACAPI_Element_GetQuantities(guid, &par, &quantities, &mask);
	ACAPI_ELEMENT_COMPOSITES_QUANTITY_MASK_CLEAR(mask);
	ACAPI_ELEMENT_QUANTITY_MASK_CLEAR(mask);

View solution in original post

1 REPLY 1
Solution
leilei
Enthusiast
Hi ,Maybe you are not using ACAPI_ELEMENT_COMPOSITES_QUANTITY_MASK_SETFULL(mask);
I am working normally in AC22.
	
        GSErrCode			err = NoError;
	API_ElementQuantity	quantity;
	API_QuantitiesMask	mask;
	API_Quantities		quantities;
	API_QuantityPar		par;
	GS::Array<API_CompositeQuantity>         composites;
	quantities.composites = &composites;
	quantities.elements = &quantity;
	par.minOpeningSize = 0.3;
	ACAPI_ELEMENT_QUANTITY_MASK_SET(mask, column, coreVolume);
	ACAPI_ELEMENT_COMPOSITES_QUANTITY_MASK_SETFULL(mask);
	err = ACAPI_Element_GetQuantities(guid, &par, &quantities, &mask);
	ACAPI_ELEMENT_COMPOSITES_QUANTITY_MASK_CLEAR(mask);
	ACAPI_ELEMENT_QUANTITY_MASK_CLEAR(mask);