Jump to content
Krion

Prevent duplicate lines while connecting nearpoints()

Recommended Posts

Hi guys, 

 

At this moment I could really use some guidance: I have found nearby points on my scattered grid and connected them in a certain way. As you can see in the screenshot by the overlapping point numbers, a lot of duplicate lines are made.

I tried to prevent this by making an attribute that denotes if a connection is made on a point, but this didn't change anything. And on sidefx.com I saw this post where people say a wrangle isn't able to read the attribute values already added by that same wrangle, which kind of explains why my code didn't work.

But how is this sort of thing done then?

 

Thanks. (:

5de430800cd45_Screenshot2019-12-01at22_14_36.thumb.png.5afd3cfed6083773d8714052ea24bcb7.png

Share this post


Link to post
Share on other sites

would fuse and polypath work ? would help if you upload your file, doesn't have to be everything, just a few bits of the overlapping lines might help ppl solving the problem.

  • Thanks 1

Share this post


Link to post
Share on other sites

For this problem that works indeed, thanks.

I guess I posted it because I intended to ask a more general question about how you can deal with wanting to acces the ‘updated’ attributes of a wrangle and I just assumed that this would be a thing of importance to a broad range of possible 'future' problems..

But yeah; maybe the solution is just to think simple and to don’t forget SOPs are still there, even when you try to be super technical. :lol:

Edited by Krion

Share this post


Link to post
Share on other sites

Hi Dave,

nearpoints() always returns the current point first, so I usually remove the first item from the array:

removeindex(pts, 0);

To avoid creating double lines you would only connect to point numbers that are larger than the current point:

if(i@ptnum > pt)

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

You can make new primitives based on the  points you already have. Connect them all and then compare if you have duplicates. Sometimes you have to do operations over several wrangles.

 

NoDuplicates_01.hip

Edited by ThomasPara
  • Thanks 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×