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: Plastic Threads

william_knoblauchwilliam_knoblauch Member Posts: 9
edited September 2024 in FeatureScript

Hi everyone,

I've recently been messing around with FeatureScript and decided to make a thread feature for 3D-printed plastic parts. The general concept came from the ThreadCreator script written by David Cowden almost 8 years ago. His script works really well and has even more configurability than mine but I wanted to tap into a more specific market than his captures. This FeatureScript aims to create internal and external threads that can be printed and immediately threaded together with little to no post-processing.

You can find the FeatureScript here Plastic Thread. The document has many examples as well as the full code base. If you have any comments or concerns please leave them below.

Features:

  • Automatic pitch definition for basic threads with optional user input
  • Only one thread type: ANSI Standard (Could add more in the future if there is demand)
  • Internal and External Threads
  • Multi-start threads for ease of assembly
  • Left/Right handed threads
  • Configurable threaded length
  • Mate point for easy mating of assemblies
  • Precalculated thread tolerance for easy threading given no post-processing

Please don't use this to create threads for metal bolts or other metal parts you want to machine. I cannot ensure the threads work with CNC or metal 3D-printed parts.

To create threads, simply provide a cylindrical face representing the major diameter of an external thread or the minor diameter of an internal thread:

From there many options can be configured from the number of starts to the handedness of the thread, and the thread length. Create a mate point to easily add a mate connector to the center of the thread for use in an assembly.

If you have a bolt and a nut you can easily select both and create the same threads on each in one step.

The tolerance between both internal and external threads is handled right away by the script:

A function predetermines the tolerances and a tighter version of this function can be selected.

Some limitations associated with this FeatureScript are:

  • Only one thread profile type. Even from Dave's Thread Creator script, there is no difference between the ANSI and ISO standard profiles (other than the naming convention).
  • No tolerance input meaning you cannot change the backlash of the threads. Currently, a log function determines the tolerance and has 2 versions a default "loose" tolerance and an optional "tight" tolerance. The "loose" tolerance function is designed to work at any diameter and ensure the parts thread together even with a lower-quality print with a poor surface finish.
  • Major/minor diameter input. I would like to add this in a future update
  • No starting or ending chamfer inputs. Chamfers are predetermined by their location and the number of thread starts.
  • Lead in input. (I don't find it useful enough for a 3D-printed part because it doesn't have to follow machining conventions. Also don't you just want your threads to end where you wanted them to)
  • Intelligent feature naming. I couldn't figure out how to add a nice name to the feature when it was created so I didn't and instead, there is an option to show the pitch of the threads in a message.
  • Thread clocking. I haven't added this yet. Let me know if it would be useful and I'll add it to my feature requests.

I have some additions in mind to make the script either more configurable or more robust.

Possible Future Additions:

  • Major, and minor diameter inputs to control every dimension and aspect of the threads.
  • Lead in functionality to make the threads prettier and maybe stronger.
  • Partially threaded internal threads (I don't know what use this would have right now).
  • Intelligent feature naming to make seeing the pitch easier.
  • Thread clocking to move the start of the thread relative to the rest of the part.

You can find the FeatureScript here Plastic Thread. The document has many examples as well as the full code base. If you have any comments or concerns please leave them below.

Comments

  • S1monS1mon Member Posts: 3,204 PRO

    I haven't actually had the need in a while, but one thing I could see is handling standard plastic bottle threads. They have a particular thread form and start/end which is a result of the keyway style cutters used to make the injection mold tools.

    Here's a link to an older version of the standard.

  • MichaelPascoeMichaelPascoe Member Posts: 2,122 PRO

    Dope! Ty


    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   Learn How to FeatureScript Here 🔴
  • william_knoblauchwilliam_knoblauch Member Posts: 9

    I forgot to add the link to the post.

    Plastic Threads

  • william_knoblauchwilliam_knoblauch Member Posts: 9

    @S1mon,

    It shouldn't be too hard to add the profile but the start/end will be fairly difficult to get parameterized. How do you normally model the start and end of those threads? Do you use a loft from the blunt end of the threads into the cylinder or is there another method you use?

  • S1monS1mon Member Posts: 3,204 PRO

    @william_knoblauch

    The ends are revolved to simulate the diameter of the cutter. I'm not sure what the typical cutter diameters are, but I think I may have stumbled on some spec drawings at some point with this info.

  • kenn_sebesta167kenn_sebesta167 Member Posts: 85 ✭✭

    I like this!

    Two issues which arise as I use it:

    1. It complains when the layer resolution isn't quite fine enough for the requested thread. That's good to have some feedback, but as things stand there are two improvements I would ask for: 1) don't elevate the issue to a failure. It's not great to see red in the feature tree, and this wouldn't seem to be that critical. 2) If the script knows what the max acceptable layer size is, it should communicate that to the user, as otherwise the user will have to guess to find the right layer size
    2. There's some kind of weird overrun issue I'm seeing when I choose a cylinder to thread. You can see in the below screenshot where the selected area is the cylinder in orange, but it knocks out a huge cone from the part (removed sections in transparent). This is a showstopper, and I can't seem to find a workaround in the part studio.

    A feature request would be to be able to choose multiple holes in one operation. It clutters up the feature tree to have a thread operation for each and every hole which needs to be threaded. And because a print truly needs every threaded hole to be threaded in the CAD, the ThreadCreator approach of only threading symbolic holes doesn't translate well.

  • william_knoblauchwilliam_knoblauch Member Posts: 9

    Hey @kenn_sebesta167,

    Thanks for the comment and recommendations. I'm sorry I didn’t get back to you sooner. I haven’t looked at the forums in a little while.

    I changed the layer thickness error to show up as a tooltip and to show the “correct” layer thickness. Of course, by “correct” layer thickness I mean the layer thickness ensuring that a single layer captures the flat section of the thread profile. This is an estimation of what would work and in my experience, it prevents tiny threads from printing with too little detail/resolution.

    The error you are getting with the cone removing geometry from your part is an oversight on my part in testing. That is the chamfer cone cutting the chamfer on the threads at the exit of the hole. The chamfer cone should scale with the pitch of the threads to not interfere with the rest of the part but in that circumstance, it was not scaling correctly. I have fixed the error so you can thread the hole without it cutting into any other section of the part.

    I also updated the script to allow for many hole and stud selections. The main reason for holding off before was to prevent users from creating 10+ threaded holes/studs and then lagging the part studio until it is unusable. I realize now that kind of “hand-holding” really isn’t necessary and everyone is smart enough to figure out that this is a pretty heavy feature script to run if you have multiple starts or really fine pitch threads. The script is actually quite optimized but the predominant bottleneck for performance is the sweep and union functions which each can take hundreds of milliseconds to solve (When you add up ten 200 ms sweeps you're waiting for 2 seconds just for the part studio to load).

    One last thing, in the picture you uploaded you selected a threaded M3 hole and I wanted to let you know that this script was not designed to interface with any standardized threads. If you want to, the hole/stud size needs to be the same diameter as the external thread of the corresponding bolt. So for an M3 screw to thread in, the hole would need to be 3 mm and the pitch 0.5 mm. External threads act like a die and cut into the cylinder while internal threads add material to match the external threads given the same diameter. This means that internal and external threads from the same diameter cylinders match and thread together.

    With these changes, I updated the UI so it is easier to see how the more advanced features expand the functionality. I hope you can finally use this feature script how you initially desired. Let me know if you have any more issues so I can resolve them.

    You can find the new version here (Plastic Thread) or you can just update the feature in your tool bar in any part studio.

Sign In or Register to comment.