Nearpoint function adapt limited points

   3001   10   0
User Avatar
Member
27 posts
Joined: Oct. 2018
Offline
Hi.

I'm trying to figure out near point in specified point group.
but , I can't know how to use nearpoint's ptgroup function.

so,anyone please help me.

int nearpoint(<geometry>geometry, string ptgroup, vector pt)
User Avatar
Member
459 posts
Joined: Oct. 2011
Offline
Hi
i@foundpt = nearpoint(0, '0-20', @P);
Will search points 0-20
i@foundpt = nearpoint(0, '@Cd.x<0.1', @P);
Will search points with Cd.x lower than 0.1
i@foundpt = nearpoint(0, 'pointgroup', @P);
Will search points in the group pointgroup
etc etc

Regards
Bonsak
http://www.racecar.no [www.racecar.no]
User Avatar
Member
27 posts
Joined: Oct. 2018
Offline
Hi,bonsak.

I want to connect points In order of closeness of distance.

so,I made search group, and find a point which should be connected in search group.

but, nearpoint function found a point which is not member of search group.
what should I do Could you tell me?

Attachments:
naerpoint.JPG (225.2 KB)

User Avatar
Member
27 posts
Joined: Oct. 2018
Offline
This pic is what my want to do.

Attachments:
S__311299.jpg (59.6 KB)

User Avatar
Member
2040 posts
Joined: Sept. 2015
Online
You've set pt 0 to be in the group you are searching.

But also are using the position of pt 0 to search from.

In such a situation the way the function works, you will get pt 0 as a result.

So you have a polyline going from pt 0 to pt 0.

To do what you want, use the nearpoints function.

It returns an array of nearest pts according to your arguments specified.

If I remember correctly, the membership of the resulting array will be in increasing order of distances.

For such an array you could simply iterate over it creating your polyline.

Just remember though, like the nearpoint function - your first point you used to search from( in this case pt 0) will be part of the result(first member in the array).
User Avatar
Member
27 posts
Joined: Oct. 2018
Offline
Hi,Babaj.

what I want to do is to find near point in the search group and add as vertex it to polyline first and then remove vertex point from search target group.
And again find a closed point in the search group from first vertex.

but,it seems that nearpoint function is looking for point out of search group.

Is this bad for my script?

If you have any ideas,could you tell me?

Thanks.

Attachments:
S__1433603.jpg (280.2 KB)

User Avatar
Member
2040 posts
Joined: Sept. 2015
Online
You have a group node before your wrangle which sets ( presumbably, because you haven't included a hip file) the membership for “search'.

But in the wrangle you ”set“ the group membership for ”search“ to only be pt. 0.

If there are some points defined to be in ”search“ with the group node, you should have used ”add“ instead of ”set“ for the setpointgroup function of the wrangle.

Otherwise, the way you have it set up is that there is a prim, but because it goes from pt. 0 to pt. 0 you don't see it.

( There's only one point in the group ”search" ).

Post your hip file, as I/others can make changes to it to get what you want.
User Avatar
Member
27 posts
Joined: Oct. 2018
Offline
Babaj


Thank you for advice.

so,I attached my hip file and what I imagine.
please tell me what my wrong.

Thanks.

Attachments:
ConnectPtsOneLine.hiplc (74.1 KB)
S__1441794.jpg (89.5 KB)

User Avatar
Member
27 posts
Joined: Oct. 2018
Offline
According to my sources,It does not seem to be updated attribute until the wrangle process is complete.

I have made it using solver node.

Even in the middle of the wrangle process, I wish I had a way to update attribute…

Thanks.
User Avatar
Member
2040 posts
Joined: Sept. 2015
Online
The wrangle colored red was added to your file, I think this is what you want?

In the process of working out the logic, I added some of my own defined variables along with yours so the code may look a bit messy.

Pretty sure from looking at your attempts you have a grasp of logic so you should be able to clean it up a bit.

Attachments:
ConnectPtsOneLine_v0.hiplc (83.3 KB)

User Avatar
Member
27 posts
Joined: Oct. 2018
Offline
Babaj

Thanks a lot!

This problem was solved thanks to your support.
Thank you very much.
  • Quick Links