Jump to content

HOM to expand/condense point lists "8 10-13 2" <-> &#3


Recommended Posts

Are there any convenience functions in the python HOM to expand/condense "group" type lists of geometry? Or do I have to write my own python functions to handle this?

 

For example I want to change:

 

1 5 8-11 13  into  1 5 8 9 10 11 13

 

or the other way around.

 

Also I'd like to be able to clean up:

 

1-10 5-12 20  into  1-12 20

 

Before I deal with it myself I figured there might be something in HOM that helps since it's such a standard way of listing geometry in Houdini.

 

Thanks!

Edited by cruiserandmax
Link to comment
Share on other sites

If you have the actual geometry, then for expanding, you can make use of hou.Geometry's globPoints(), globPrims(), etc. that returns you back a tuple. So untested code would be something like:

" ".join([str(pt.number()) for pt in geo.globPoints("1 5 8-11 13")])
I'm not sure if there's an easy one liner for condensing though.
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...