License Delivery maintenance is expected to occur on Saturday, November 30, between 8 AM and 11 AM CET. This may cause a short 3-hours outage in which license-related tasks: license key upload, download, update, SSA validation, access to the license pool and Graphisoft ID authentication may not function properly. We apologize for any inconvenience.
Archicad C++ API
About Archicad add-on development using the C++ API.

[MISSING FEATURE] Adding Arcs to an existing curtain wall

Anonymous
Not applicable
Hello. I'm trying to add arcs to an already created curtain wall. However the function doesn't add the arcs. The ACAPI_Element_Change(...) returns NoError. Any ideas of what I might be doing wrong?

Also I would like to know if the curtain wall has a field similar to the wall's bottomOffset.

Here is the code of the function:
API_Element			element, mask, aux;
	API_ElementMemo		memo;
	GSErrCode			err;
	elementid			eleGuid;
	polyarcsmessage		polyarcsMsg;
	char buffer[256];

	readDelimitedFrom(raw_in, &eleGuid);

	readDelimitedFrom(raw_in, &polyarcsMsg);

	BNZeroMemory(&element, sizeof(API_Element));

	element.header.guid = APIGuidFromString(eleGuid.guid().c_str());

	if (ACAPI_Element_Get(&element) == NoError
		&& ACAPI_Element_GetMemo(element.header.guid, &memo, APIMemoMask_Polygon) == NoError) {


		memo.parcs = reinterpret_cast<API_PolyArc**> (BMAllocateHandle((polyarcsMsg.arcangle_size() + 1) * sizeof(API_PolyArc), ALLOCATE_CLEAR, 0));
		
		if (memo.parcs != NULL){

			for (int i = 0; i < polyarcsMsg.arcangle_size(); i++){
				(*memo.parcs).begIndex = polyarcsMsg.begindex(i);
				(*memo.parcs).endIndex = polyarcsMsg.endindex(i);
				(*memo.parcs).arcAngle = polyarcsMsg.arcangle(i);
				
			}

			ACAPI_ELEMENT_MASK_CLEAR(mask);
			
			err = ACAPI_Element_Change(&element, &mask, &memo, APIMemoMask_Polygon, true);

			if (err != NoError){
				ErrorBeep("Cannot add arcs", err);
				sprintf(buffer, "Error: %d", err);
				ACAPI_WriteReport(buffer, true);
			}
		}
		else {
			ErrorBeep("Cannot add arcs", APIERR_MEMFULL);
		}

	}

	sendElementID(element);

	ACAPI_DisposeElemMemoHdls(&memo);
3 REPLIES 3
Ralph Wessel
Mentor
Xylios wrote:
Hello. I'm trying to add arcs to an already created curtain wall. However the function doesn't add the arcs. The ACAPI_Element_Change(...) returns NoError. Any ideas of what I might be doing wrong?
Potentially several issues. For one, are you considering that the curtain wall might already have arcs when you to this? It appears that you replacing any handle it already has without disposing of it. Also, how do you know the vertices references in the arc start/end actually exist in the curtainwall polyline? And finally, it doesn't look like you set the number of arcs in the curtainwall polygon member (see API_Polygon::nArcs).
Ralph Wessel BArch
Software Engineer Speckle Systems
Anonymous
Not applicable
Hello, thank you for taking the time to help me with my issue.

To answer your questions:

At the moment I'm testing with a curtain wall that has 3 points and no arcs at the start (x, y)
p1 = (0, 0), p2 = (0, 10), p3 = (0, 0)

The arcs I'm adding have the following (begIndex, endIndex, angle)
(1, 2, PI/2), (2, 3, PI/2)

I assume the begIndex and endIndex are correct for this example.

To set the number of arcs what I must do is this, right?
element.curtainWall.polygon.nArcs = polyarcsMsg.arcangle_size(); // In this case is 2
ACAPI_ELEMENT_MASK_CLEAR(mask);
ACAPI_ELEMENT_MASK_SET(mask, API_CurtainWallType, polygon);
To use the handles correctly the code would be this, right?
BMKillHandle((GSHandle *)&memo.parcs);
memo.parcs = (API_PolyArc**)BMhAllClear((polyarcsMsg.arcangle_size()) * sizeof(API_PolyArc));
And yet there are no changes on my curtain wall (there are no arcs).

Perhaps I'm using the wrong MemoMask... I use APIMemoMask_Polygon. Or I might need to give more information to the memo or element.

Also I would like to ask you if I can change the bottom offset of the curtain wall, like I do with a wall.
I tried using the following curtain wall fields, offset, planeOffset and the curtain wall still starts at the default Z.

Once again thank you for your help!

I decided to not write the full code again to avoid getting a super large post, if you would like to see the full code just ask.
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
Hi,

Unfortunately currently it's not possible to add arcs to an existing curtain wall using API.
In ACAPI_Element_Change the input memo.parcs is ignored in case of curtain wall.
I will add this as a feature request and hope we will implement this in an upcoming version.

It could be a workaround, if you delete the actual curtain wall and create a new copy with arcs.
Using ACAPI_Element_Create you are able to set memo.arcs for curtain wall.

Regards,
Tibor