We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2015-04-23 03:33 PM - last edited on 2023-07-13 04:29 PM by Doreena Deng
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);
2015-04-24 12:59 PM
Xylios wrote: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).
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?
2015-04-24 02:38 PM
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).
2015-04-27 11:10 AM