2020-07-14
08:58 AM
- last edited on
2021-09-15
11:57 AM
by
Noemi Balogh
2020-07-14 12:04 PM
juliencuadra wrote:Anything starting with ^ in a menu item is specifying a context in which that menu is relevant. For example, "^E3" means "enabled in 3D window". You can find documentation on this here:
What is this part : 1. ^ES^EE^EI^E3^ED^EW^EL ?
juliencuadra wrote:The best approach generally is for the user to select some elements first and then select a menu to perform some action on the selection. That's how most tools already work in Archicad.
What is this part : 1. 2. How do you interact with elements already placed in your project?
- What function in the API let the user select some elements on the floor plan, or what is the general process to ask the user to select some elements
- If I want to do that automatically, how does the Add-On can search through the project to find zones in it ?
auto selectedZones = plan.getSelection({Drawing::Filter::isEditable, Zone::ID});
GS' sample code for collecting elements is much more verbose: GS::Array<API_Guid>& inds
GSErrCode err;
API_SelectionInfo selectionInfo;
API_Elem_Head tElemHead;
GS::Array<API_Neig> selNeigs;
err = ACAPI_Selection_Get (&selectionInfo, &selNeigs, true);
BMKillHandle ((GSHandle *) &selectionInfo.marquee.coords);
if (err == APIERR_NOSEL)
err = NoError;
if (selectionInfo.typeID != API_SelEmpty) {
// collect indexes of selected dimensions
UInt32 nSel = BMGetHandleSize ((GSHandle) selNeigs) / sizeof (API_Neig);
for (const API_Neig& selNeig : selNeigs) {
tElemHead.typeID = Neig_To_ElemID (selNeig.neigID);
if (tElemHead.typeID != API_DimensionID)
continue;
if (!ACAPI_Element_Filter (selNeig.guid, APIFilt_IsEditable))
continue;
tElemHead.guid = selNeig.guid;
if (ACAPI_Element_GetHeader (&tElemHead) != NoError)
continue;
// Add dimension to the array
inds.Push (tElemHead.guid);
}
}
2020-07-14 12:44 PM