# Find free end points of lines which do not coincide with other geometry

I’m looking for an easy way to find end points of lines which do not coincide with other geometry.

We are using Rhino5 to build FEA models with beam elements. Each beam is a simple line. Yet for the FEA software to read the geometry correctly, if you want to join beam A to beam B the end point of beam A needs to coincide either with an end point of beam B or the line representing beam B. See the pic below for an example where the end point doesn’t coincide with the nearest line.

Sometimes the geometry is sloppy and end points do not coincide with other geometry. What tools exist to find these free end points?

Using RhinoScript I can think of a coincidence check for end points (find coordinates of point x, select all points at this coordinate, check if there are more than one selected, create a point in a mark-up layer). But I’m struggling to think of a check if a given end point coincides with another line.

I’m thankful for any ideas here.

You could check for duplicate points. If two line end points coincide, you should have two points with the same coordinates.

Rhino - RhinoScriptSyntax (rhino3d.com)

You can try this RhinoScript to see if it helps.
(You need to select all the curves you want to analyze, if will end up with only the “open-ended” selected)

SelectOpenEndedCurves.rvb (1.6 KB)

hth,

–jarek

1 Like

selopencrv will light up open curves, then the crvend command will drop a point on the ends of the curve that is identified as open.

you can supercharge this process by making an alias that selects, isolates and then marks the start and end by running this as an alias-

check this out

selopencrv crvend crvstart selpt isolate

is the command string to assign to an alias.

remove the isolate if you do not want it to hide everything but the curve and start/end points.

Use PointClosestObject using start and end point of each open curve agains all other curves of interest (except the currently tested one). It will return an array of (0) closest object and (1) the closets point on it.
Check the distance between that point and the tested end - if more that file unit tolerance then you have “not touching” end.
That’s what the above script does.

Hello- you can try this Python - it might do what you need.

SelUnattachedLines.py (1.2 KB)

To use the Python script use `RunPythonScript`, or a macro:

`_-RunPythonScript "Full path to py file inside double-quotes"`

Oops - what Jarek said…

-Pascal

2 Likes

Here is the tool I wrote using RhinoScriptSyntax. It is very slow though if you have 3000+ single line objects in a model.

Can you guys think of a way to speed this up? I haven’t timed the subs yet, but I suspect a lot of time is lost in rs.LineIsFartherThan…

Rhino_Find_Free_Lines.py (4.3 KB)

Over here your python script just freezes Rhino on a test file with 3K lines, so can’t really test the speed properly.

I have revised the RhinoScript posted earlier to make sure we get optimal speed for what a script can do, and it seems to be doing “acceptable” : 4.5 sec on 1,000 lines, 17 sec on 2,000 lines and 32 sec on 3000 lines. Not sure what your typical count to analyze is but up to around 10,000 it may work fine.
I included progress meter and time elapsed report.

Maybe it is helpful so you can try to use similar approach in Python RhinoScriptSyntax.

SelectOpenEndedCurves.rvb (1.9 KB)

And here is the file I am testing it with:
freelinestest.3dm (3.3 MB)

1 Like

Here is the latest version that will also highlight the found endpoints that are disconnected:
SelectOpenEndedCurves.rvb (2.1 KB)

1 Like