We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

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

Curtain wall coordinates

Anonymous
Not applicable
Hello Archicad forum,

What would be the easiest way to get the corner position coordinates of a curtain wall. For a normal wall I use begC and endC and the width to determine the 4 corner coordinates of a vertical wall. However, I could not determine those coordinates for curtain wall. Neither segmentData, cornerFrameData nor boundaryFrameData of API_​CurtainWallType let me retrieve any information (x and y is always 0.0). I have the suspicion it is more complicated since a curtain wall comprises multiple elements.

Thanks,
- Dan
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
Hi Dan,
dan wrote:
Neither segmentData, cornerFrameData nor boundaryFrameData of API_​CurtainWallType let me retrieve any information (x and y is always 0.0).
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.

Curtain Wall is a composite element so it contains multiple subelements (segments, frames, panels, accessories and junctions). You can retrieve the subelements of a curtain wall by calling the ACAPI_Element_GetMemo function.

For example the curtain wall on the picture below has 3 segments (I marked them with red lines) and the beginning and end points of the segments are marked with red crosses.
Use this code to get the begC and endC of the segments:
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;
}

View solution in original post

4 REPLIES 4
Solution
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
Hi Dan,
dan wrote:
Neither segmentData, cornerFrameData nor boundaryFrameData of API_​CurtainWallType let me retrieve any information (x and y is always 0.0).
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.

Curtain Wall is a composite element so it contains multiple subelements (segments, frames, panels, accessories and junctions). You can retrieve the subelements of a curtain wall by calling the ACAPI_Element_GetMemo function.

For example the curtain wall on the picture below has 3 segments (I marked them with red lines) and the beginning and end points of the segments are marked with red crosses.
Use this code to get the begC and endC of the segments:
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;
}
Anonymous
Not applicable
Thanks! This works perfectly for my facade.
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
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.
Anonymous
Not applicable
Tibor wrote:
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.
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