ACAPI_​Element_​Filter

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 12
[in] Global unique identifier of the element to be tested
filterBits
[in] The flags used for filtering (see the table below)
variationID Featuring API 12
[in] Optional variation ID for objects. Used in combination with APIFilt_IsOfVariation. The default value is APIVarId_Generic.
renovationFilterGuid Featuring API 17
[in] Optional global unique identifier of the renovation filter. Used in combination with APIFilt_IsVisibleByRenovation. The default value is APINULLGuid.

 

Return Values

true
The given element (defined by guid) matches the criteria defined by filterbits
false
The referenced element does not pass the criteria

 

Remarks

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  Featuring API 10 is on the active layout drawing type elements
APIFilt_InCroppedView  Featuring API 10 is visible inside the cropped part of a drawing database drawing type elements
APIFilt_IsOfVariation  Featuring API 12 tells if the given element has the variation ID passed in the variationID parameter. object type elements
APIFilt_FromFloorplan  Featuring API 12 additional flag; instructs the function to take the element from the floor plan database all element types
APIFilt_HasAccessRight  API 14 additional flag; checks if the element is accessible for the current user all element types
APIFilt_IsVisibleByRenovation  API 15 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  API 15 additional flag; checks if the attributes of the element are overridden by current renovation filter all element types
APIFilt_IsInStructureDisplay  API 18 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