I have a tree of curves that I’m trying to trim the ends off leaving a percentage of the curve behind in a VB component in Grasshopper, but am having some trouble. The issue I am having is that none of the curves seem to be getting modified in any way. Attached is what I am attempting, what have I messed up?
Thanks,
Sam
Private Sub RunScript(ByVal InputCurves As DataTree(Of Object), ByVal OpenArea As Integer, ByRef A As Object)
Dim pOpen As Double = OpenArea / 100
Dim i As Int32 = 0
Dim outTree As New DataTree(Of Curve)()
While i < InputCurves.BranchCount
Dim j As Int32 = 0
While j < InputCurves.Branch(i).Count
Dim workingCurve As Curve = InputCurves.Branch(i)(j)
'''''''''''
Dim newDLength As Double = workingCurve.Domain.Length * (1 - pOpen)
Dim newParam As Double = (workingCurve.Domain.Length - newDLength) / 2
Dim oldLength As Double = workingCurve.GetLength
workingCurve.Trim(newParam, newParam + newDLength)
print("Old length: " & oldLength & ", new: " & workingCurve.GetLength)
Dim Path As New GH_Path(i)
outTree.Add(workingCurve, Path)
'''''''''''
j += 1
End While
A = outTree
i += 1
End While