Reference external objects point count

   2806   4   1
User Avatar
Member
5 posts
Joined: Nov. 2016
Offline
Hey all,

Super noob question.

I have 2 objects (OBJECT_01, OBJECT_02) with differing point counts. I'm trying to take the object with the greater point count (OBJECT_01) and divide it's points into 2 groups. The first group should have the same amount of points as OBJECT_02 with the remainder going into the second group.

I've put a group expression node on OBJECT_01 but can't for the life of me figure out what to put in the VEXpression field.

This closest I've got is: @ptnum > (“../OBJECT02/”, @numpt) but that's not working.

Any clues to what I'm doing wrong?

Thanks,
Chris
User Avatar
Member
1743 posts
Joined: March 2012
Offline
There's a VEX function named npoints [www.sidefx.com] that should help. For example:

@ptnum >= npoints("../OBJECT_02")

Hopefully that's what you were looking for.
Writing code for fun and profit since... 2005? Wow, I'm getting old.
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
User Avatar
Member
5 posts
Joined: Nov. 2016
Offline
Hey ndickson,

Thanks for getting back so quickly! Unfortunately that doesn't seem to work. Using that code places every single point into the group.

I've attached a super simplified version of what I'm trying to achieve. Any further advice would be massively appreciated.

I need to take a course on VEX!

Attachments:
Group_Test1.hip (105.8 KB)

User Avatar
Member
1743 posts
Joined: March 2012
Offline
Sorry, my mistake. To refer to nodes, the path has to be prefixed with op:, e.g. op:../OBJECT_02. The less error-prone approach is to connect the geometry in question into the second input and do:

@ptnum >= npoints(1)

That seems to work. The 1 refers to the input number, where the first input is input number 0, and the second input is input number 1, etc.
Edited by neil_math_comp - June 27, 2017 11:03:43
Writing code for fun and profit since... 2005? Wow, I'm getting old.
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
User Avatar
Member
5 posts
Joined: Nov. 2016
Offline
ndickson, you are an absolute legend. Thank you. I'm learning so much every day and couldn't do it without peeps like your good self. Thanks again.
  • Quick Links