We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2018-11-19 02:42 PM - last edited on 2022-10-05 01:31 PM by Daniel Kassai
Solved! Go to Solution.
2018-11-19 04:12 PM
dan wrote:The segmentData, cornerFrameData and boundaryFrameData members of API_CurtainWallType contain the default settings of the segments, corner frames and boundary frames. That's why those members do not contain any geometry informations.
Neither segmentData, cornerFrameData nor boundaryFrameData of API_CurtainWallType let me retrieve any information (x and y is always 0.0).
GS::Array<GS::Pair<API_Coord3D, API_Coord3D>> GetCurtainWallSegmentsCoords (const API_Guid& cwGuid) { GS::Array<GS::Pair<API_Coord3D, API_Coord3D>> result; API_Element element; BNZeroMemory (&element, sizeof (API_Element)); element.header.guid = cwGuid; GSErrCode err = ACAPI_Element_Get (&element); if (err == NoError) { API_ElementMemo memo; BNZeroMemory (&memo, sizeof (API_ElementMemo)); err = ACAPI_Element_GetMemo (element.header.guid, &memo, APIMemoMask_CWallSegments); if (err == NoError && memo.cWallSegments != nullptr) { for (UIndex ii = 0; ii < element.curtainWall.nSegments; ++ii) { const API_CWSegmentType& segment = memo.cWallSegments[ii]; GS::Pair<API_Coord3D, API_Coord3D> coordPair (segment.begC, segment.endC); result.Push (coordPair); } } ACAPI_DisposeElemMemoHdls (&memo); } return result; }
2018-11-19 04:12 PM
dan wrote:The segmentData, cornerFrameData and boundaryFrameData members of API_CurtainWallType contain the default settings of the segments, corner frames and boundary frames. That's why those members do not contain any geometry informations.
Neither segmentData, cornerFrameData nor boundaryFrameData of API_CurtainWallType let me retrieve any information (x and y is always 0.0).
GS::Array<GS::Pair<API_Coord3D, API_Coord3D>> GetCurtainWallSegmentsCoords (const API_Guid& cwGuid) { GS::Array<GS::Pair<API_Coord3D, API_Coord3D>> result; API_Element element; BNZeroMemory (&element, sizeof (API_Element)); element.header.guid = cwGuid; GSErrCode err = ACAPI_Element_Get (&element); if (err == NoError) { API_ElementMemo memo; BNZeroMemory (&memo, sizeof (API_ElementMemo)); err = ACAPI_Element_GetMemo (element.header.guid, &memo, APIMemoMask_CWallSegments); if (err == NoError && memo.cWallSegments != nullptr) { for (UIndex ii = 0; ii < element.curtainWall.nSegments; ++ii) { const API_CWSegmentType& segment = memo.cWallSegments[ii]; GS::Pair<API_Coord3D, API_Coord3D> coordPair (segment.begC, segment.endC); result.Push (coordPair); } } ACAPI_DisposeElemMemoHdls (&memo); } return result; }
2018-11-21 10:49 AM
2018-12-13 11:55 AM
ACAPI_DisposeElemMemoHdls (&memo);Without that line it causes memory leaks. I updated the code today.
2018-12-13 12:04 PM
Tibor wrote:Thanks Tibor, I have already added this memo dispose line after implementing some other memo code based on the examples, so I did not actively realize it was missing from your example
Please forgive me, I forget to dispose the memo handle in my code above.ACAPI_DisposeElemMemoHdls (&memo);Without that line it causes memory leaks. I updated the code today.