WIP: Fix to ensure consistent bolt sizes regardless of the user's unit scale preference. #16

Draft
Ado wants to merge 4 commits from Ado/add_mesh_BoltFactory:scaling_fix into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
First-time contributor

Fix for #15

This change primarily addresses scaling "issues" or preferences. It now uses a calculated scale instead of the fixed scale defined by the GLOBAL_SCALE variable. Users working with the default scale for this addon will not notice any changes, as it will produce bolts at the "correct" size. For workflows using a scale of 0.001, the bolts will now also be correctly sized.

I've included a couple of pictures for reference. If any clarification is needed, please let me know. I hope this gets merged as soon as possible!

Summary of Changes:

  • All GLOBAL_SCALE calculations have been removed to simplify the code.
  • The unit='NONE' is set to "None" because Blender automatically scales UI menu values based on the unit system, which I wanted to avoid.
  • For now, all values are handled in millimeters (mm).
  • Labels like “Thread Length (mm)” are added to improve UI clarity.
  • I've added an option to create headless bolts. Often, I only need the thread itself to merge into my existing mesh, so this reduces the need to manually edit and remove the head afterward.

Added adjusted_scale Formula:

  • This ensures that meshes are generated at the correct size, regardless of the scene's unit scale. Bolts should now generate at their default sizes even when the scale is set to 1.0, 0.5, 0.001, or anything in between.
Fix for #15 This change primarily addresses scaling "issues" or preferences. It now uses a calculated scale instead of the fixed scale defined by the GLOBAL_SCALE variable. Users working with the default scale for this addon will not notice any changes, as it will produce bolts at the "correct" size. For workflows using a scale of 0.001, the bolts will now also be correctly sized. I've included a couple of pictures for reference. If any clarification is needed, please let me know. I hope this gets merged as soon as possible! Summary of Changes: - All GLOBAL_SCALE calculations have been removed to simplify the code. - The unit='NONE' is set to "None" because Blender automatically scales UI menu values based on the unit system, which I wanted to avoid. - For now, all values are handled in millimeters (mm). - Labels like “Thread Length (mm)” are added to improve UI clarity. - I've added an option to create headless bolts. Often, I only need the thread itself to merge into my existing mesh, so this reduces the need to manually edit and remove the head afterward. Added adjusted_scale Formula: - This ensures that meshes are generated at the correct size, regardless of the scene's unit scale. Bolts should now generate at their default sizes even when the scale is set to 1.0, 0.5, 0.001, or anything in between.
Ado added 4 commits 2024-11-20 20:42:37 +01:00
sw-tya reviewed 2024-11-21 21:59:46 +01:00
@ -170,2 +176,2 @@
min=0.001 * createMesh.GLOBAL_SCALE, soft_min=0, # limit to 0.001*createMesh.GLOBAL_SCALE to avoid calculation error
max=MAX_INPUT_NUMBER * createMesh.GLOBAL_SCALE,
name='Flat Dist (mm)', default=3.0,
min=0.001, soft_min=0, # limit to 0.001*createMesh.GLOBAL_SCALE to avoid calculation error
First-time contributor

"createMesh.GLOBAL_SCALE" not needed in the comment.

"createMesh.GLOBAL_SCALE" not needed in the comment.
sw-tya approved these changes 2024-11-21 23:02:16 +01:00
sw-tya left a comment
First-time contributor

I've tried with Blender 4.3 on LMDE and the changes work as advertised.
Note: Pending pull #13 adds new lines that contain GLOBAL SCALE around the correction of the thread/shank length - so there is a logic conflict which will need to be resolved in whichever lands second.
Thank you

I've tried with Blender 4.3 on LMDE and the changes work as advertised. Note: Pending pull #13 adds new lines that contain GLOBAL SCALE around the correction of the thread/shank length - so there is a logic conflict which will need to be resolved in whichever lands second. Thank you
This pull request is marked as a work in progress.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u scaling_fix:Ado-scaling_fix
git checkout Ado-scaling_fix
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
2 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: extensions/add_mesh_BoltFactory#16
No description provided.