Incorrect bolt sizes BoltFactory add-on #80648

Open
opened 2020-09-09 23:30:22 +02:00 by Alexandr Minakov · 5 comments

System Information
Operating system: Linux-5.6.0-2-amd64-x86_64-with-debian-10.5 64 Bits
Graphics card: GeForce GTX 960/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 440.100

Blender Version
Broken: version: 2.90.0, branch: master, commit date: 2020-08-31 11:26, hash: blender/blender@0330d1af29
Worked: (newest version of Blender that worked as expected)

Addon Information
Name: BoltFactory (0, 4, 0)
Author: Aaron Keith

Short description of error
The thread length is always less than the specified "Thread length".

Exact steps for others to reproduce the error
Go to side view, create a bolt. If you count on the grid, you will see that the length to the head is less than indicated in "Thread Length". In any preset. And in different presets this length will be different. And in the M12 preset it is generally difficult to use because of the "Shank Lenght" parameter, which spoils the overall length.
In the screenshot, I alternately chose the M * preset and set the length to 20mm.
Screenshot_20200910_002336.png

**System Information** Operating system: Linux-5.6.0-2-amd64-x86_64-with-debian-10.5 64 Bits Graphics card: GeForce GTX 960/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 440.100 **Blender Version** Broken: version: 2.90.0, branch: master, commit date: 2020-08-31 11:26, hash: `blender/blender@0330d1af29` Worked: (newest version of Blender that worked as expected) **Addon Information** Name: BoltFactory (0, 4, 0) Author: Aaron Keith **Short description of error** The thread length is always less than the specified "Thread length". **Exact steps for others to reproduce the error** Go to side view, create a bolt. If you count on the grid, you will see that the length to the head is less than indicated in "Thread Length". In any preset. And in different presets this length will be different. And in the M12 preset it is generally difficult to use because of the "Shank Lenght" parameter, which spoils the overall length. In the screenshot, I alternately chose the M * preset and set the length to 20mm. ![Screenshot_20200910_002336.png](https://archive.blender.org/developer/F8859335/Screenshot_20200910_002336.png)

Added subscriber: @Az3Dip

Added subscriber: @Az3Dip
Member

Added subscriber: @OmarEmaraDev

Added subscriber: @OmarEmaraDev
Member

Changed status from 'Needs Triage' to: 'Needs Developer To Reproduce'

Changed status from 'Needs Triage' to: 'Needs Developer To Reproduce'
Member

I can confirm that. But the actual thread length is a discrete multiple of the number of turns that are derived from the thread length given to the operation. So this may just be an expected result.

I can confirm that. But the actual thread length is a discrete multiple of the number of turns that are derived from the thread length given to the operation. So this may just be an expected result.

The incorrect bolt length is indeed due to the blender modelling, so that might be considered "expected", however it's not expected for a mechanical fixing. The length of a bolt should be the distance from the underside of the head to the tip - in the real world threads have fractional revolutions.

The error comes from this slightly clumsy line:
Num = int((HEIGHT - ((NUM_OF_START_THREADS * PITCH) + (NUM_OF_END_THREADS * PITCH))) / PITCH)
in Create_Thread_Verts.

The fix is rather easy if applied in: Create_External_Thread
Where Create_Thread_End_Verts is called the returned value Lowest_Z_Vert is the tip of the thread, this will be too short by some fraction of a pitch.

Before the verts.extend block of code is the place figure to what has been lost in the model creation vs the requested input, something like:
Mini_adder = Lowest_Z_Vert + SHANK_LENGTH + LENGTH
if Mini_adder < LENGTH * 0.01:
Mini_adder = 0 # Catches a very thin shim and also negative situations, worst case error is 1%
print("Bolt length is already perfect, length modulo number of thread pitch rotations!")

Three of verts.extend can be shifted down using the function Move_Verts_Up_Z - this has the effect of increasing the shank.
verts.extend(Move_Verts_Up_Z(Thread_Start_Verts, -Mini_adder) ) # Needs moving down by the mini_adder
verts.extend(Move_Verts_Up_Z(Thread_Verts, -Mini_adder) ) # Needs moving down by the mini_adder
verts.extend(Move_Verts_Up_Z(Thread_End_Verts, -Mini_adder) ) # Needs moving down by the mini_adder

Finally don't forget to change the return to include the new Z value:
return verts, faces, 0.0 - Lowest_Z_Vert + Mini_adder

The incorrect bolt length is indeed due to the blender modelling, so that might be considered "expected", however it's not expected for a mechanical fixing. The length of a bolt should be the distance from the underside of the head to the tip - in the real world threads have fractional revolutions. The error comes from this slightly clumsy line: ` Num = int((HEIGHT - ((NUM_OF_START_THREADS * PITCH) + (NUM_OF_END_THREADS * PITCH))) / PITCH) ` in Create_Thread_Verts. The fix is rather easy if applied in: Create_External_Thread Where Create_Thread_End_Verts is called the returned value Lowest_Z_Vert is the tip of the thread, this will be too short by some fraction of a pitch. Before the verts.extend block of code is the place figure to what has been lost in the model creation vs the requested input, something like: ` Mini_adder = Lowest_Z_Vert + SHANK_LENGTH + LENGTH` ` if Mini_adder < LENGTH * 0.01:` ` Mini_adder = 0 # Catches a very thin shim and also negative situations, worst case error is 1%` ` print("Bolt length is already perfect, length modulo number of thread pitch rotations!")` Three of verts.extend can be shifted down using the function Move_Verts_Up_Z - this has the effect of increasing the shank. ` verts.extend(Move_Verts_Up_Z(Thread_Start_Verts, -Mini_adder) ) # Needs moving down by the mini_adder` ` verts.extend(Move_Verts_Up_Z(Thread_Verts, -Mini_adder) ) # Needs moving down by the mini_adder` ` verts.extend(Move_Verts_Up_Z(Thread_End_Verts, -Mini_adder) ) # Needs moving down by the mini_adder` Finally don't forget to change the return to include the new Z value: ` return verts, faces, 0.0 - Lowest_Z_Vert + Mini_adder`
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#80648
No description provided.