We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2019-05-20 03:22 PM - last edited on 2022-10-04 04:32 PM by Daniel Kassai
Solved! Go to Solution.
2019-05-21 08:38 AM
void Do_DetectCollisionsBasedOnSelection (void) { API_SelectionInfo selectionInfo; API_Neig** selNeig; GSErrCode err; // Get selection err = ACAPI_Selection_Get (&selectionInfo, &selNeig, true); BMKillHandle ((GSHandle *) &selectionInfo.marquee.coords); if (err != NoError && err != APIERR_NOSEL) { BMKillHandle ((GSHandle *) &selNeig); ErrorBeep ("ACAPI_Selection_GetInfo", err); return; } if (err == APIERR_NOSEL || selectionInfo.typeID == API_SelEmpty) { WriteReport_Alert ("No selected elements"); return; } GS::Array<API_Guid> guidList1, guidList2; GS::Array<GS::Pair<API_CollisionElem, API_CollisionElem>> collisions; for (Int32 i = 0; i < selectionInfo.sel_nElemEdit; i++) { guidList1.Push ((*selNeig).guid); guidList2.Push ((*selNeig).guid); } BMKillHandle ((GSHandle *) &selNeig); // Detect collisions API_CollisionDetectionSettings colDetSettings; colDetSettings.volumeTolerance = 0.0001; colDetSettings.performSurfaceCheck = true; colDetSettings.surfaceTolerance = 0.0001; err = ACAPI_Element_GetCollisions (guidList1, guidList2, collisions, colDetSettings); Do_DumpCollisions (collisions); }Regards,
2019-05-20 03:45 PM
2019-05-21 08:38 AM
void Do_DetectCollisionsBasedOnSelection (void) { API_SelectionInfo selectionInfo; API_Neig** selNeig; GSErrCode err; // Get selection err = ACAPI_Selection_Get (&selectionInfo, &selNeig, true); BMKillHandle ((GSHandle *) &selectionInfo.marquee.coords); if (err != NoError && err != APIERR_NOSEL) { BMKillHandle ((GSHandle *) &selNeig); ErrorBeep ("ACAPI_Selection_GetInfo", err); return; } if (err == APIERR_NOSEL || selectionInfo.typeID == API_SelEmpty) { WriteReport_Alert ("No selected elements"); return; } GS::Array<API_Guid> guidList1, guidList2; GS::Array<GS::Pair<API_CollisionElem, API_CollisionElem>> collisions; for (Int32 i = 0; i < selectionInfo.sel_nElemEdit; i++) { guidList1.Push ((*selNeig).guid); guidList2.Push ((*selNeig).guid); } BMKillHandle ((GSHandle *) &selNeig); // Detect collisions API_CollisionDetectionSettings colDetSettings; colDetSettings.volumeTolerance = 0.0001; colDetSettings.performSurfaceCheck = true; colDetSettings.surfaceTolerance = 0.0001; err = ACAPI_Element_GetCollisions (guidList1, guidList2, collisions, colDetSettings); Do_DumpCollisions (collisions); }Regards,
2019-05-22 10:32 AM
2019-05-23 01:29 PM
2019-05-24 09:53 AM
n.mihaylov wrote:How many elements do you input to ACAPI_Element_GetCollisions function? All elements from your project?
ACAPI_Element_GetCollisions needs 1 to 3 minutes to return - 3 elements with 3 collisions.
2019-05-27 08:18 AM