HOOPS Communicator

Does Hoop Communicator SDK provide a way to retrieve the height, width and length of a part from a converted STEP file? I don’t see any methods in the model class supporting this. Can you provide an example showing how this can be accomplished?


Yes, you can query the model dimensions using the Communicator WebViewer API.

The best way to do this programmatically would be to query the bounding box of the model. You can use getModelBounding to achieve this. This will return a box containing the extents of the model, and using that returned box, you can query things like width, height, length, model center, etc. You can find all methods on the returned Box object here. The extents method will return the dimensions in each axis direction.

Note that the orientation of your model relative to the scene axes will make an impact here, as the bounding box returned is an axis-aligned box. Therefore, any orientation of the model from its original state will give different box values. It may also be desirable to use the tightBounding option to ensure no whitespace is caught between the model and box, though this is a bigger performance hit.

If this does not meet your needs, we have measurement operators that users can use to interactively query the model. This allows a user to select a two points on the model and have a distance returned. You can read more about this operator here.

(note that the small difference in returned measurement is a user input tolerance artifact - this can be more finely tuned by the user to be more precise)


Just to add to Chris’ answer if you are also interested in the units of the bounding box returned with getModelBounding() you can query those with the getNodeUnitMultiplier() function.

1 Like

Thank you guys! I will look into all your suggestions.