2017-05-30
04:19 PM
- last edited on
2023-07-12
08:48 PM
by
Doreena Deng
ACAPI_Selection_Getthe problem is that it only retrieves walls that are owners of those winows/doors. It is possible to get such selection from archicad when you have Window/Door tool selected and then click Ctrl+A. I have tried to change ToolBoxItem using ACAPI_Environment before getting selection but it gives the same result retrieving only walls.
2017-05-31 09:51 AM
2017-05-31 10:45 AM
API_SelectionInfo selectionInfo;
API_Region region;
API_ElemTypeID typeID;
API_Guid elemGuid;
API_Coord3D c3;
GSErrCode err = NoError;
if (!ClickAnElem("Click a window / door.", API_WindowID, NULL, &typeID, &elemGuid, &c3)) {
return;
}
API_ToolBoxItem tbi;
BNZeroMemory(&tbi, sizeof(tbi));
tbi.typeID = API_WindowID;
err = ACAPI_Environment(APIEnv_SetToolBoxModeID, &tbi, NULL);
if (err) {
WriteReport_Err("Set Toolbox err", err);
}
selectionInfo.typeID = API_MarqueeRotBox;
selectionInfo.multiStory = false;
API_Box marqueeBox;
marqueeBox.xMin = c3.x - 0.5;
marqueeBox.xMax = c3.x + 0.5;
marqueeBox.yMin = c3.y - 0.5;
marqueeBox.yMax = c3.y + 0.5;
region.box = marqueeBox;
region.boxRotAngle = 0.0;
selectionInfo.marquee = region;
err = ACAPI_Selection_SetMarquee(&selectionInfo);
if (err) {
WriteReport_Err("MarqueErr", err);
}
API_SelectionInfo selectionInfo;
API_Neig **selNeigs;
status = ACAPI_Selection_Get(&selectionInfo, &selNeigs, false, false);
selected = selectionInfo.sel_nElem;
if (status == APIERR_NOSEL || selectionInfo.typeID == API_SelEmpty) {
if (warnIfEmpty)
WriteReport_Alert("Please select an element.");
}
if(status == NoError ) {
UInt32 nSel = BMGetHandleSize((GSHandle)selNeigs) / sizeof(API_Neig);
for (UInt32 i = 0; i < nSel; ++i)
guidArray.Push((*selNeigs).guid);
}
BMKillHandle((GSHandle *)&selectionInfo.marquee.coords);
BMKillHandle((GSHandle *)&selNeigs);
2017-05-31 02:58 PM
2017-05-31 06:22 PM
2017-06-01 09:53 AM