Jump to content

Select Pts with One Connection


Recommended Posts

One thing to keep in mind is that code will return both the start and end points, as requested in the first post. But if you just want the end point or start point you may need to filter for that by looping over the primitives and detecting point #0 or point # @numpt.

// @ptnum is zero based.
if (@ptnum==(@numpt-1)){i@group_ends=1;}

 

untitled-1.jpg

Edited by Atom
Link to comment
Share on other sites

  On 9/15/2018 at 2:38 PM, Atom said:

One thing to keep in mind is that code will return both the start and end points, as requested in the first post. But if you just want the end point or start point you may need to filter for that by looping over the primitives and detecting point #0 or point # @numpt.

// @ptnum is zero based.
if (@ptnum==(@numpt-1)){i@group_ends=1;}

 

Expand  

no loops necessary and you should try to avoid them if you can

also first point of the primitive doesn't guarantee that it's at the start or at the end or even that the primitive has any start or end if it's closed, so you are better off using points belonging to first or last vertex and either checking if the prim is closed or using the neighbourcount() test

so to detect all you can combine first test with test whether point belongs to the first or the last vertex of the primitive

int pts[] = primpoints(0, @primnum);
int isend = neighbourcount(0, @ptnum) == 1;
int isfirst = @ptnum == pts[0];
int islast = @ptnum == pts[-1];

i@group_ends = isend;
i@group_start = isend && isfirst;
i@group_end = isend && islast;

OR mentioned open/closed poly test

int pts[] = primpoints(0, @primnum);
int isopen = !primintrinsic(0, "closed", @primnum);
int isfirst = @ptnum == pts[0];
int islast = @ptnum == pts[-1];

i@group_ends = isopen && (isfirst || islast);
i@group_start = isopen && isfirst;
i@group_end = isopen && islast;

 

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