Hello, I’m having a bit of trouble. I want to get a measurement when selecting an object. I’m not sure what the selection type is, but from the callback, it seems to be a face. Right now, I catch the event by setting a selectionArray event.
Can anyone give me a pointer to what methods I should use?
Interactive functions such as measurement can be implemented using Operator in HOOPS Communicator.
In fact, there are some built-in measurement operators are provided in the WebViewer.
You can check the behavior using the demo-app in HOOPS Communicator/quick_start folder as below image:
Source code of the built-in operators are provided in TypeScript in HOOPS Communicator/web_viewer/deprecated/typescript/operators folder. It will be a good reference if you want to develop your own custom operators.
I have tried the measurement tools in the interactive demo, but what I’m looking is a way to automatically get the measurement when selecting a part. Is there no way to get the measurement when using the Select Parts operator?
You cannot easily get the measurement data automatically just from the default selection operator. Retrieving measurement data is more granular and requires more processing - hence, the reason there are dedicated measurement operators (face angle measurement, straight edge measurement, arc measurement, face distance, etc). In addition, certain measurements can only be done provided that the model has BRep.
Please take a look at our docs on the topic of measurement which includes an example of creating a measure operator based on a selection event.