Adds/removes a number of elements to/from the current selection.
GSErrCode ACAPI_Element_Select ( const GS::Array<API_Neig>& selNeigs, bool add );
Parameters
- selNeigs
- [in] The elements to be added/removed (array of API_Neig objects);
- add
- [in] If true, adds the elements to the current selection, otherwise removes them from the selection.
Return Values
NoError
- The function has completed with success.
APIERR_BADDATABASE
- The current database is not proper for the operation.
APIERR_BADID
- The element unique ID is invalid. The element type is invalid, or
the element type is not supported by the server application. APIERR_BADPARS
- The passed parameter contains invalid data;
selNeigs
.
For other common API errors see the API Errors document.
Remarks
You can use this function to add/remove (add
flag) a number of (nItem
) elements to/from the current selection. The elements are defined by the selNeigs
array of type API_Neig. Use ACAPI_Element_DeselectAll function to remove all elements from the selection.
The neigID
and the guid
fields are required (inIndex and/or holeSel
only where applicable).
The API_NeigID
is differs from the API_ElemTypeID
, because it refers to the selectable parts of the elements, not the elements themselves.
You can select not only whole elements but element parts, such as vertices, edges and faces,
specified in the
elemPartType
and elemPartIndex
fields of API_Neig.
Example
static GSErrCode Do_SelectAllWalls (void) { ACAPI_Element_DeselectAll (); GS::Array<API_Guid> wallGuids; ACAPI_Element_GetElemList (API_WallID, &wallGuids); GS::Array<API_Neig> selNeigs; for (const API_Guid& guid : wallGuids) { API_Neig neig (guid); selNeigs.Push (neig); // Note: the following 1 commented line is equivalent to the previous 2 lines // selNeigs.PushNew (guid); } return ACAPI_Element_Select (selNeigs, true); }
Requirements
- Version: API 1.3 or later
- Header: ACAPinc.h
See Also
API_Neig,
ACAPI_Element_DeselectAll,
Selection Manager, Element Manager, API Functions