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

**First time visiting? Here are some places to start:**

- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- 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

S1mon
Member Posts:

**1,986**PRO
I noticed some things that seem to be inconsistent or incomplete in the documentation for BSplineCurve.

- "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. - 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.
- BSplineCurve allows a dimension of 2, so what is that used for if OpCreateBSplineCurve requires a dimension of 3?

Tagged:

0

## Comments

114PROSo 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.

1,986PROYes. 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.114PROn + 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.

1,986PROThanks!

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.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

muchmore sense to my brain.