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.
New FeatureScript: Spring Creator
Hi everyone,
I know I just posted the Plastic Thread FeatureScript about a week ago but I had an idea for a new script and came up with a working release version that I want to share with you all. The idea behind the new script is to make creating parameterized springs easy so you don’t have to do all the steps of making a spring from scratch. In attempting this, I found a huge amount of customization with springs, so there are a lot of inputs into the code, but even with all the customization right now extension and torsional springs are not possible directly from this script.
You can find the code here: Spring Creator
Features:
- Four spring wire cross sections available (circular, ovate, square, rectangular)
- Cylindrical and Conical Springs
- Five end styles (no end coil, partial coil, machined partial coil, multi-coil, machined multi-coil)
- Create mate connectors at each end for easy assembly
- Three end type selections (blind, up to face, up to vertex)
To make a spring you have two initial inputs, a Point or Circular Edge:
There are many options in the Spring Definition section including cylindrical vs conical springs, 4 different cross sections, different spring size definitions, number of coils, and adding mate connectors:
Next, you can change the end type and end style of the spring:
The length of the spring is always maintained no matter the end style so there is no need to compensate for them.
Also because this script is parameterized you can create multiple configurations of the same spring to define each position of its motion:
The main goal of this FeatureScript is to remove the need to download and import parts from manufacturers. Here’s an example of how the tool can recreate a real spring (specifically spring 9573K11 from McMaster-Carr) :
Limitations:
- Expansion springs are currently impossible to create in full with this code. You can get around this by using this code to make the base helix with a given profile and then adding hooks to the end.
- None of the end styles have a smooth transition from the center helix to the end so there is a kink and a tangent line shows up.
Future Updates:
- Expansion spring capability (probably a drop-down and then a list of end styles that can be selected specifically for expansion springs)
- Torsional spring capability (maybe just taking in a starting and ending axis or a starting axis and angle between them and then extruding the coils out in a straight line)
- Curved springs defined by an input path
- New selections including axis and cylinder/cone
You can find the code here: Spring Creator
I hope this is a useful enough code for everyone and if you have any questions or suggestions for me, let me know in the comments and I’ll respond as quickly as possible. Also, let me know if the functionality of which axis is chosen as the axis of the spring is intuitive. I didn't do too much work to make it feel intuitive but it will override the selected axis with whichever axis is needed to complete the "up to" end types.
Comments
Nice!
That looks awesome!
I agree with Eric, Nice!
This is really good. I've needed this from time to time.
Learn more about the Gospel of Christ ( Here )
CADSharp - We make custom features and integrated Onshape apps! cadsharp.com/featurescripts 💎
That's a cool feature script! Thanks a lot.
I do have a question regarding configurations. When I create different configurations each configuration gets another part number within the assembly. Any idea how to solve this if I want all the same springs in different configurations with the same part number?
Use the "exclude from properties" option on the configuration input.
It would be a lot to ask, but I've often thought that something like Spring Calculator or Advanced Spring Design could be ported to Onshape. Perhaps PTC could acquire it or something like it?
very nice!
thanks Eric. Sounds like a valid option.
Hey All,
I've been working on the torsion and tension spring additions to this script and I've finished with the torsion springs. I tried to make the leg definitions as customizable as possible to make them intuitive. If anyone has other types of definitions they would like to see I will look into adding them to an upcoming update. Also, the compression springs haven't been changed other than the wording of some end styles which are now the same as the names used on McMaster and other manufacturer sites.
You can find the new version here: Spring Creator
Torsion Spring Features:
Defining a torsion spring starts the same as defining a compression spring. Select a point, torsion spring shape, one of the wire cross-sections, and then define the spring's dimensions.
With the placement and the dimensions of the spring set, you can change the wire end style to define the second leg given a specific angle between, or select a central axis for both legs to be angled towards. You can even define both legs independently using any end style type.
Of course, you can still copy McMaster springs to make them configurable:
Another thing I wanted to show off was the fact that you can create a customizable variable to control the angle of the legs or the length of a compression spring. There's a small glimpse of the potential in the previous gif but one example of the power of these variables can be seen in the plier example below:
The ends of the legs can only be straight so if you want to add any bends you will need to add those after making the torsion spring. Regardless, they can still be fully parameterized with an angle variable. Also, I found defining both legs independently by axis from a sketch makes alignment in an assembly easier. Compression springs can also have a variable change their length.
I've also added a new informational naming system for the springs adding the diameter and height of the springs to the part name. For torsion springs the angle between the legs is also added. If this interferes with the part naming convention you or your organization uses you can always overwrite the name.
Torsion spring limitations:
You can find the new version here: Spring Creator
I'm still planning to finish this code by adding tension springs so you can make any type of spring you want with one feature script. I've also looked into the Spring Calculator or Advanced Spring Design programs and agree with @S1mon that adding a full spring designer to OnShape would be extremely useful. Of course, I'm just a solo developer so I don't have the time or expertise to incorporate features of that nature into this code. The goal of this code hasn't changed and I hope everyone finds it useful to make configurable compression and torsion springs.