Jump to content

grouping procedurally


logix1390

Recommended Posts

Hello,

I am trying to group points procedurally 3 at a time. I have a simple line and I am trying to apply if statement logic to it. It works but it is not fully procedural since I would have to keep copy and pasting the if statement in order to group more points. 

Is there a more procedural way to do this using vex or perhaps another way ? Any input would be appreciated. I will attach a photo and a scene file to show you what I am talking about. 

Thank you!

group_by_3_procedurally.hipnc

group_by_3_procedurally.jpg

Link to comment
Share on other sites

Same thing in a python node:

node = hou.pwd()
geo = node.geometry()
name = node.evalParm('name')
points = node.evalParm('points')

for point in geo.points():
    segment = point.number() / points
    group_name = name + str(segment)
    groups = [g.name() for g in geo.pointGroups()]
    if group_name not in groups:
        grp = geo.createPointGroup(group_name)
    grp.add(point)

 

Edited by konstantin magnus
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...