I'm having a few problems lofting some curves in a custom VB component. I have a data tree of lines, where I'd like to loft between the lines of each branch. However, I'm getting an error when I try to loft between all of the lines on each branch because it's saying, "Unable to cast object of type Rhino.Geometry.Line to object of type Rhino.Geometry.Curve.".
So, I went back into my code and I'm trying to cast those lines from the data tree into a new tree of curves that I can loft between. However, when I try to use the TryCast method, I'm still getting an error in Visual Studio that says it's unable to cast Rhino.Geometry.Line to Rhino.Geometry.Curve. Below is the code snippet that's dealing with cycling through the tree and trying to cast each line into a new curve tree. Any suggestions would be much appreciated.
'SummerStartLine is my Data Tree of lines
Dim Loftcurves As New DataTree(Of Curve)
For n = 0 To SummerStartLine.BranchCount - 1
Dim lineitem As Line
For Each lineitem In SummerStartLine.Branch(n)
Loftcurves.Add((TryCast(lineitem, Curve)), n)
Next
Next
Tags: