Select edges by curve in 3D

Hi

How do I select edges based on their proximity to each other or to a curve on a 3D model. I want the edges to which the polyline passes through to be selected.


select_segment.gh (20.6 KB)

Thanks

Hi,

You can do it by identifying the closest polygon segment to your guide polyline.
This can be done by getting the middle point of each segment, finding its closest distance to the polyline, and comparing that value to a tolerance.

The only downside really is that you need to adapt this tolerance manually, if your model scale changes.

select_segment_2.gh (27.2 KB)

1 Like

I’m not thrilled about this solution because it depends on setting a slider value manually, but there needs to be a way to handle the polygons at the ends which have only one segment each, not two.


select_segment_2021Sep26a.gh (26.0 KB)

By the way, I see that @diff-arch’s solution also depends on setting a slider and his image is missing one segment.

1 Like

Thank you so much! Both solutions work!

Check this as well…


select_segment._re.gh (23.4 KB)

1 Like

Thanks for all the solutions

Just one more question if possible.

Is there a way to sort the segments from another parameter than distance from an end-point? To have the numbers of the edges graduate from the top till bottom of the curve, but be dependent on something else? So that curves could be made non-linear


select_segment._re 3.gh (23.6 KB)

Yes, you can for instance sort them along your guide polyline.

If you want to reverse the order from top to bottom, instead of from bottom to top like currently, you can simply reverse the sorted list of points.

I’m not exactly sure what you mean by this.

select_segment_3.gh (27.5 KB)

1 Like

Here is a different method that doesn’t require setting any slider, though it does depend on distance to end points because those polygons at the end get only one segment highlighted instead of two like all the others in between.


select_segment_2021Sep26b.gh (38.4 KB)

It looks like you reposted @HS_Kim’s solution for some reason? I don’t understand your revised goal?

1 Like

Sorry for my unclarity, I should have explained better what the end goal is
With the numbering system its to be able to have the edges number along the curve and then attach the same numbers to the edges so they can be lofted together

Diff-arch’s solution works better for this, since here where an end point is not useful to sort by, but I can’t seem to attach the sorting to the edges using sort list, I am not sure what i’m doing wrong here.

select_segment_4.gh (34.4 KB)

My version ‘b’ above works fine with your new geometry, except the results are hidden by a mysterious (flaky?) Custom Preview component. Adding Pipe makes them visible.


select_segment_2021Sep26c.gh (35.2 KB)

Same with my version ‘a’.

1 Like

You can use the indices that the AlongCrv component spits out to get the sorted polygon segments.

Note that due to the polygon winding, every second edge also needs to be flipped, otherwise the ribbon that results from the loft will be twisted.

select_segment_5.gh (32.5 KB)

1 Like

Thanks a lot! This solves everything!

You’re welcome.

1 Like

I added Loft (white group) but it is twisted due to curve direction mismatch. Solving that in a general way that always works is more than I care to tackle today.


select_segment_2021Sep26d.gh (39.2 KB)

1 Like

Thank you!

Try this, it depends on all your surface normals going the same direction to determine whether or not to Flip Curve a segment before lofting. (cyan group)


select_segment_2021Sep26e.gh (49.7 KB)

Rather complicated…

P.S. See teal colored group, lower right.

  • Used TweenCrvto replace segment pairs with a single “section”.
  • Added Fillet to smooth the “rail” curve.
  • Replaced Loft with Swp1.


select_segment_2021Sep26f.gh (39.7 KB)

1 Like

Thanks!! This is super good, solves the flip and creates a more harmonious shape!

Flip Curve is still in there and still needed, I think. Loft is still there too, disabled but it works.

1 Like