Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

b-spline in sketches with featurescript?

EvanReeseEvanReese Member, Mentor Posts: 2,135 ✭✭✭✭✭
I'm working on a feature that creates a single b-spline, but I'd like the output to be sketch geometry. Is there a way? I know I can do a bezier, but the b-spline I'm after is a 3-span and I don't want the seams between the 3 beziers.
Evan Reese

Answers

  • Jacob_CorderJacob_Corder Member Posts: 137 PRO
    Why do you need it to be sketch geometry?

    Sketch geometry is the base for curves, it would be going backwards.  If you want it to be a b spline on a plane, then just make sure all control points are on a common plane. Use project(plane,point) and that will make it basically 2D.

    You can take any number of b spline curves and if tangent to each other, combine them into a single curve. Sadly I cannot share that code with you, I can tell you that it is possible, complicated but not too complicated.

    Do not use parameterization on a path because the output will be wrong, you need to use the control points only. also, the connection points between 2 curves must be g1 meaning that the  control points next to the connection control point need to be inline with the connection point and each other. I hope this makes sense. 

  • S1monS1mon Member Posts: 2,982 PRO
    We already have this working as a curve. We’re trying to understand if other flavors of B-splines are possible as sketch objects. 

    In a way, one of the real problems is hiding and showing sketches vs curves is a very different UI/UX. Features which use sketch faces also don’t work with closed collections of curves. 
  • EvanReeseEvanReese Member, Mentor Posts: 2,135 ✭✭✭✭✭
    Thanks, Jacob. In addition to what Simon says. I prefer sketch entities because:
    • You get the faces (regions) for free - If we're doing a solid extrude or loft after, we'd have to make a new sketch a "use" the curve. The feature might produce other geometry in addition to just the curve.
    • Sketches imply a direction - when using loft I can use "normal to profile" and with fill I can set it to tangent to get a similar result.
    • Sketches indicate planarity - With a sketch you know it's planar, but if I just see a curve I'd need to dig into how it was made to be sure. For anyone knows, they know the curve could be made with bridging curve or some other method, and may not be planar. Now I know our feature will only put out planar curves if we want, but there's nothing to signal that to other users other than trust or experience. Sketch geometry is communicative here.
    • Sketches are more intuitive - If I could make this feature as a new tool in the sketcher (just like sketch fillet), I would, but since that's not an option, I want it to feel as much like a sketch as possible.
    Evan Reese
  • Jacob_CorderJacob_Corder Member Posts: 137 PRO
    This is not a perfect way of doing it, but you might be able to get away with just using the knots(these are parameters) of the bsplineCurve, but make sure their range is 0 to 1. If knots are not 0 to 1, then normalize them the same way a vector is normalized.
    Then use those knot values in evEdgeTangentLines, do not use arc length parameterization. The results are the points needed for fit splines.  The start and end derivatives are going to be the harder part to determine how skFitSpline accepts them. For reference, the start and end derivatives for Fit Spline are the base point of the onshape Fit Spline arrow manipulators. These are the first and end control points in the bSplineCurve.

    I hope this helps a little, but it probably won't, I am just sharing some info I discovered during testing.
     
  • S1monS1mon Member Posts: 2,982 PRO
    @Jacob_Corder

    Thanks.

    However, the critical piece of information left out of this question is that we're working with degree 7 B-splines (with 3 spans). As far as I know the Onshape sketch spline is only degree-3.
  • Jacob_CorderJacob_Corder Member Posts: 137 PRO
    @S1mon, Yeah, that does make it not work. There is no way to make a higher level sketch curve that I am aware of.   
Sign In or Register to comment.