ACAPI_​Interface_​SetElementHighlight

Highlight elements in the 2D (floor plan and section) and 3D window.

    GSErrCode ACAPI_Interface_SetElementHighlight (
        const GS::HashTable<API_Guid,API_RGBAColor>&  highlightedElems,
        const GS::Optional<bool>&                     wireframe3D = GS::NoValue,
        const GS::Optional<API_RGBAColor>&            nonHighlightedElemsColor = GS::NoValue
    );

 

Parameters

highlightedElems
Hash table containing the elements (identified by their GUIDs) and the colors to highlight the element with.
[wireframe3D]
Switch other elements in the 3D window to wireframe (does not have effect in case of using Vectorial Engine). Optional, it can be GS::NoValue.
[nonHighlightedElemsColor]
It contains the color and the transparency of the non highlighted elements. Optional, it can be GS::NoValue.

 

Return Values

NoError
The function has completed with success.

For other common API errors see the API Errors document.

 

Remarks

You can remove element highlight by calling ACAPI_Interface_ClearElementHighlight.

After changing element highlights the model needs to be redrawn by calling ACAPI_Automate (APIDo_RedrawID).

 

Example


//------------------------------------------------------
// Highlight every mesh
//------------------------------------------------------
static void Do_HighlightElements (void)
{
    static bool hled = false;

    if (hled) {
        // remove the highlight
        ACAPI_Interface_ClearElementHighlight ();
        ACAPI_Automate (APIDo_RedrawID);
    } else {
        GS::Array<API_Guid> meshList;
        ACAPI_Element_GetElemList (API_MeshID, &meshList);

        if (meshList.GetSize () > 0) {
            GS::HashTable<API_Guid, API_RGBAColor>  hlElems;
            API_RGBAColor   hlColor = { 0.0, 0.5, 0.75, 0.5 };
            for (auto it = meshList.Enumerate (); it != nullptr; ++it) {
                hlElems.Add (*it, hlColor);
                hlColor.f_red += 0.1;
                if (hlColor.f_red > 1.0)
                    hlColor.f_red = 0.0;
            }

            bool wireframe3D = false;
            API_RGBAColor nonHighlightedElemsColor = {0.7, 0.7, 0.7, 0.95};

            ACAPI_Interface_SetElementHighlight (hlElems, wireframe3D, nonHighlightedElemsColor);
            ACAPI_Automate (APIDo_RedrawID);
        }
    }

    hled = !hled;
}

 

Requirements

Version: API 26 or later
Header: ACAPinc.h

 

See Also

ACAPI_Interface_ClearElementHighlight,
API Functions