# Style Spline: What is it and why is it useful?

Hi everyone, I just wanted to take some time to introduce you to the new Style Spline in SolidWorks 2014. You’re probably wondering what makes it different from our current spline, and why it may be useful to you.

**What is it?**

The new Style Spline actually isn’t something new in the world of CAD. It’s an entity that’s been around for a long time, but is sometimes overlooked. It’s called a Bézier curve. Although this type of curve is commonly referred to as a “spline”, it’s actually something a little different from the spline we currently offer in SolidWorks, which can be classified as a B-Spline.

The math that that goes into calculating a Bézier curve uses a single polynomial called the Bernstein Polynomial. The curve is defined by the position of control vertices, or CV’s as they’re commonly called. Together they form the control polygon, or hull of the curve. Along the curve, there are no through points like you see on our current spline, therefore it is considered “single span”. The degree of the curve, or order of the underlying polynomial, depends on how many control points there are.

The more control points, the higher degree of the curve and more complex you can make its shape. By looking at the control polygon, the degree of the curve is always equal to the number of CV’s-1.

B-Splines on the other hand use multiple polynomials to achieve their shape, and are a generalization of multiple curves. I like to think of a B-Spline as a series of overlapping curves. The regions in between each through point are called spans, so it is possible to have multiple spans. The user can also weight the tangency and control the vector at each through point. What this means is that a B-Spline is capable of making very complex curves very easily. If you show the control polygon on our B-Spline (via RMB on the spline), things aren’t as straight forward as the Bézier curve. The degree and number of generalized curves that make up the overall shape is not controlled by the user, but rather by an algorithm that adjusts depending on how much control the user requests of the curve. This can vary since you can apply curvature constraints at the endpoints, and can use the spline handles at each through point.

Note as you pull on spline handles and apply constraints at the endpoints, the control polygon adds new CVs. This is to accommodate the extra degrees of freedom the user is requesting.

Both curves have their advantages and disadvantages within a CAD system, and that’s what I’m about to explain in the next section. However simply put, a Bézier curve is simpler than a B-Spline. This diagram is a good visual of the curves we offer in SolidWorks, in order of increasing flexibility, as well as mathematical complexity.

**Why is it useful?**

So what does all this mean? The intent of the Style Spline is not to replace anything that we currently offer, but to provide something better suited to handle a variety of jobs. As you just learned, the math involved is easier than a B-Spline, but more complex than a conic. Therefore it’s just another tool in your chest, and it’s all about knowing when you want to use it and why.

Here are the main points as to why this curve is useful to a CAD user:

The only way to control a Bézier curve is by manipulating its CV’s. In fact, right now it’s the only way to sketch the curve in SolidWorks, by sketching a series of points. To make the CV’s more useful when it comes to shaping or constraining the curve, we add construction lines in between each CV during curve creation. Therefore, controlling this curve is as simple as controlling a series of lines. This is something that every SolidWorks user is familiar with. Users can drag a CV in any direction to change the shape of the curve, or drag a construction line to drag two CV’s at once. Also, since this curve is basically controlled by lines, it can easily be mirrored. Shaping the seed or the mirrored instance is very easy to do.*Control:*

Also, this curve can be symmetric on itself by simply applying symmetric relations to the CV’s around a center line.

Constraining the curve is very simple since, again, it’s as easy as constraining a bunch of points and lines. Dimensions and relations may also help in shaping the curve, and makes it possible to configure its shape, control it with equations, etc.

Our B-Spline on the other hand has a few controls to help shape the curve. These controls are very powerful of course, and can help the B-Spline quickly achieve some very complex shapes; however these controls can sometimes be the downfall of the curve. Spline handles are very useful, but they’re not natural to the curve. They are something that most systems implement to help users shape the curve, however there’s some overhead going on the in the background. Once you begin pulling on handles at different points of the curve, its putting more degrees of freedom on the curve, and it can quickly become awkward since there’s a lot of math occurring. Although it’s a great way to quickly achieve shape, this can sometimes lead to undesirable or confusing behavior, or make the curve difficult to constrain. Our current spline also has the ability to be shaped by its control polygon as well; however this is something that cannot be referenced. Meaning, you cannot constrain the polygon sides or CV’s in any way.

Shaping the Style Spline is very intuitive and easy to do. One difference from that of a B-Spline is that adjusting the CV locations to shape the curve is not as “local”, meaning that each CV has a wider influence over the curve on a Bézier curve. This is why a B-Spline is better suited for creating tight curves. However, one area where the B-Spline can fall short is maintaining continuity. As a user shapes a B-Spline, especially if they are using spline handles, curvature continuity across each through point can become interrupted. If a smooth curve is important to you, and your shape is not very complex, then the Style Spline is the way to go. A good comparison would be to create the same shape using each curve and its available controls. Once you’re finished, turn on the curvature combs and inspect the curves. Then attempt to further shape each curve and note the result on the curvature combs. The curvature of the Style Spline will always be more smooth and continuous. In fact, it’s pretty hard to get any abrupt change in curvature on a Bézier curve.**Continuity:**

Finally, another reason why the Style Spline curve might be better suited for the job is due to quality. As mentioned previously, the math is easier, the degrees of freedom are pretty straight forward, and constraining it is fast and easy. Therefore it has the potential to be less prone to problems. If a B-Spline was used to create geometry that isn’t too complex, you may end up paying the price due to the fact that there are probably more degrees of freedom on the curve than necessary to get that shape. Therefore, you may end up in a situation where the curve is prone to inflections due to changes upstream. This is why a Bézier curve makes a great bridge curve in most situations. Also, constraining it is as simple as constraining a bunch of lines, there aren’t handle weights or angles to worry about, therefore it’s easier on the solver.**Quality:**

**Behaviors:**

There are some additional behaviors to know about this new curve in SolidWorks. These are all intended to help the user shape the curve faster and easier.

First, when sketching the curve, which is done by its CVs, it is not only possible to infer tangency at the first endpoint, but you can also infer Equal Curvature. The first CV sketched, which is the curve’s first endpoint, controls the first degree of curvature called contact. This is also called G0 continuity. The 2^{nd} CV controls the 2^{nd} degree of curvature, which is tangency, also called G1 continuity. The 3^{rd} CV controls the 3^{rd} degree of curvature, or Equal Curvature, also called G2 continuity. Therefore you will see a 2^{nd} inference line when sketching the 3^{rd} CV of the curve. If you snap to it, an Equal Curvature constraint will be applied at that endpoint once the curve is complete. No other curve in SolidWorks can do this currently.

If the Style Spline terminates on the endpoint of another entity, hold down Alt as you double click to end the curve in order to automatically apply a tangent relation at that endpoint. Otherwise it will be coincident if you don’t hold down Alt. Note if you want Equal Curvature at that endpoint, you will still need to apply this manually.

When sketching the curve, we do not automatically create relations between the CVs and other geometry in your sketch or model. The only exception is at the endpoints of the curve. The reason is because of the fact your sketching the curve by its CVs, the final shape you end up with most likely will not be final. The CVs need to be free so the user can drag them to further shape the curve. If you want to, you can manually constrain the CVs after the curve has been completed. You can do this with relations, dimensions or both. You can also constrain the lines between the CVs, and put relations on each.

When dragging CVs to shape the curve, if you do not want to snap them to other geometry in your model, hold down control when dragging. This will prevent the CV from inadvertently getting locked down over a vertex, or edge, in the background.

Once you’re finished creating the curve, you can still adjust the degree of the curve. By doing this, you are adding or removing control. This can be done via a spinbox in the Property Manager, or manually by adding (via RMB command) or deleting CVs one at a time on the polygon. Please note that if any CV (other than endpoints) is constrained in any way, we do not allow the user to use the spinbox in the Property Manager. It will be grayed out. This is due to the fact that the curve may jump abruptly since all the CVs are not free to adjust in order to maintain shape. In this case, you may still control curve degree manually by deleting or adding CVs via the RMB menu command.

There is a setting in the PM called “Local edit”. This setting is intended to aid the user when working with multiple Style Splines that are all connected, yet not fully constrained. You may have one or two larger curves that represent the primary surfaces on your model. Connected to those curves may be additional, smaller curves that represent the secondary surfaces in your model. There are times that when shaping the smaller, secondary curves, you do not want it to change the shape of the larger curves. Therefore, by enabling the Local edit setting on a particular Style Spline, it will prevent any CV adjustments from affecting other Style Splines it is connected to. One limitation with this option currently is that it only works between Style Splines, not other curves.

This curve works in 3D Sketch as well. Creating it in 3D is easy and works the same way as creating a series of lines. Also, when dragging CVs to shape the curve, I like to use the 3D triad to do this. You can assign a hotkey to the triad to speed up your workflow.

So go ahead, try it out and let us know what you think.

Thanks,

Rob

Want to learn more about SolidWorks or get a hands-on trial? Complete the form below to get started.