How to change a selection color

How to change a selection color

Web Toolkit version 1.x

There is an opportunity to change the selection color. In viewer.js you need to add a ModelData_ColorObject in ModelPrs_DisplayParams and add ModelPrs_DisplayParams into ModelPrs_DisplayerApplier

This a small example how to do it.

await cadex.ModelPrs_DisplayerApplier.apply(aLoadResult.roots, [], {
    displayer: new SceneDisplayer(aScene, aJsTree, aFileNode),
    displayMode: aDisplayMode,
    repSelector: new cadex.ModelData_RepresentationMaskSelector(aRepMode),
    selectionColor: new cadex.ModelData_ColorObject(1, 0, 1, 1) });

Web Toolkit version 3.x

Here there is a class ModelPrs_Style each object ModelPrs_SceneNode has. ModelPrs_Style has members "selectionAppearance" and "highlightAppearance". You can refer in PMI Example to view this functionality. The code of source example is represented here.

const aStyle = new cadex.ModelPrs_Style();
aStyle.selectionAppearance = new cadex.ModelData_Appearance(cadex.ModelData_ColorObject.fromHex(0xff0000)); // Red color
aStyle.highlightAppearance = new cadex.ModelData_Appearance(cadex.ModelData_ColorObject.fromHex(0xff0000));
aStyle.boundariesHighlightAppearance = new cadex.ModelData_Appearance(cadex.ModelData_ColorObject.fromHex(0xb2ff65)); = aStyle;

    • Related Articles

    • How to retrieve the color of a point (in a BRep model)

      1. Get the ModelData_BRepRepresentation of a part; 2. Get a list of all the Bodies that belong to this Part: ModelData_BodyList aBodyList = theBRep.Get(); 3. Use Appearance(aBody) method of the ModelData_BRepRepresentation object to retrieve ...
    • View options

      Under title Display mode, you can choose wireframe, shading, or shading with boundaries. Under Projection mode there are perspective or isometric view options. Selection mode allows selecting one face of the object or its whole body.
    • What to do if there is not enough virtual memory?

      Large models can cause errors when there is not enough virtual memory allocated for the system to process big files successfully. Increasing virtual memory can be done as follows: Navigate to the **System** section of the Windows Control Panel: ...
    • Enabling extended logging for floating license server

      The floating license server can produce a log file that details activity such as client connections or disconnections, license checkout/checkin, and other server activity. Extended logging can be enabled as follows: Find the "LOG_FORMAT = NORMAL" ...
    • Manipulator

      It’s possible to move and rotate either the whole assemblies or individual parts of the model in CAD Exchanger. Click the Manipulator button for it to appear on the screen and use it to change the position and rotation of the selected object, then ...