Tests an element by some given criteria.
bool ACAPI_Element_Filter ( const API_Guid& guid, API_ElemFilterFlags filterBits, API_ElemVariationID variationID = APIVarId_Generic const API_Guid& renovationFilterGuid = APINULLGuid );
Parameters
- guid
- [in] Global unique identifier of the element to be tested
- filterBits
- [in] The flags used for filtering (see the table below)
- variationID
- [in] Optional variation ID for objects. Used in combination with
APIFilt_IsOfVariation
. The default value isAPIVarId_Generic
. - renovationFilterGuid
- [in] Optional global unique identifier of the renovation filter. Used in combination with
APIFilt_IsVisibleByRenovation
. The default value isAPINULLGuid
.
Return Values
true
- The given element (defined by
guid
) matches the criteria defined byfilterbits
false
-
The referenced element does not pass the criteria
Remarks
Note that the 3D visibility of GDL-based elements can also be modified through GDL parameters which work independently from the element settings. Due to this there may be cases where the ACAPI_Element_Filter function shows that an elem is visible on 3D, but its GDL script hides it on 3D-based views.
Returns true
, if the given element matches the criteria defined by filterbits
:
filterbits value |
Checks whether the element | Concerned elements |
---|---|---|
APIFilt_None |
not filtered | |
APIFilt_IsEditable |
is not on a locked/deleted/invisible layer | all (for windows, doors and skylights this tests the layer of the owner element) |
APIFilt_OnVisLayer |
is on a visible layer | all (for windows, doors and skylights this tests the layer of the owner element) |
APIFilt_OnActFloor |
is on the active floor | all (always true for cut planes and groups) |
APIFilt_In3D |
has 3D representation | API_WallID , API_ColumnID , API_BeamID , API_WindowID , API_DoorID , API_SkylightID , API_ObjectID , API_LampID , API_SlabID , API_RoofID , API_MeshID , API_ShellID , API_CurtainWallID , API_MorphID |
APIFilt_InMyWorkspace |
is in my workspace (in Teamwork mode) | all element types |
APIFilt_IsIndependent |
is independent (not a sub elem) | API_ObjectID , API_TextID |
APIFilt_OnActLayout ![]() |
is on the active layout | drawing type elements |
APIFilt_InCroppedView ![]() |
is visible inside the cropped part of a drawing database | drawing type elements |
APIFilt_IsOfVariation ![]() |
tells if the given element has the variation ID passed in the variationID parameter. |
object type elements |
APIFilt_FromFloorplan ![]() |
additional flag; instructs the function to take the element from the floor plan database | all element types |
APIFilt_HasAccessRight ![]() |
additional flag; checks if the element is accessible for the current user | all element types |
APIFilt_IsVisibleByRenovation ![]() |
additional flag; checks if the element is visible by the renovation filter passed in the renovationFilterGuid parameter, default by the current renovation filter. |
all element types |
APIFilt_IsOverriddenByRenovation ![]() |
additional flag; checks if the attributes of the element are overridden by current renovation filter | all element types |
APIFilt_IsInStructureDisplay ![]() |
additional flag; checks if the element is visible taking into account the current structure display setting | all element types |
If the value of filterBits
is 0, only the existence of the element is checked.
This routine helps you quickly test different attributes without converting the whole model, for example when you walk through all the elements, and test for the existence of the 3D representation of an element.
Example
GS::Array<API_Guid> elemList; ACAPI_Element_GetElemList (API_LineID, &elemList); DBPrintf ("number of lines = %ld,", elemList.GetSize ()); short visible = 0; short onStory = 0; short inView = 0; for (GS::Array<API_Guid>::ConstIterator it = elemList.Enumerate (); it != nullptr; ++it) { if (ACAPI_Element_Filter (*it, APIFilt_OnVisLayer)) ++visible; if (ACAPI_Element_Filter (*it, APIFilt_OnActFloor)) ++onStory; if (ACAPI_Element_Filter (*it, APIFilt_InCroppedView)) ++inView; } DBPrintf ("%d visible, %d on the view\'s floor, %d in the cropped view\n", visible, onStory, inView);
Requirements
- Version: API 1.3 or later
- Header: ACAPinc.h
See Also
API_Guid
ACAPI_Element_GetElemList
APIDb_DrawOrderGetNextID
APIDb_CreationOrderGetNextID
API_ElemSearchPars
Element Manager, API Functions