Jump to content

get group number in group pattern


luoqiulin

Recommended Posts

when i use python

>>>a = hou.node("obj/grid_object1/group1").evalParm('pattern')

>>>a

'40 50-52 60-63 70-74 80-85 90-95 '

how can i change the it like this?

'40 50 51 52 60 61 62 63 70 71 72 73 74 80 81 82 83 84 85 90 91 92 93 94 95

If you're using hscript, you can use the pointpattern expression to do this, so:

pointpattern("obj/grid_object1/group1", "40 50-52 60-63 70-74 80-85 90-95")

will yield the series of individual point numbers.

In Python you can do it with hou.Geometry.globPoints then turn the point numbers in to a string, if that's what you need, so something like:

n = hou.node("obj/grid_object1/group1")
pattern = n.evalParm('pattern')
pts = n.geometry().globPoints(pattern)
return " ".join(str(pt.number()) for pt in pts)

Something along those lines should work, I think.

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...