Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,11 @@ The internal_data and external_data list properties define the radius of the Thr


#### Release notes:<br/>
* 2025.05.03 (version 1.96)<br/>
* Show final minir and major diameters after applying tolerance
* 2025.05.02 (version 1.95)<br/>
* Accept PR from vovodroid to add major diameter and tolerance properties
* minor diameter is automatically calculated from major diameter and vice versa if you change either
* minor diameter is automatically calculated from major diameter and vice versa if you change either or pitch
* tolerance is used to adjust the diameter +/- to change the fit
* 2025.04.18 (version 1.94)<br/>
* Fix issue due to changes to Draft workbench in FreeCAD 1.1 dev, no longer need getParam so remove import
Expand Down
28 changes: 20 additions & 8 deletions ThreadProfileCmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
__title__ = "ThreadProfile"
__author__ = "Mark Ganson <TheMarkster>"
__url__ = "https://github.com/mwganson/ThreadProfile"
__date__ = "2025.05.02"
__version__ = "1.95"
version = 1.95
__date__ = "2025.05.03"
__version__ = "1.96"
version = 1.96

import FreeCAD, FreeCADGui, Part, os, math, re
from PySide import QtCore, QtGui
Expand Down Expand Up @@ -70,7 +70,9 @@ def __init__(self, obj):
obj.addProperty("App::PropertyBool","MakeFace","ThreadProfile",QT_TRANSLATE_NOOP("App::Property","Create a face if this spline is closed"))
obj.addProperty("App::PropertyArea","Area","ThreadProfile",QT_TRANSLATE_NOOP("App::Property","The area of this object"))
obj.addProperty("App::PropertyLength", "MinorDiameter", "ThreadProfile", QT_TRANSLATE_NOOP("App::Property", "The minor diameter of the thread"))
obj.addProperty("App::PropertyLength", "MinorDiameterFinal", "ThreadProfile", QT_TRANSLATE_NOOP("App::Property", "The minor diameter of the thread with tolerance"))
obj.addProperty("App::PropertyLength", "MajorDiameter", "ThreadProfile", QT_TRANSLATE_NOOP("App::Property", "The major diameter of the thread"))
obj.addProperty("App::PropertyLength", "MajorDiameterFinal", "ThreadProfile", QT_TRANSLATE_NOOP("App::Property", "The major diameter of the thread with tolerance"))
obj.addProperty("App::PropertyFloat", "d_delta", "ThreadProfile", QT_TRANSLATE_NOOP("App::Property", ""))
obj.addProperty("App::PropertyFloat", "Tolerance", "ThreadProfile", QT_TRANSLATE_NOOP("App::Property", "The tolerance of the thread. It will be added to diameters"))
obj.addProperty("App::PropertyFloatList","internal_data","ThreadProfile",QT_TRANSLATE_NOOP("App::Property", "Data used to construct internal thread"))
Expand Down Expand Up @@ -123,6 +125,8 @@ def __init__(self, obj):
obj.setEditorMode("ThreadCount",1)
obj.setEditorMode("preset_names", 2)
obj.setEditorMode("presets_data", 2)
obj.setEditorMode("MinorDiameterFinal", 1)
obj.setEditorMode("MajorDiameterFinal", 1)
obj.setEditorMode("d_delta", 2)
obj.MakeFace = True
obj.Closed = True
Expand Down Expand Up @@ -202,6 +206,8 @@ def makePoints(self, obj):

obj.d_delta = max_diam - minor_diameter
obj.MajorDiameter = max_diam - obj.Tolerance
obj.MinorDiameterFinal = obj.MinorDiameter.Value + obj.Tolerance
obj.MajorDiameterFinal = obj.MajorDiameter.Value + obj.Tolerance

return points

Expand All @@ -219,11 +225,17 @@ def handleThreadCountChange(self, fp, prop):
inobj.Spine = [helix,edgeNames]

def onDocumentRestored(self, obj):
if obj.Version < 1.95:
obj.addProperty("App::PropertyLength", "MajorDiameter", "ThreadProfile", QT_TRANSLATE_NOOP("App::Property", "The major diameter of the thread"))
obj.addProperty("App::PropertyFloat", "Tolerance", "ThreadProfile", QT_TRANSLATE_NOOP("App::Property", "The tolerance of the thread. It will be added to diameters"))
obj.addProperty("App::PropertyFloat", "d_delta", "ThreadProfile", QT_TRANSLATE_NOOP("App::Property", ""))
obj.setEditorMode("d_delta", 2)
if not hasattr(obj, "MajorDiameter") or not hasattr(obj, "MajorDiameterFinal"):
if not hasattr(obj, "MajorDiameter"):
obj.addProperty("App::PropertyLength", "MajorDiameter", "ThreadProfile", QT_TRANSLATE_NOOP("App::Property", "The major diameter of the thread"))
obj.addProperty("App::PropertyFloat", "Tolerance", "ThreadProfile", QT_TRANSLATE_NOOP("App::Property", "The tolerance of the thread. It will be added to diameters"))
obj.addProperty("App::PropertyFloat", "d_delta", "ThreadProfile", QT_TRANSLATE_NOOP("App::Property", ""))
obj.setEditorMode("d_delta", 2)
if not hasattr(obj, "MajorDiameterFinal"):
obj.addProperty("App::PropertyLength", "MinorDiameterFinal", "ThreadProfile", QT_TRANSLATE_NOOP("App::Property", "The minor diameter of the thread with tolerance"))
obj.addProperty("App::PropertyLength", "MajorDiameterFinal", "ThreadProfile", QT_TRANSLATE_NOOP("App::Property", "The major diameter of the thread with tolerance"))
obj.setEditorMode("MinorDiameterFinal", 1)
obj.setEditorMode("MajorDiameterFinal", 1)
self.makePoints(obj)

def onChanged(self, fp, prop):
Expand Down
4 changes: 2 additions & 2 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package format="1" xmlns="https://wiki.freecad.org/Package_Metadata">
<name>ThreadProfile</name>
<description>ThreadProfile object for creating internal/external threads</description>
<version>1.95</version>
<version>1.96</version>
<date>2025.05.02</date>
<maintainer email="mwganson@gmail.com">TheMarkster</maintainer>
<license file="LICENSE">LGPL-2.1</license>
Expand All @@ -15,7 +15,7 @@
<name>ThreadProfile</name>
<classname>ThreadProfileWorkbench</classname>
<description>ThreadProfile object for creating internal/external threads</description>
<version>1.95</version>
<version>1.96</version>
<subdirectory>./</subdirectory>
<icon>Resources/icons/ThreadProfileLogo.svg</icon>
<freecadmin>0.19.0</freecadmin>
Expand Down