0 Replies Latest reply on Aug 28, 2015 5:24 AM by Vadim Vadim

    Create boundary b-spline surface, SolidWorks C#

    Vadim Vadim

      Hello all. I'm working with plug-in for SolidWorks at C#. One of options - create boundary surface (plane) from b-spline curves. How i can do it, without sketches ??
      Code for creating b-splines:

       

              public Curve Create(IPartDoc part, double width)
              {
                  Body2 body = part.ICreateNewBody2();
                  List<double> points = new List<double>();
                  double step = width / Constants.FRAGMENTATION;
      
      
                  for (int i = 0; i <= Constants.FRAGMENTATION; i++)
                  {
                      double radius = Zr(i * step);
                      points.Add(i * stepX);
                      points.Add(i * stepY);
                      points.Add(radius);
                  }
      
      
                  Curve spline = body.AddProfileBsplineByPts(points.Count / 3, points.ToArray()) as Curve;
      
      
                  return spline;
              }
      

       

      Zr - simple function F(X).