Rhinocommon CreateSoftEditCurve Issue

I have some spirals that I created with python around rail curves, with the spirals using t0/t1 values to go partially up and down the rail, taking about 20% off each end. I then want to do a soft edit of the spiral curves to meet the end points of the original rails. See below image.

image

Below is the result. I have been able to do one end fine. Now I need to do the remaining segment in green, softly editing from that end to the end of the rail curve.

The other end, done as an additional soft edit, doesnā€™t to behave the same. This is even with fix ends = false. Main things I have been checking carefully are the domain being reparametrized of course. But I think my use of the arguments for the soft edit method might be out of whack. Is the length parameter, some kind of ā€˜absoluteā€™ length? So, if Iā€™m editing from t = 1, does Rhino know that it needs to do the distance back along the curveā€™s parameter toward zero? Or is it like a sphere of influence? Below it refers to ā€˜alongā€™. Is it a measure distance, or parameter distance?

length

Type: System.Double
The distance along the curve from the editing point over which the strength of the editing falls off smoothly.

Below is the issue, although this looks like a basic vector swap, the problem here I see is that the end of the curve is fixing in place when I have fix ends as False.


If the length of falloff is very small, 2mm ish, for a curve that is aroud 300mm long, it works okay. But, that means itā€™s not a soft edit at all, itā€™s really harsh. Tried rebuilding and refitting, made no difference.

My code is below, done in the Grasshopper component

import Rhino.Geometry as rg

#declare lists
spirals = []
soft_edit_start = []
soft_edit_both = []
turn = railCurve.GetLength() / turnFactor

spiral = rg.NurbsCurve.CreateSpiral(railCurve, t0,t1, rp, pitch, turn, r0, r1,pointsPerTurn)
spiral.Domain = intv

rail_end = railCurve.PointAt(1)
rail_start = railCurve.PointAt(0)
spiral_end = spiral.PointAt(1)
spiral_start = spiral.PointAt(0)
#spiral_end_vector =rg.Vector3d.Multiply(-1, rg.Vector3d(spiral_end)) 

vector0 = rg.Vector3d.Subtract(rg.Vector3d(rail_start), rg.Vector3d(spiral_start))
vector1 = rg.Vector3d.Add(rg.Vector3d(spiral_end_vector), rg.Vector3d(rail_end))

soft_edited = rg.Curve.CreateSoftEditCurve(spiral, 0, vector0, softEditLength, False)
soft_edited_1 = rg.Curve.CreateSoftEditCurve(soft_edited, 1, vector1, soft_edit_length_2, False)

spirals.append(spiral) # check in gh
soft_edit_start.append(soft_edited) # check in gh
soft_edit_both.append(soft_edited_1) # check in gh

Iā€™ve uploaded the below, Iā€™m completely stumped. Itā€™s a little like the fixEnds parameter is setting itself to true, or acting that way, even though Iā€™ve specified False.

SoftEdit +Z is fine

SoftEdit -Z is performing as though fixEnds = True when specified False

curvesSoftEditBug.gh (8.7 KB)
curvesSoftEdit.3dm (170.9 KB)

@Jussi_Aaltonen , do you know the Soft Edit Curve toolset well? Could you recommend someone who might know whatā€™s up here?

Edit:
So, my latest observation is that a lower point count, even with softEdit parameters the same, produced a different result. Shouldnā€™t the dense curve still be edited softly, though, producing a somewhat similar result? Of course the fall off would be expected to be a little more sudden since there are that many points underneath, but if the ends are specified as NOT fixed, shouldnā€™t that remain the case regardless of density?

Hi @Jonathan_Hutchinson

My guess is either Rajaa or Dale Fugier could help you.

@rajaa / @dale Please, could you take a look?

Thank you @Jussi_Aaltonen , really appreciated.

@Jonathan_Hutchinson I put together a script for you that I hope it will help use the function.
This is the result when ā€œtā€ is at the end of the curve (fixed end is true)

This is the result when ā€œtā€ is at the start of the curve (fixed end is true)

Here is the GH file
curvesSoftEditBug_RI.gh (45.8 KB)

Does this give you the result you expected and help clarify how the function works?

Dear Raja,

Thank you for sending this. I think the gif below might explain this better. Here, you see how upwards the smooth soft edit is fine. Downwards, it has struggled. Here, I am superimposing the separate edits where I soft edit both up and down.

softeditcurve

I have attached the below file, to show the result of a manual soft edit, which I think the rhinocommon equivalent should be able to imitate through the ghPython component (via two CreateSoftEditCurve calls). Fixed ends should be false, to enable the end to move to the specified points above and below the helix, which lie close to the rail curve used to generate the spirals

softeditcrvbug_jh.3dm (152.0 KB)
curvesSoftEditBug_RI_JH.gh (12.9 KB)

Is this any clearer? I hope so :smiley:

I see your point. Let me experiment to see what is the difference between the 2 here.

1 Like

Great! From my tests, it seemed lower point counts worked a lot better. But I couldnā€™t really find a structure or logic, especially since with the normal command it can be done with no issue.

Hi Rajaa, did you find a reason for this curve ends behaviour?