Jump to content

Querying bounding box of geo from python shell...


manitou

Recommended Posts

You need to get an instance of hou.Geometry. Sometimes there is no easy way to track what set of calls you need to get hou.Something. You may try to construct it by calling hou.Something(). It may throw an "AttributeError: No constructor defined", which is, I think, will happen with most of hou classes. Even if you can construct hou.Geometry, you obviously need a specific geometry, not an empty one. Fortunately, any SopNode seems to have a Geometry. Here is Python Shell example:

>>> node = hou.node('/obj/geo1/platonic1')
>>> geo = node.geometry()
>>> bb = geo.boundingBox()
>>> bb
<hou.BoundingBox [-0.92793, 0.92793, -0.975684, 0.975684, -0.789344, 0.789344]>
>>> mv = bb.minvec()
>>> mv
<hou.Vector3 [-0.92793, -0.975684, -0.789344]>
>>> tuple(mv)
(-0.9279304146766663, -0.9756839275360107, -0.7893444299697876)

 

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...