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.

New FeatureScript: Spring Creator

william_knoblauchwilliam_knoblauch Member Posts: 7
edited October 4 in FeatureScript

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

  • eric_pestyeric_pesty Member Posts: 1,877 PRO

    Nice!
    That looks awesome!

  • MichaelPascoeMichaelPascoe Member Posts: 1,979 PRO

    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!   Learn How to FeatureScript Here 🔴
  • Urs_Egger_REACTUrs_Egger_REACT Member Posts: 87 PRO

    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?

  • eric_pestyeric_pesty Member Posts: 1,877 PRO

    Use the "exclude from properties" option on the configuration input.

  • S1monS1mon Member Posts: 2,964 PRO
    edited October 8

    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?

  • jelte_steur814jelte_steur814 Member Posts: 182 PRO

    very nice!

  • Urs_Egger_REACTUrs_Egger_REACT Member Posts: 87 PRO
Sign In or Register to comment.