Hi,

First I should say I'm new to grasshopper and new to vb.net (but have
used rhinoscript for a while) so I'm in new territory here.

I have a script node that was directly adapted from the example that
was posted with the newest version of the plugin (the one that covers
a surface  with polylines in a spiral, like Foster's building in
London). The function appears to work correctly now and draws the
curves correctly, and the output of this node is a list of Polyline
curves.

I'm now trying to feed this list into another vb.net node that will
loft the output curves (in pairs, like strips) and return a list of
the lofted surfaces. I am running into an error which seems to be a
problem with data types, but being new to vb.net and grasshopper I'm a
little stumped as to where to begin to troubleshoot...it may be
something easily solvable with typecasting or something...

Error: [BC30456] 'Object' is not a member of
'System.Collections.Generic.List(Of RMA.OpenNURBS.OnCurve)'.
Error: [BC30456] 'Object' is not a member of
'System.Collections.Generic.List(Of RMA.OpenNURBS.OnCurve)'.

In the node properties, I am specifying that the incoming data are
lists, and with a typehint OnCurve. The rest of the code was adapted
from http://en.wiki.mcneel.com/default.aspx/McNeel/SdkLoft and is
posted below.

Thanks for any help! This is an amazing product!

Imports System
Imports System.IO
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Reflection
Imports System.Collections
Imports System.Collections.Generic
Imports Microsoft.VisualBasic

Imports RMA.OpenNURBS
Imports RMA.Rhino
Imports Grasshopper.Kernel.Types

Class Grasshopper_Custom_Script
#Region "members"
  Private app As MRhinoApp
  Private doc As MRhinoDoc

  Public A As System.Object
#End Region

  Sub RunScript(ByVal topProfile As List(Of OnCurve), ByVal
bottomProfile As List(Of OnCurve))
                Dim surf_list As New List(Of OnNurbsSurface)

                ' Fill in loft arguments class
                Dim args As New MArgsRhinoLoft()
                args.m_bAllowStartTangent = False
                args.m_bAllowEndTangent = False
                args.m_bUseStartpoint = False
                args.m_bUseEndpoint = False
                args.m_bClosed = False
                args.m_loft_type = IArgsRhinoLoft.eLoftType.ltTight
                args.m_simplify_method = IArgsRhinoLoft.eLoftSimplify.lsNone
                args.m_start_condition = IArgsRhinoLoft.eLoftEnds.leNatural
                args.m_end_condition = IArgsRhinoLoft.eLoftEnds.leNatural
                args.m_rebuild_point_count = 10
                'args.m_refit_tolerance = context.m_doc.AbsoluteTolerance()

                Dim object_count As Integer = topProfile.Count()
                Dim loftcurves(object_count - 1) As MRhinoLoftCurve

                ' Add loft curves
                ' top is 0, bottom is 1
                Dim t As Integer = 0
                Dim b As Integer = 0

                For i As Integer = 0 To object_count - 1
                        Dim curveTop As IOnCurve = topProfile.Object(i).Curve()
                        Dim curveBottom As IOnCurve = 
bottomProfile.Object(i).Curve()
                        If (curveTop IsNot Nothing) Then
                                loftcurves(t) = New MRhinoLoftCurve()
                                loftcurves(t).m_curve = 
curveTop.DuplicateCurve()
        
loftcurves(t).m_curve.RemoveShortSegments(OnUtil.On_ZERO_TOLERANCE,
True)
                                loftcurves(t).m_pick_point = New 
On3dPoint(OnUtil.On_UNSET_POINT)
                                loftcurves(t).m_pick_t = OnUtil.On_UNSET_VALUE
                                loftcurves(t).m_trim = Nothing
                                loftcurves(t).m_bClosed = 
loftcurves(t).m_curve.IsClosed()
                                loftcurves(t).m_bPlanar =
loftcurves(t).m_curve.IsPlanar(loftcurves(t).m_plane)
                        End If
                        If (curveBottom IsNot Nothing) Then
                                loftcurves(b) = New MRhinoLoftCurve()
                                loftcurves(b).m_curve = 
curveBottom.DuplicateCurve()
        
loftcurves(b).m_curve.RemoveShortSegments(OnUtil.On_ZERO_TOLERANCE,
True)
                                loftcurves(b).m_pick_point = New 
On3dPoint(OnUtil.On_UNSET_POINT)
                                loftcurves(b).m_pick_t = OnUtil.On_UNSET_VALUE
                                loftcurves(b).m_trim = Nothing
                                loftcurves(b).m_bClosed = 
loftcurves(b).m_curve.IsClosed()
                                loftcurves(b).m_bPlanar =
loftcurves(b).m_curve.IsPlanar(loftcurves(b).m_plane)
                        End If

                        args.m_loftcurves = loftcurves

                        'Do the loft operation
                        Dim surface_list(0) As OnNurbsSurface
                        Dim rc As Boolean = RhUtil.RhinoSdkLoftSurface(args, 
surface_list)

                        '  Assume 1 surface....
                        surf_list.Add(surface_list(0))


                Next
                A = surf_list



  End Sub
End Class


Reply via email to