Language: JavaScript
The multiple_instance example is using the function (getNodesEffectiveFaceColor()
):
…which does not have the granularity to retrieve the individual face colors of an instance. As an alternative, there is a function called getNodeEffectiveFaceColor():
As proof of concept, attached is a brief video (with audio narration) walking through an example:
Below is the JavaScript used in the video:
- Time stamp [0:10]:
var hwv = multipleInstance._viewer;
function mySelectionFunc(selectionEvent) {
var selection = selectionEvent.getSelection();
if (selection && selection.getSelectionType() != Communicator.SelectionType.None) {
console.log("Selected Node: " + selection.getNodeId());
console.log("Face ID: " + selection.getFaceEntity().getCadFaceIndex());
}
else {
console.log("Selected: None");
}
}
hwv.setCallbacks({
selection: mySelectionFunc
});
-
Time stamp [0:38]
hwv.model.getNodeEffectiveFaceColor(10, 755);
-
Time stamp [1:20]
var color = new Communicator.Color(0, 128, 255);
hwv.model.setNodeFaceColor(-64, 755, color);