3 Replies Latest reply on Jan 30, 2016 5:33 PM by Artem Taturevych

    How to properly create a multi-patch b-spline surface

    Toon Huysmans

      We usually create a single patch b-spline with the following steps:

       

      Dim body = part.ICreateNewBody2()
      Dim surface = body.ICreateBsplineSurface(props, uknots, vknots, B_spline_data)
      surface.AddTrimmingLoop2(nCurves, Order, [Dim], Periodic, nKnots, nCtrlPts, Knots2, CtrlPts, UVRange)
      body.CreateBodyFromSurfaces()
      

       

      This works fine for a single patch. It is however not clear to me how to create a body with multiple patches. The following approach results in an Exception:

       

      Dim body = part.ICreateNewBody2()
      
      Dim surface1 = body.ICreateBsplineSurface(props1, uknots1, vknots1, B_spline_data1)
      surface1.AddTrimmingLoop2(nCurves1, Order1, [Dim1], Periodic1, nKnots1, nCtrlPts1, Knots21, CtrlPts1, UVRange1)
      
      Dim surface2 = body.ICreateBsplineSurface(props2, uknots2, vknots2, B_spline_data2)
      surface2.AddTrimmingLoop2(nCurves2, Order2, [Dim2], Periodic2, nKnots2, nCtrlPts2, Knots22, CtrlPts2, UVRange2) '<-- thows Exception from within the API
      
      body.CreateBodyFromSurfaces()
      

       

      Such an appraoch should work fine for planar surfaces (CreatePlanarSurface) cfr the API example here:

       

      2015 SOLIDWORKS API Help - Create Body using Trimmed Surfaces Example (VBA)

       

      Any ideas, how to properly build a multi-patch b-spline surface in solidworks?

       

      Many thanks.

       

      Toon.