Dear Discussion,
Has anyone successfully created a sweep 1 with a vb.net node in GH?  I have tried but get some error " ... Attempted to read or write to protected memory....".  I have taken a look at the vb.net examples on the rhino website but cant seem to understand why it takes a 100 lines of code to extrude a profile along a path, so its hard for me to follow.  I know am not the best coder, but I'm trying.  This is the code I have put together based on others attempts:  
    revised:
   Private Sub RunScript(ByVal rail As OnCurve, ByVal section As OnCurve, ByRef A As Object) 
    'create sweep arguments
    Dim args As New MArgsRhinoSweep1
    'create arravy of sections, this is the required format to feed the sweep arguments
    Dim sArray() As OnCurve = {section}
    'create polyedge, this is the required format to feed the sweep arguments
    Dim edge As New MRhinoPolyEdge()
    edge.create(rail.DuplicateCurve())
    'Add rails to sweep arguments
    args.m_rail_curve = edge.Duplicate()
    args.m_bClosed = True
    'Add sections to sweep arguments
    args.m_shape_curves = sArray
    args.m_simplify = 0 
    args.m_rebuild_count = -1 'Sample point count for rebuilding shapes
    args.m_refit_tolerance = RMA.Rhino.RhUtil.RhinoApp.ActiveDoc.AbsoluteTolerance()
    args.m_sweep_tolerance = RMA.Rhino.RhUtil.RhinoApp.ActiveDoc.AbsoluteTolerance()
    args.m_angle_tolerance = RMA.Rhino.RhUtil.RhinoApp.ActiveDoc.AngleToleranceRadians()
    Dim sBreps()As OnBrep = Nothing
    Dim Sweep1 As New List(Of OnBrep)
    If (RhUtil.RhinoSweep1(args, sBreps)) Then
      For Each b As OnBrep In sBreps
        Sweep1.Add(b)
      Next
    End If
    A = Sweep1
                
             
         
                    Tags: