View Issue Details

IDProjectCategoryView StatusLast Update
0004812FreeCADPatchpublic2021-12-25 13:14
ReporterFrank_Schruefer Assigned To 
PrioritynormalSeveritytrivialReproducibilityalways
Status newResolutionopen 
Product Version0.20 
Summary0004812: Using custom threads in fasteners ScrewTab generates variable used before assigned exception
DescriptionHy, I have a path for a trivial bug in the fasteners workbench code.
Without it the use of custom thread diameters and pitch won't work.
Steps To Reproduce-Choose fasteners Workbench
-Create 'Add threaded Rod for tapping holes'
-Change 'diameter' to 'Custom'
-Change 'diameter Custom' and 'pitch Custom'
Additional InformationPatch created via:
stone@merlin:~/.local/share> diff -c FreeCAD/Mod/fasteners/screw_maker.py.orig FreeCAD/Mod/fasteners/screw_maker.py

Diff output:
*** FreeCAD/Mod/fasteners/screw_maker.py.orig 2021-12-22 00:43:13.164645112 +0100
--- FreeCAD/Mod/fasteners/screw_maker.py 2021-12-22 00:44:23.605517538 +0100
***************
*** 3792,3798 ****
      else: # custom pitch and diameter
        P = customPitch
        if self.sm3DPrintMode:
! dia = self.smNutThrScaleA * dia + self.smNutThrScaleB
        else:
          dia = customDia
      residue, turns = math.modf((l)/P)
--- 3792,3798 ----
      else: # custom pitch and diameter
        P = customPitch
        if self.sm3DPrintMode:
! dia = self.smNutThrScaleA * customDia + self.smNutThrScaleB
        else:
          dia = customDia
      residue, turns = math.modf((l)/P)
***************
*** 3831,3837 ****
      else: # custom pitch and diameter
        P = customPitch
        if self.sm3DPrintMode:
! dia = self.smScrewThrScaleA * dia + self.smScrewThrScaleB
        else:
          dia = customDia
      if self.rThread:
--- 3831,3837 ----
      else: # custom pitch and diameter
        P = customPitch
        if self.sm3DPrintMode:
! dia = self.smScrewThrScaleA * customDia + self.smScrewThrScaleB
        else:
          dia = customDia
      if self.rThread:
***************
*** 3870,3876 ****
      else: # custom pitch and diameter
        P = customPitch
        if self.sm3DPrintMode:
! dia = self.smScrewThrScaleA * dia + self.smScrewThrScaleB
        else:
          dia = customDia
      dia = dia*1.01
--- 3870,3876 ----
      else: # custom pitch and diameter
        P = customPitch
        if self.sm3DPrintMode:
! dia = self.smScrewThrScaleA * customDia + self.smScrewThrScaleB
        else:
          dia = customDia
      dia = dia*1.01
TagsNo tags attached.
FreeCAD InformationOS: openSUSE Tumbleweed (KDE//usr/share/xsessions/plasma5)
Word size of FreeCAD: 64-bit
Version: 0.20.26651 (Git) AppImage
Build type: Release
Branch: (HEAD detached at d357d52)
Hash: d357d524d97db884b9bb562415e6b6d782ec02b4
Python version: 3.9.7
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.5.3
Locale: German/Germany (de_DE)

Activities

Frank_Schruefer

2021-12-25 13:14

reporter   ~0016130

P.S.: Forgot to mention that in order to reproduce the bug the 'Thread generation' option in the fasteners workbench settings must be set to '3D printer compatible'.

Issue History

Date Modified Username Field Change
2021-12-25 12:54 Frank_Schruefer New Issue
2021-12-25 13:14 Frank_Schruefer Note Added: 0016130