Loft, SweepX etc. are very difficult to use in the Rhino4 SDK. We've
hired a programmer to write wrapper functions for Rhino5, but until
then, you're stuck with it.
Just to humour you, I pasted the code from the Sweep2 component below:

--
David Rutten
da...@mcneel.com
Robert McNeel & Associates




    Protected Overrides Sub SolveInstance(ByVal iData As
IEH_DataAccess)
      Dim cRail1 As EH_Curve = Nothing
      Dim cRail2 As EH_Curve = Nothing
      Dim cSections As New List(Of EH_Curve)
      Dim sameheight As Boolean = False

      If (Params.Input(2).VolatileDataCount = 0) Then
        MyBase.AddRuntimeMessage(EH_RuntimeMessageLevel.Warning,
"Insufficient sweep sections defined")
        Return
      End If

      If (Not iData.GetData(Of EH_Curve)(0, cRail1)) Then Return
      If (Not iData.GetData(Of EH_Curve)(1, cRail2)) Then Return
      If (Not iData.GetDataList(Of EH_Curve)(2, cSections)) Then
Return
      If (Not iData.GetData(Of Boolean)(3, sameheight)) Then
sameheight = False

      If (Not cRail1.LoadGeometry()) Then
        MyBase.AddRuntimeMessage(EH_RuntimeMessageLevel.Error, "First
rail curve geometry failed to load")
        Return
      End If

      If (Not cRail2.LoadGeometry()) Then
        MyBase.AddRuntimeMessage(EH_RuntimeMessageLevel.Error, "Second
rail curve geometry failed to load")
        Return
      End If

      If (cSections.Count = 0) Then Return

      Dim sArgs As New MArgsRhinoSweep2

      'Setup rail
      Dim cPEdgeRail1 As New MRhinoPolyEdge
      Dim cPEdgeRail2 As New MRhinoPolyEdge
      cPEdgeRail1.Append(cRail1.Curve.DuplicateCurve())
      cPEdgeRail2.Append(cRail2.Curve.DuplicateCurve())

      If (Not cPEdgeRail1.IsValid()) Then MyBase.AddRuntimeMessage
(EH_RuntimeMessageLevel.Error, "MRhinoPolyEdge1 is invalid")
      If (Not cPEdgeRail2.IsValid()) Then MyBase.AddRuntimeMessage
(EH_RuntimeMessageLevel.Error, "MRhinoPolyEdge2 is invalid")

      If (cPEdgeRail1.IsClosed() Xor cPEdgeRail2.IsClosed()) Then
        MyBase.AddRuntimeMessage(EH_RuntimeMessageLevel.Error, "Rail
curves must either both be open or closed")
        Return
      End If

      sArgs.m_rail_curves(0) = cPEdgeRail1
      sArgs.m_rail_curves(1) = cPEdgeRail2
      sArgs.m_bClosed = cPEdgeRail1.IsClosed()

      'Setup sections
      Dim SectionCurves As New List(Of OnCurve)

      For Each Section As EH_Curve In cSections
        If (Section Is Nothing) Then Continue For

        If (Not Section.LoadGeometry()) Then
          MyBase.AddRuntimeMessage(EH_RuntimeMessageLevel.Warning,
"Section curve geometry failed to load")
        Else
          Dim sCurve As OnCurve = Section.Curve.DuplicateCurve
          SectionCurves.Add(sCurve)

          Dim ta, tb, d As Double
          Dim p As Int32
          Component_Sweep1Surface.CurveCPCP_Simple(sCurve,
cPEdgeRail1, ta, tb, d, p)
          If (p > 20) Then MyBase.AddRuntimeMessage
(EH_RuntimeMessageLevel.Warning, p & " iterations were required to
find the section/rail cp param")
          sArgs.m_rail_params(0).Append(tb)

          Component_Sweep1Surface.CurveCPCP_Simple(sCurve,
cPEdgeRail2, ta, tb, d, p)
          If (p > 20) Then MyBase.AddRuntimeMessage
(EH_RuntimeMessageLevel.Warning, p & " iterations were required to
find the section/rail cp param")
          sArgs.m_rail_params(1).Append(tb)
        End If
      Next

      If (SectionCurves.Count = 0) Then
        MyBase.AddRuntimeMessage(EH_RuntimeMessageLevel.Warning,
"Insufficient section curves could be constructed")
        Return
      End If

      sArgs.m_shape_curves = SectionCurves.ToArray

      'Setup parameters
      sArgs.m_angle_tolerance =
RMA.Rhino.RhUtil.RhinoApp.ActiveDoc.AngleToleranceRadians
      sArgs.m_simplify = 0 'Don't rebuild, don't refit
      sArgs.m_bSimpleSweep = False
      sArgs.m_bSameHeight = sameheight

      Dim brep_out() As OnBrep = Nothing
      If (RhUtil.RhinoSweep2(sArgs, brep_out)) Then
        If (brep_out Is Nothing) Then
          MyBase.AddRuntimeMessage(EH_RuntimeMessageLevel.Error,
"Sweep2 operation failed")
        Else
          iData.SetDataList(0, brep_out)
        End If
      Else
        MyBase.AddRuntimeMessage(EH_RuntimeMessageLevel.Error, "Sweep2
operation failed")
      End If
    End Sub

Reply via email to