2025-05-16 02:07 PM - edited 2025-05-19 10:50 AM
I have a generic wall with default parameters. When I open the All Components Schedule there is a list of all components of this wall. How can I get the area and the volume as displayed in the screenshot? Didn't find any sample code in the examples.
2025-05-16 04:37 PM
Hi Kolioi,
I think you can get these values via ACAPI_Element_GetQuantities.
The composites member of the API_Quantities object should have exactly those values you are looking for.
Hope that helps,
Bernd
2025-05-19
10:46 AM
- last edited on
2025-05-19
12:13 PM
by
Laszlo Nagy
Hi Bernd,
This works for elements but not for their components.
In the above example I have a composite wall with 2 skins
Here is my code
GS::Array<API_Guid> elemList;
GS::GSErrCode err = ACAPI_Element_GetElemList(API_WallID, &elemList, APIFilt_In3D);
for (USize i = 0; i < elemList.GetSize(); i++) {
API_Element element{};
element.header.guid = elemList.Get(i);
err = ACAPI_Element_Get(&element);
if (!err) {
GS::Array<API_ElemComponentID> elemComponents;
err = ACAPI_Element_GetComponents(element.header.guid, elemComponents);
for (const auto& comp : elemComponents) {
API_QuantityPar params;
API_Quantities quantities;
API_QuantitiesMask mask;
API_ElementQuantity quantity{};
quantities.elements = &quantity;
ACAPI_ELEMENT_QUANTITY_MASK_SETFULL(mask);
ACAPI_ELEMENT_COMPOSITES_QUANTITY_MASK_SETFULL(mask);
err = ACAPI_Element_GetQuantities(comp.componentID.componentGuid, ¶ms, &quantities, &mask);
ACAPI_ELEMENT_QUANTITIES_MASK_CLEAR(mask);
ACAPI_ELEMENT_COMPOSITES_QUANTITY_MASK_CLEAR(mask);
}
}
}
and ACAPI_Element_GetQuantities() returns APIERR_BADID (Incorrect elemGuid was specified / The passed identifier is not a valid one, or valid, but not proper for the given operation). If I pass the wall guid, the function returns correct values for the wall. However, I want to obtain the area and volume of the wall skins.
2025-05-19
10:53 AM
- last edited on
2025-05-19
12:14 PM
by
Laszlo Nagy
I was thinking about getting the quantities for the element wall and then checking quantities->composites.
Did you try this too?
2025-05-19
11:12 AM
- last edited on
2025-05-19
12:15 PM
by
Laszlo Nagy
It's NULL
2025-05-19 12:04 PM
Hm... you probably need to allocate the composites member first, like you did for the elements member.
API_Quantities quantities;
API_ElementQuantity quantity{};
quantities.elements = &quantity;
GS::Array<API_CompositeQuantity> compositeQuantities{};
quantities.composites = &compositeQuantities;
2025-05-19 12:38 PM
OK, I found it in the examples.
Element_Test, Element_Snippets.cpp, Do_CalcQuantities()