diff --git a/README.md b/README.md index 0fc0908..6dff115 100644 --- a/README.md +++ b/README.md @@ -128,9 +128,11 @@ The internal_data and external_data list properties define the radius of the Thr #### Release notes:
+* 2025.05.03 (version 1.96)
+* Show final minir and major diameters after applying tolerance * 2025.05.02 (version 1.95)
* 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)
* Fix issue due to changes to Draft workbench in FreeCAD 1.1 dev, no longer need getParam so remove import diff --git a/ThreadProfileCmd.py b/ThreadProfileCmd.py index 81e9238..2784d22 100644 --- a/ThreadProfileCmd.py +++ b/ThreadProfileCmd.py @@ -29,9 +29,9 @@ __title__ = "ThreadProfile" __author__ = "Mark Ganson " __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 @@ -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")) @@ -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 @@ -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 @@ -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): diff --git a/package.xml b/package.xml index 582b030..5d0feb6 100644 --- a/package.xml +++ b/package.xml @@ -2,7 +2,7 @@ ThreadProfile ThreadProfile object for creating internal/external threads - 1.95 + 1.96 2025.05.02 TheMarkster LGPL-2.1 @@ -15,7 +15,7 @@ ThreadProfile ThreadProfileWorkbench ThreadProfile object for creating internal/external threads - 1.95 + 1.96 ./ Resources/icons/ThreadProfileLogo.svg 0.19.0