All Projects → mwganson → ThreadProfile

mwganson / ThreadProfile

Licence: LGPL-2.1 license
Create 2d thread profile for sweeping along helix in Part or Part Design workbenches

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to ThreadProfile

MarzWorkbench
FreeCAD Workbench for guitar design
Stars: ✭ 40 (+166.67%)
Mutual labels:  addons, freecad, workbench
Rocket
FreeCAD Rocketry Workbench
Stars: ✭ 29 (+93.33%)
Mutual labels:  addons, freecad, workbench
CurvedShapesWorkbench
FreeCAD Workbench for creating 3D shapes from 2D curves
Stars: ✭ 49 (+226.67%)
Mutual labels:  addons, freecad, workbench
Lattice2
FreeCAD workbench about arrays of all sorts and kinds, and local coordinate systems
Stars: ✭ 40 (+166.67%)
Mutual labels:  freecad, workbench
grass-addons
GRASS GIS Addons Repository (Manuals: https://grass.osgeo.org/grass-stable/manuals/addons/ | Linux-logs: https://grass.osgeo.org/addons/grass8/logs/ | Windows logs: https://wingrass.fsv.cvut.cz/grass82/addons/grass-8.2.0/logs/)
Stars: ✭ 64 (+326.67%)
Mutual labels:  addons
snorkel
Snorkel - Bootstrap your Data Science
Stars: ✭ 24 (+60%)
Mutual labels:  workbench
addon-home-panel
Home Panel - Home Assistant Community Add-ons
Stars: ✭ 164 (+993.33%)
Mutual labels:  addons
FenicsSolver
multiphysics FEM solver based on Fenics library
Stars: ✭ 52 (+246.67%)
Mutual labels:  freecad
BadRotations CN
这个插件是在尽量不动badrotations的情况下进行汉化,支持9.x,有兴趣star一下吧
Stars: ✭ 13 (-13.33%)
Mutual labels:  addons
FreeCAD Conda
conda recipes for freecad and dependencies of freecad
Stars: ✭ 35 (+133.33%)
Mutual labels:  freecad
VSE Transform Tools
Quickly transform, crop and fade video strips in Blender's Video Sequence Editor
Stars: ✭ 195 (+1200%)
Mutual labels:  addons
flowwie-freecad
Flowwie's FreeCAD ressources for everybody to learn computer aided design with the Open Source CAD software FreeCAD.
Stars: ✭ 214 (+1326.67%)
Mutual labels:  freecad
addon-zwavejs2mqtt
Z-Wave JS to MQTT - Home Assistant Community Add-ons
Stars: ✭ 68 (+353.33%)
Mutual labels:  addons
ESOLinuxAddonManager
[MIRROR] Elder Scrolls Online addon downloader, for Linux! Check the link below for the development repo which has the releases and issuetracker.
Stars: ✭ 25 (+66.67%)
Mutual labels:  addons
FreeCAD-Lithophane
FreeCAD Workbench to convert an image to a Lithophane for 3D Printing
Stars: ✭ 20 (+33.33%)
Mutual labels:  freecad
addon-tailscale
Tailscale - Home Assistant Community Add-ons
Stars: ✭ 47 (+213.33%)
Mutual labels:  addons
addon-tor
Tor - Home Assistant Community Add-ons
Stars: ✭ 37 (+146.67%)
Mutual labels:  addons
FC-Docker
Project to run FreeCAD in a cloud environment accessible via a web browser in a cloud environment.
Stars: ✭ 40 (+166.67%)
Mutual labels:  freecad
DesignSPHysics
Module for FreeCAD intended to use with DualSPHysics fluid simulator.
Stars: ✭ 65 (+333.33%)
Mutual labels:  freecad
repository-beta
BETA - Home Assistant Community Add-ons
Stars: ✭ 25 (+66.67%)
Mutual labels:  addons

ThreadProfile Workbench

icon

Toolbar Icon

Download the SVG Toolbar Icon

Installation

Can be installed via the AddonManager in Tools menu -> AddonManager if you have a very recent build. Open the AddonManger. Click the Configure icon. Add this to the custom repositories section: https://github.com/mwganson/ThreadProfile Close and restart the AddonManager. You should now see ThreadProfile listed in the Workbench tab.

Overview

Use the 2d profile object created with this workbench to create threads by sweeping it along a helix of the appropriate height and pitch. It is compatible for use in both the Part and Part Design workbenches in FreeCAD. To use in Part Design if there is an active body the ThreadProfile object will be created inside the body. Then select the ThreadProfile object and click the Make Helix toolbar icon to create a helix. A new shapebinder will be created linking the helix, and the helix will be hidden. You can then sweep it as you would a sketch using either the Additive Pipe (for external threads) or the Subtractive Pipe (for internal threads). In Part workbench you would use the Sweep tool, which would then need to be cut (if an internal thread) from a suitable object, such as an extruded hexagon.

Advantages

There are a number of advantages to using ThreadProfile objects in your threads:

  • It's quicker and easier than sketching your own traditional thread profile.
  • It's possible to make custom threads of any desired diameter and pitch, including ANSI, such as 1/4" 20 TPI.
  • All of the threads I've made so far in testing have passed Check Geometry with BOP Check enabled.

Details

The ThreadProfile object is really just a glorified rebranded Draft BSpline object. In fact, the template code for producing it was unabashedly copied directly from the Draft workbench for use as a starting point, which I then modified to meet my needs. In particular, the necessary properties, such as Pitch and Minor Diameter were added, along with the code necessary to produce the desired BSpline object.

Create V thread profile Command

create object
This creates the V thread ThreadProfile object with default properties. Create it first, and then set the desired properties in the data tab of the combo view. There are a number of presets available, but you should double-check these by taking a cross-section of both parts to check the fit, then adjust the minor diameter accordingly. If there is an active Part Design Body, the object will be placed inside it. Failing that, if there is an active Part container the object will be placed into that.

New for v1.75 there is a Variants property in V thread types (hidden for other types) that allows 4 options: "60" -- the standard v thread, "45" -- a non-standard experimental 45 degree variant hopefully more 3D printer friendly, "2-Start" -- a 2-start v thread, and "3-Start" a 3-start v thread. (Variants was previously called "Angle" in v1.74, so any objects created with that version will probably be broken and will need to be rebuilt.)

Create Buttress thread profile Command

create object
This creates the Buttress thread ThreadProfile object with default properties. Create it first, and then set the desired properties in the data tab of the combo view. If there is an active Part Design Body, the object will be placed inside it. Failing that, if there is an active Part container the object will be placed into that.

These are ANSI B1.9-1973 (R2007), Class 2 -- Standard Grade, 7 degree / 45 degree flat-rooted buttress threads. (Class 3 -- Precision Grade would have 2/3 the tolerance of these for a tighter fit.) The tolerance is based on a thread length engagement of 10 threads. Shorter engagements could use a tighter fit and still work, longer engagements might require more tolerance. You can adjust the tolerance by adjusting the minor diameter after selecting one of the presets. Make the external minor diameter larger and the internal minor diameter smaller if you want a tighter fit, and vice versa for a looser fit.

There are other diameter / pitch combinations in the standard than are provided in the presets. The ones provided are only the recommended combinations. You can set the minor diameter and pitch to any values you want, but you'll need to work out the tolerances for yourself.

Create Bottle thread profile Command

create bottle object
This creates a bottle thread object (SP4xx M type) 45 degree / 10 degree buttress thread.

Make Helix Command

make helix
The Make Helix command creates a Helix and sets its Pitch property to match the Pitch property of the ThreadProfile object. This property is linked parametrically, thus any change to the ThreadProfile.Pitch property will also cause the Helix.Pitch property to update itself. We also set the Helix.Height property to ThreadProfile.Pitch * ThreadProfile.ThreadCount, thus ensuring the Helix.Height property is such that the thread produced in the sweep will have Thread Count threads. This is also parametrically linked. As of v1.70 the helix will be attached to the object the thread profile is attached to via expressions. That way if you attach the thread profile to something else after creating the helix the helix will also attach itself to the same object in the same map mode.

If there exists an active Part Design body when the helix is created, then the helix will be placed in the active body. This seems to work fine, so no more need for adding a shapebinder.

Do Sweep Command

do sweep
The Do Sweep command will perform the sweep for you. To use it you must first select the ThreadProfile object to sweep and the helix to sweep it along, then activate the command either from the toolbar or menu.

If a helix is selected, then the operation performed is a Part workbench Sweep, with solid = True and Frenet = True. This happens even if there is an active body and even if the ThreadProfile object is in the active body. If there is an active body, then an AdditivePipe is performed unless the InternalOrExternal property is set to "Internal", in which case the Part Design Subtractive Sweep is used.

Be wary of coplanar issues when cutting internal threads out of existing material. If the Cut (or SubtractivePipe) seems to have failed it could be because of the issues FreeCAD has with coplanar boolean operations. The solution for this is to move either the base object or the cutting tool slightly.

Open Online Calculator Command

open online calculator
Opens on online calculator for the metric sizes or for the ANSI UN and UNR inch sizes or for the ANSI Buttress sizes in the default browser. It is possible (I think) that FreeCAD might not have permission to do this. If so, then it will likely fail. Use the calculator to get the minor diameter for the thread you wish to make. For inch sizes, the 2A and 2B tolerances are for the normal fit. For Buttress threads class 2 is normal, class 3 is tighter fit. For metric size v threads the 6g tolerance is for normal fit. Typically there will be 2 minor diameters to select from: a minimum and a maximum. If you make the internal thread a little bit smaller the fit will be tighter. If you make the external thread a little bit smaller the fit will be looser. A good way to check the fit is to make the nut and the screw at the same time, then use the Part workbench cross-section tool to check the fit.

Parameterization Property

This property can change the shape of the threadprofile object. If you are not satisfied with the looks of the threads when viewed up close after zooming in, you can try modifying this property to see what difference it makes. Default is 1.0. It's value can range from 0.0 to 1.0.

Quality Property

The ThreadProfile object appears at first glance to be a simple circle, but it's not. As mentioned above, it's a BSpline. Think of it as a circle with a varying radius around the circumference. For every degree there are 2 points used to define the curve, 720 points in all. Quality 2 profiles use only every other point, in other words 360 points or 1 point per degree. Quality 3 uses only every 3rd point, and so on, up to 12 Quality settings at this time. Previously I thought Quality 1 was always better because there were more points defining the curve, but counter-intuitively this is not the case. More is not always better. I've set new defaults for this property for the different profile types. Examine your threads up close by zooming in. If they appear rough try experimenting with different Quality values.

Pitch Property

This is the pitch for the thread. You also need to set this in the Helix Pitch property. If you wish to make ANSI threads, such as 1/4-20, for example, you would set this value to 25.4/20 if you are in mm units or 1/20 if you are using inch units. I keep FreeCAD in mm units, so I would use 25.4/20 for the Pitch for that thread.

Minor Diameter

This is the minor diameter of your thread. This is NOT the nominal diameter. You need to look this value up and use the one for your desired nominal diameter, pitch, and fit tolerance. Here are links to online calculators for Unified Inch Screwthreads, Metric, and for ANSI Buttress

Continuity

What is this? This is a property of the underlying BSpline object. This is readonly and is only included for informational purposes. Normally, this should be C2 continuity. You can read more about smoothness here.

Height

This is the height of the sweep object (in mm). Adjusting this adjusts the ThreadCount property to set the height.

Version

This is the version of the ThreadProfile workbench used to create the ThreadProfile object, not the version of the ThreadProfile workbench currently installed.

Thread Count

When a Helix is created using the Make Helix command the Height property of the Helix is set to a height such that Thread Count number of threads will be created. As of v1.77 this is now readonly. Use the Height property instead.

Presets

These are some presets I added to version 1.30 (likely to be expanded some in future versions). I'm not entirely sure how accurate the data is. Do not blindly rely on it. You should still lookup the minimum and maximum minor diameters for your desired fit tolerance. If you are modeling both the internal and the external threads for a project it is a good idea to take cross sections of both so you can inspect the fit on the screen.

FAQ

  • When zooming in close the thread surface looks very rough. What can be done about this?
    ** I believe this only affects the way the object appears on the screen. Here are some things you can do to try to improve the appearance. Switch to the view tab of the sweep object (or body if in Part Design) and adjust the Deviation property to something like 0.1. The Angular Deflection property might also have an effect. This should smooth the surface rendering, but at the expense of longer processing times. Check the Quality property of the ThreadProfile object and see if changing that up or down can help the appearance. Check the Parameterization property and try different settings for it, for example, 0.25 instead of 1.0.
  • Why is there a line running up the thread?
    ** There are actually multiple lines. One is is the BSpline's seamline. If you Pad / Extrude the profile you can see this seamline as a straight edge, similar to what you see in cylinders and extruded / padded circles. The others are the seamlines from the helix.

* My internal threads are always external. What am I doing wrong?
** Use subtractive pipe in Part design to cut the internal thread out of an existing shape, e.g. a Pad. In Part workbench use the Sweep object as a cutting tool to cut it out of an existing shape, e.g. an extruded hexagon. (Ensure you have selected "Internal" in the "Internal Or External" ThreadProfile property when making internal threads.)
* Is it possible to access this via Python scripting?
** Yes. Use:

import ThreadProfileCmd
ThreadProfileCmd.ThreadProfileCreateObjectCommandClass().makeThreadProfile()
or
ThreadProfileCmd.ThreadProfileCreateButtressObjectCommandClass().makeButtressThreadProfile()

Parameters:
name="BThreadProfile",internal_data = internal_buttress_data, external_data = external_buttress_data, presets = buttress_presets_data,minor_diameter=buttress_presets_data[13][2],pitch=25.4/10,internal_or_external="External",thread_count=10
name is the name of the ThreadProfile object created.
internal_data, external_data, presets are lists that could be used to create a custom profile type.
minor_diameter is the minor diameter (we don't use nominal, only minor). To calculate minor diameter this code is used:

        def cd(txt, tpi, nominal): #cd = calculate diameters
            pitch = 25.4/tpi
            length_of_engagement = 10 * pitch #10 * pitch, longer engagements should have more tolerance
            nom = nominal * 25.4
            minor = nom - 0.66271 * pitch
            tolerance = 0.002 * (nom)**(1/3) + .00278 * length_of_engagement**(1/2) + 0.00854 * pitch**(1/2)
            return[txt, pitch, minor - tolerance, minor + tolerance]

The internal_data and external_data list properties define the radius of the ThreadProfile object at the various angles around the circumference. There are 720 points. Each point is the x-coordinate of a thread profile sketched on the xz plane. The first element in the list is the x-coordinate at z=1/720 degrees, then z=2/720 degrees, etc. Don't worry, you don't need to include these parameters. The default used is for the standard Metric M profile. When the ThreadProfile is created the data points are used as such: each element is taken, then added to it the minor radius + pitch * element value for the x-coordinate. To get the y-coordinate we use the current element index / 720. We use the math.cos() and math.sin() functions, but let's not get too bogged down here. You can view the source code for more details.

Release notes:

  • 2022.01.30 (version 1.80)
  • link helix attachment offset property to threadprofile's attachment offset property
  • 2021.11.30 (version 1.77)
  • bug fix in calculating thread count from height
  • 2021.10.17 (version 1.77)
  • add Height property, set ThreadCount to readonly ** if you still want to use ThreadCount you can do so in the python console. Select thread profile, Ctrl+Shift+P to send to the console. Enter in the console: obj.ThreadCount = 10. It can still also be used in expressions, such as in a spreadsheet cell.
  • 2021.10.17 (version 1.76)
  • fix bug related to helix height
  • 2021.10.17 (version 1.75)
  • Support 2-start and 3-start v threads
  • 2021.10.07 (version 1.74)
  • Support nonstanard 45 degree V threads for 3D printing
  • 2021.10.01 (version 1.73)
  • notify user in report view if update is available
  • 2021.09.02 (version 1.72)
    ** Expose Parameterization property for user editing. This property can change the shape of the threads. Default: 1.0. Range of values: 0.0 to 1.0.
  • 2021.09.02 (version 1.71)
    ** bug fix -- generated threads were failing check geometry with self-intersections ** Change Quality defaults for the different thread types.
  • 2021.08.25 (version 1.70)
    ** add * in front of current setting in settings dialog ** remove shapebinders in part design and just put the helix in the body ** on creating helix attach it to the same object the thread profile is attached to ** if link helix parametrically is set (the default) the helix attachment will be linked to the thread profile attachment via expressions
  • 2021.03.16 (version 1.69)
    ** more bug fix work on Thread Count parameter
  • 2021.03.03 (version 1.68)
    ** fix bug where changing Thread Count parameter was not updating Sweep object properly
  • 2021.03.03 (version 1.67)
    ** accept galou's PR to use our own tr
  • 2020.08.27 (version 1.66)
    ** fix bug in ThreadCount property not updating Sweep object ** fix bug in PartDesign where sometimes Part Sweep was used even if there was active body
  • 2020.08.04 (version 1.65)
    ** switch to svg icons
  • 2020.07.30 (version 1.64)
    ** make subtractive pipe visible in dialog for external threads
  • 2020.07.16 (version 1.63)
    ** maintenance update to fix error related to recent FreeCAD update
  • 2020.07.16 (version 1.62)
    ** fix bug where only shell was being created ** make external bottle threads 0.25mm smaller minor diameter
  • 2020.07.16 (version 1.61)
    ** improve continuity of bspline to C3 (was C2) ** should improve quality of finished sweep object
  • 2020.07.15 (version 1.60)
    ** add bottle thread buttress (SP4xx M type) 45/10 degree thread support
  • 2019.08.22 (version 1.51)
    ** fix spelling errors
  • 2019.08.02 (version 1.50)
    ** Add sweep tool
  • 2019.08.01 (version 1.42)
    ** Fix python2 bug related to creating buttress threads ** Fix bug in presets
  • 2019.08.01 (version 1.41)
    ** Fix bug where presets were not working after restarting and reloading file
  • 2019.07.31 (version 1.41)
    ** Add online buttress calculator link
  • 2019.07.31 (version 1.40)
    ** Add Buttress thread support
  • 2019.07.27 (version 1.31)
    ** Helix placement now linked parametrically to ThreadProfile placement, can be disabled in settings.
  • 2019.07.25 (version 1.30)
    ** Added presets ** Changed variable to reflect there are 719 (not 720) points used to make the ThreadProfile BSpline
  • 2019.07.23 (version 1.23)
    ** If there is an active part design body when the helix is created, make a shapebinder for it and hide the helix ** Put the helix into the active Part container if one exists
  • 2019.07.23 (version 1.22)
    ** If there is an active part design body or Part object, add the thread profile to it.
  • 2019.07.23 (version 1.21)
    ** Change Pitch type from Float to Length ** Check if Gui is up before creating view object ** Recompute document before returning object from makeThreadProfile() ** Fix bug where if more than one helix is made we set the correct helix properties
  • 2019.07.22 (version 1.20)
    ** Add link to online calculators
  • 2019.07.22 (version 1.10)
    ** Add Make Helix command
    ** Add Thread Count property
  • 2019.07.22 (version 1.0)
    ** initial release
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].