2018-12-20 08:58 AM - last edited on 2022-10-04 04:47 PM by Daniel Kassai
Solved! Go to Solution.
2018-12-20 09:51 AM
static GS::Array<API_Guid> GetSelectedElements (bool assertIfNoSel /* = true*/, bool onlyEditable /*= true*/) { GSErrCode err; API_SelectionInfo selectionInfo; API_Neig **selNeigs; err = ACAPI_Selection_Get (&selectionInfo, &selNeigs, onlyEditable); BMKillHandle ((GSHandle *)&selectionInfo.marquee.coords); if (err == APIERR_NOSEL || selectionInfo.typeID == API_SelEmpty) { if (assertIfNoSel) { DGAlert (DG_ERROR, "Error", "Please select an element!", "", "Ok"); } } if (err != NoError) { BMKillHandle ((GSHandle *)&selNeigs); return GS::Array<API_Guid>(); } UInt32 nSel = BMGetHandleSize ((GSHandle)selNeigs) / sizeof (API_Neig); GS::Array<API_Guid> guidArray; for (UInt32 i = 0; i < nSel; ++i) { guidArray.Push ((*selNeigs).guid); } BMKillHandle ((GSHandle *)&selNeigs); return guidArray; }
2018-12-20 09:51 AM
static GS::Array<API_Guid> GetSelectedElements (bool assertIfNoSel /* = true*/, bool onlyEditable /*= true*/) { GSErrCode err; API_SelectionInfo selectionInfo; API_Neig **selNeigs; err = ACAPI_Selection_Get (&selectionInfo, &selNeigs, onlyEditable); BMKillHandle ((GSHandle *)&selectionInfo.marquee.coords); if (err == APIERR_NOSEL || selectionInfo.typeID == API_SelEmpty) { if (assertIfNoSel) { DGAlert (DG_ERROR, "Error", "Please select an element!", "", "Ok"); } } if (err != NoError) { BMKillHandle ((GSHandle *)&selNeigs); return GS::Array<API_Guid>(); } UInt32 nSel = BMGetHandleSize ((GSHandle)selNeigs) / sizeof (API_Neig); GS::Array<API_Guid> guidArray; for (UInt32 i = 0; i < nSel; ++i) { guidArray.Push ((*selNeigs).guid); } BMKillHandle ((GSHandle *)&selNeigs); return guidArray; }