Jump to content

Is there a way to limit the current point number to used groups?


magneto

Recommended Posts

It's hard to word this but basically I am trying to assign weights to points based on their index. So point 0 will have a value of 0, and point N will have a value of 1.

I did this no problem but when a group is specified, I want the values to be adjusted accordingly. So if you have 100 points, and then created a group for point 25-50, then I want the range to be 0-1 based on 25-50, as if 25 was 0, and 50 was 100.

Basically I need something like:

group.startIndex

group.endIndex

Can I do this purely using nodes? I am using AttribCreate so if anyone has any solutions for this, I would appreciate it.

Thanks :)

Link to comment
Share on other sites

here is the example using attributecreate and a little python as a value expression

groupName = ch("group")
geo = hou.pwd().inputs()[0].geometry()
group = geo.findPointGroup(groupName)
points = group.points()
start = points[0].number()
end = points[-1].number()
return hou.hmath.fit( lvar("PT"), start, end, 0, 1 )

look in file how it's used

weight_group.hipnc

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