# Is there an app reference related to the highlight function when clicking on the object?

**URL:** <https://forum.techsoft3d.com/t/is-there-an-app-reference-related-to-the-highlight-function-when-clicking-on-the-object/3017>\
**Category:** Help\
**Tags:** code, webviewer\
**Created:** [December 11, 2023, 4:07am UTC](https://forum.techsoft3d.com/t/is-there-an-app-reference-related-to-the-highlight-function-when-clicking-on-the-object/3017 "2023-12-11T04:07:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jhbae](https://avatars.discourse-cdn.com/v4/letter/j/ee7513/32.png) [@jhbae](https://forum.techsoft3d.com/u/jhbae)\
**Post date:** [December 11, 2023, 4:07am UTC](https://forum.techsoft3d.com/t/is-there-an-app-reference-related-to-the-highlight-function-when-clicking-on-the-object/3017/1 "2023-12-11T04:07:29Z")

</div>

Hi i have a question about API REFERENCES

 ![sss](https://us1.discourse-cdn.com/flex020/uploads/techsoft3d/original/2X/4/43812aa6bfdf606bbbf98330cd0e38dcdd8187bf.png)

[my code]  
hwv.view.fitNodes([nodeid], 500);  
hwv.model.setNodesFaceColor([nodeid], Communicator.Color.red());

Like the picture above,  
in basically the yellow highlight function that comes out when i click on a node  
I want to use it instead of setNodesFaceColor.

If I give nodeid as a parameter,  
Is there an API REFERENCES that can be used like a click function?

thank you.

---

<div class="post-metadata">

**Author:** ![tino](https://avatars.discourse-cdn.com/v4/letter/t/9dc877/32.png) [@tino](https://forum.techsoft3d.com/u/tino)\
**Post date:** [December 11, 2023, 12:07pm UTC](https://forum.techsoft3d.com/t/is-there-an-app-reference-related-to-the-highlight-function-when-clicking-on-the-object/3017/2 "2023-12-11T12:07:01Z")

</div>

Hello @jhbae.

As part of the Communicator package via [quickstart](https://docs.techsoft3d.com/communicator/latest/overview/quickstart.html?highlight=quickstart#quickstart), we have an example of changing the color, transparency and visibility for selected parts of a model.

Here are the steps to launch the example:

- Navigate to the directory _HOOPS\_Communicator\_2023\_SPX\_x\quick\_start_ and double-click _start\_server.bat_ to launch the server.exe.

- Click this URL: [http://localhost:11180/material.html?viewer=csr](http://localhost:11180/material.html?viewer=csr)

Once the example launches, you can just follow the instructions provided on the page.

With respect to your comment:

> _If I give nodeid as a parameter,_  
> _Is there an API REFERENCES that can be used like a click function?_

If you just want to quickly change the color “on-the-fly” of a selected node, you can use a [callback](https://docs.techsoft3d.com/communicator/latest/prog_guide/viewing/callbacks.html#callbacks) to do that. Here’s some JavaScript that you can paste in the web browser console:

```auto
function mySelectionFunc(selectionEvent) {
        var selection = selectionEvent.getSelection();
        if (selection && selection.getSelectionType() != Communicator.SelectionType.None) {
            console.log("Selected Node: " + selection.getNodeId());
			hwv.model.setNodesFaceColor([selection.getNodeId()], Communicator.Color.red());
        }
        else {
            console.log("Selected: None");
        }
   }

hwv.setCallbacks({
        selection: mySelectionFunc
    });

```

This code snippet changes the selected node to red:

 ![node_color_callback](https://us1.discourse-cdn.com/flex020/uploads/techsoft3d/original/2X/2/23a1fd07d5fffb18090ec2c35c68779c0d956540.png)

Also, the function to highlight nodes is [setNodesHighlighted](https://docs.techsoft3d.com/communicator/latest/api_ref/viewing/classes/Communicator.Model.html?highlight=setnodeshighlighted#Communicator.Model.setNodesHighlighted) – which is already included in the selection operator.

Thanks,  
Tino

---

<div class="post-metadata">

**Author:** ![jhbae](https://avatars.discourse-cdn.com/v4/letter/j/ee7513/32.png) [@jhbae](https://forum.techsoft3d.com/u/jhbae)\
**Post date:** [December 11, 2023, 11:22pm UTC](https://forum.techsoft3d.com/t/is-there-an-app-reference-related-to-the-highlight-function-when-clicking-on-the-object/3017/3 "2023-12-11T23:22:21Z")

</div>

Hello tino  
I was referring to your answer and found out that the function I was looking for was ‘setNodesHighlighted’ !  
Thank you.
