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.

# BSplineCurve questions

Member Posts: 2,633 PRO
I noticed some things that seem to be inconsistent or incomplete in the documentation for BSplineCurve.

1. "For non-periodic curves with `n` control points, you may provide the full set of `n + degree + 1` knots, or you may provide `n - degree + 1` knots, and multiplicity will by padded onto the ends (which has the effect of clamping the spline to its two endpoints)." It seems like this has to be n + degree + 1 or it fails.
2. In theory a B-Spline can be a series of G0 or even G-1 connected curves, but OpCreateBSplineCurve requires "The spline must have dimension of 3 and be G1-continuous." I honestly don't have much use for G0 or G-1 B-Splines, but I wonder why this was left out.
3. BSplineCurve allows a dimension of 2, so what is that used for if OpCreateBSplineCurve requires a dimension of 3?

Tagged:

• Member Posts: 131 PRO
Even sketch based b spline curves are dimension 3.   Dimension 2, as far as I have seen, are for bSplineSurface boundary B spline curves and internal loops which are just a series of u v parameters from what I understand. 2D b spline curves just always have the points on a common plane.

So  opCreateBSplineCurve requires G1 (or higher) because 2 g0 curves would create a vertex but not have one. If enough knots were padded at these "vertices", then sure, it would look like a sharp point, however, it would not be which would likely cause downstream issues with the CAD engine (assumption).

Does this make sense? I hope so, I have trouble even explaining it......

What are you trying to create?
Are you trying to create G2, G3 or higher order continuous curves? You can go as high as 17 (i believe in onshape) but it will take a long time to regenerate.
Are you trying to combine multiple bSplineCurves into one?

I am rambling. But i hope some of this makes sense.
• Member Posts: 2,633 PRO
@Jacob_Corder

Yes. Some of this makes sense. Thanks.

"2 g0 curves would create a vertex but not have one" - I guess this is similar to the fact that Onshape (and other CAD systems) will not let you create cusps in the middle of a sketch spline or Bézier.

I'm currently working on combining several Béziers into one B-Spline - which I have managed to do with 3 X degree-4 curves. Ultimately, yes I'm trying to create G3 or higher joints.  I know how to do that with Béziers and arcs or Béziers and lines - which in this particular case is all I need.

I was also just playing around with the underlying control points and knots to see where things fall apart and was noticing some things which didn't seem 100% consistent. I still don't know why the "or you may provide `n - degree + 1` knots, and multiplicity will be padded onto the ends (which has the effect of clamping the spline to its two endpoints)" seems to be incorrect. It's not a huge deal, since I can add zeros and ones to the ends myself.
• Member Posts: 131 PRO
S1mon. They just pad it for you, you do not need to pad it, it will just make the start and end points not be on the spline as you stated, however, you can specify non multiplicity start and ends if you want. it would just mean that the spline will not touch the start or end control points.

n + degree + 1 knots is required by all b spline curves.

fyi , the knots do not need to be in the range 0 to 1,  0 and 1 are just easy to use. they can be -2000 to 2000 if you want.  Padding will just duplicate the first and last points degree.
• Member Posts: 2,633 PRO
@Jacob_Corder

Thanks!

I tried very carefully again, and  `n - degree + 1` worked (it padded the knots as advertised). I guess I must of counted wrong or something.

fyi , the knots do not need to be in the range 0 to 1,  0 and 1 are just easy to use. they can be -2000 to 2000 if you want.  Padding will just duplicate the first and last points degree.

I tried this. It works as you suggested. It does make it easier to write with certain ratios. With both of these hints I was able to go from:

[0, 0, 0, 0, 0, 0, 0, 0, 1/3, 1/3, 1/3, 1/3, 1/3, 1/3, 1/3, 2/3, 2/3, 2/3, 2/3, 2/3, 2/3, 2/3, 1, 1, 1, 1, 1, 1, 1, 1]

to:

[0, 1/3, 1/3, 1/3, 1/3, 1/3, 1/3, 1/3, 2/3, 2/3, 2/3, 2/3, 2/3, 2/3, 2/3, 1]

to:

[0, 7, 7, 7, 7, 7, 7, 7, 14, 14, 14, 14, 14, 14, 14, 21]

which makes much more sense to my brain.