2020-04-14 06:22 PM - last edited on 2021-09-15 11:53 AM by Noemi Balogh
void Shtuiot::Do_CreateSlabHole(API_Guid SlabG, API_Guid stairG) { API_Element stair, slab; BNZeroMemory(&stair, sizeof(API_Element)); BNZeroMemory(&slab, sizeof(API_Element)); slab.header.guid = SlabG; stair.header.guid = stairG; GSErrCode err = ACAPI_Element_Get(&slab); err = ACAPI_Element_Get(&stair); API_ElementMemo slabMemo; BNZeroMemory(&slabMemo, sizeof(API_ElementMemo)); err = ACAPI_Element_GetMemo(slab.header.guid, &slabMemo); API_Box3D box3D; BNZeroMemory(&box3D, sizeof(API_Box3D)); err = ACAPI_Database(APIDb_CalcBoundsID, &stair.header, &box3D); API_Coord A, B, C, D; A.x = box3D.xMin; A.y = box3D.yMin; B.x = box3D.xMax; B.y = box3D.yMin; C.x = box3D.xMax; C.y = box3D.yMax; D.x = box3D.xMin; D.y = box3D.yMax; API_Element poly; BNZeroMemory(&poly, sizeof(API_Element)); poly.header.typeID = API_MeshID; API_ElementMemo pmemo; BNZeroMemory(&pmemo, sizeof(API_ElementMemo)); err = ACAPI_Element_GetDefaults(&poly, &pmemo); if (err != NoError) { ErrorBeep("ACAPI_Element_GetDefaults (Polyline)", err); return; } poly.mesh.poly.nCoords = 5; poly.mesh.poly.nSubPolys = 1; poly.mesh.poly.nArcs = 0; pmemo.coords = (API_Coord**)BMAllocateHandle((poly.mesh.poly.nCoords + 1) * sizeof(API_Coord), ALLOCATE_CLEAR, 0); pmemo.pends = (Int32**)BMAllocateHandle((poly.mesh.poly.nSubPolys + 1) * sizeof(Int32), ALLOCATE_CLEAR, 0); (*pmemo.pends)[0] = 0; (*pmemo.pends)[1] = 5; (*pmemo.coords)[0].x = 0.0; (*pmemo.coords)[0].y = 0.0; (*pmemo.coords)[1] = A; (*pmemo.coords)[2] = B; (*pmemo.coords)[3] = C; (*pmemo.coords)[4] = D; (*pmemo.coords)[5] = A; err = ACAPI_Goodies(APIAny_InsertSubPolyID, &slabMemo, &pmemo); if (err == NoError) { API_ElementMemo tmpMemo; BNZeroMemory(&tmpMemo, sizeof(API_ElementMemo)); tmpMemo.coords = slabMemo.coords; tmpMemo.pends = slabMemo.pends; tmpMemo.parcs = slabMemo.parcs; tmpMemo.vertexIDs = slabMemo.vertexIDs; tmpMemo.meshPolyZ = slabMemo.meshPolyZ; tmpMemo.edgeIDs = slabMemo.edgeIDs; tmpMemo.edgeTrims = slabMemo.edgeTrims; tmpMemo.contourIDs = slabMemo.contourIDs; err = ACAPI_CallUndoableCommand("Delete Poly", [&]() -> GSErrCode { return ACAPI_Element_ChangeMemo(slab.header.guid, APIMemoMask_Polygon, &slabMemo); }); if (err != NoError) ErrorBeep("ACAPI_Element_ChangeMemo", err); } else ErrorBeep("APIAny_InsertSubPolyID", err); ACAPI_DisposeElemMemoHdls(&pmemo); ACAPI_DisposeElemMemoHdls(&slabMemo); }Would really appreciate some help!
2020-04-14 11:24 PM
2020-04-15 01:29 PM
2020-04-22 01:07 PM
2020-04-22 01:31 PM
2020-05-25 06:43 AM