Project mesh bug

Hi,

I have run into a bug when projecting a curve to a mesh, as seen in this file:

ProjectToMesh_Error.3dm (100.1 KB)
(this is a rhino 5 file but the error is repeatable in 6 as well)

When you project the straight line on the layer “CurveToProject” to the mesh, horizontally (use the “Right” view) you get two curves. Ontop of this, one of the curve segments switches back over itself so the two segments cannot be easily joined.

Here is an image with the two curves slightly moved apart so you can clearly see them. I have also moved the curve start point upwards slightly to demonstrate the problem. in the example, this start point lies directly over the control point just below it:

This error was found as part of a script that is being run on a significant number of these examples (all are slightly different) and I am trying to handle any exceptions that may pop up. I am not so concerned with there being two curves, I can detect and join them, what is causing me some grief here is the fact that this is not possible in this example.

Is this something that you can fix easily? Can anyone suggest a workaround in a script to detect this and join these curves?

Hello - I see that - just guessing that is has to do with the shallow angle to the mesh at that location. The Connect command on the two segments cleans up.

https://mcneel.myjetbrains.com/youtrack/issue/RH-47113

-Pascal

Hi Pascal,

I had thought it had to do with the line going directly through a mesh (black) vertex at the end of curve A (red) / kink in curve B (blue)…

I see that connect with join=Yes works well. Thanks!
Is there a python or RhinoCommon equivalent so that I can script it?

Hi @pascal,

Any Ideas on how I could script this reliably? When I try this I get a bizarre result:

import rhinoscriptsyntax as rs

curves = rs.GetObjects("Select Curves to connect")

cmd = "_-Connect " + "Join=Yes " + "SELID " + str(curves[0]) + " SELID " + str(curves[1]) + " _EnterEnd "
rs.Command(cmd)

image

(I have moved the 2 input curves to the left for clarity. the output curve is on the right)

Interestingly enough, this works on Rhino 6 however unfortunately I am limited to 5 for the time being until I get the rest of our scripts functional there.

Hello - your script works here, at least for lines and arcs that do or could intersect. Oops - yeah, v6… I’ll try V5…

Works in V5 so far.

-Pascal

Hi Pascal,

Did you try it on my example? I always get that short line…

I did not see a file…

-Pascal

Hi Pascal,

I meant the one in my first post:

Oh… yeah. I forgot where we started,…

-Pascal

No worries, any luck?

I guess the problem here is that the starts of the polyline fold back-

image

The apparent starts are not the starts. If you flip the curve directions the script works…

-Pascal

Hi @pascal,

Yes, that is indeed the problem from the start. There is a bug in rhino’s ProjectCurveToMesh algorithm - this is an example.
I will try to detect this and flip one of the curves…