We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2024-03-11 02:04 PM - last edited on 2024-09-17 11:06 AM by Doreena Deng
How can I get the materials of a profile?
I use complex profiles with columns and beams and want to get their materials but have no idea how to do that. Any suggestions or hints? Thanks in advance.
2024-03-11 03:16 PM
//1. You need to get a list of beam segments
ACAPI_Element_GetMemo(element.header.guid, &memo, APIMemoMask_BeamSegment)
//2. Get the profile index for the segment, if the segment is made by a profile
if (structtype == API_ProfileStructure) constrinx = memo.beamSegments[0].assemblySegmentData.profileAttr
//3. Get the profile itself
UInt64 mask = APIMemoMask_StretchedProfile;
GSErrCode err = ACAPI_Element_GetMemo(elemhead.guid, &memo, mask);
ProfileVectorImage profileDescription = *memo.stretchedProfile;
//4. Go through the hatches in ProfileVectorImage and get the index of the materials
ConstProfileVectorImageIterator profileDescriptionIt(profileDescription);
while (!profileDescriptionIt.IsEOI()) {
switch (profileDescriptionIt->item_Typ) {
case SyHatch:
{
const HatchObject& syHatch = profileDescriptionIt;
Geometry::MultiPolygon2D result;
if (syHatch.ToPolygon2D(result, HatchObject::VertexAndEdgeData::Omit) == NoError) {
for (UInt32 i = 0; i < result.GetSize(); i++) {
API_AttributeIndex constrinxL = ACAPI_CreateAttributeIndex((GS::Int32)syHatch.GetBuildMatIdx().ToGSAttributeIndex());
}
}
}
break;
}
++profileDescriptionIt1;
}
Structural engineer, developer of free addon for sync GDL param and properties
2024-03-12 10:15 AM
Thanks a lot, that helped me.
I made it myself up to the 4th point but didn't know I have to use VectorImage. And actually I used ACAPI_Attribute_GetDefExt() not the memo. Attribute_Test example has the correct code. Thanks again!