Fix #83322: Scale factor issue #105397
@ -27,7 +27,7 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
||||
bl_description = "Construct many types of Bolts"
|
||||
|
||||
|
||||
MAX_INPUT_NUMBER = 50
|
||||
MAX_INPUT_NUMBER = 50 # mm
|
||||
|
||||
|
||||
Bolt : BoolProperty(name = "Bolt",
|
||||
default = True,
|
||||
@ -83,39 +83,39 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
||||
bf_Shank_Length: FloatProperty(
|
||||
attr='bf_Shank_Length',
|
||||
name='Shank Length', default=0,
|
||||
min=0, soft_min=0, max=MAX_INPUT_NUMBER,
|
||||
min=0, soft_min=0, max=MAX_INPUT_NUMBER*createMesh.GLOBAL_SCALE,
|
||||
description='Length of the unthreaded shank',
|
||||
unit='LENGTH',
|
||||
)
|
||||
bf_Shank_Dia: FloatProperty(
|
||||
attr='bf_Shank_Dia',
|
||||
name='Shank Dia', default=3,
|
||||
name='Shank Dia', default=3*createMesh.GLOBAL_SCALE,
|
||||
min=0, soft_min=0,
|
||||
max=MAX_INPUT_NUMBER,
|
||||
max=MAX_INPUT_NUMBER*createMesh.GLOBAL_SCALE,
|
||||
description='Diameter of the shank',
|
||||
unit='LENGTH',
|
||||
)
|
||||
bf_Phillips_Bit_Depth: FloatProperty(
|
||||
attr='bf_Phillips_Bit_Depth',
|
||||
name='Bit Depth', default=1.1431535482406616,
|
||||
name='Bit Depth', default=1.1431535482406616*createMesh.GLOBAL_SCALE,
|
||||
min=0, soft_min=0,
|
||||
max=MAX_INPUT_NUMBER,
|
||||
max=MAX_INPUT_NUMBER*createMesh.GLOBAL_SCALE,
|
||||
description='Depth of the Phillips Bit',
|
||||
unit='LENGTH',
|
||||
)
|
||||
bf_Allen_Bit_Depth: FloatProperty(
|
||||
attr='bf_Allen_Bit_Depth',
|
||||
name='Bit Depth', default=1.5,
|
||||
name='Bit Depth', default=1.5*createMesh.GLOBAL_SCALE,
|
||||
min=0, soft_min=0,
|
||||
max=MAX_INPUT_NUMBER,
|
||||
max=MAX_INPUT_NUMBER*createMesh.GLOBAL_SCALE,
|
||||
description='Depth of the Allen Bit',
|
||||
unit='LENGTH',
|
||||
)
|
||||
bf_Allen_Bit_Flat_Distance: FloatProperty(
|
||||
attr='bf_Allen_Bit_Flat_Distance',
|
||||
name='Flat Dist', default=2.5,
|
||||
name='Flat Dist', default=2.5*createMesh.GLOBAL_SCALE,
|
||||
min=0, soft_min=0,
|
||||
max=MAX_INPUT_NUMBER,
|
||||
max=MAX_INPUT_NUMBER*createMesh.GLOBAL_SCALE,
|
||||
description='Flat Distance of the Allen Bit',
|
||||
unit='LENGTH',
|
||||
)
|
||||
@ -137,131 +137,131 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
||||
)
|
||||
bf_Torx_Bit_Depth: FloatProperty(
|
||||
attr='bf_Torx_Bit_Depth',
|
||||
name='Bit Depth', default=1.5,
|
||||
name='Bit Depth', default=1.5*createMesh.GLOBAL_SCALE,
|
||||
min=0, soft_min=0,
|
||||
max=MAX_INPUT_NUMBER,
|
||||
max=MAX_INPUT_NUMBER*createMesh.GLOBAL_SCALE,
|
||||
description='Depth of the Torx Bit',
|
||||
unit='LENGTH',
|
||||
)
|
||||
bf_Hex_Head_Height: FloatProperty(
|
||||
attr='bf_Hex_Head_Height',
|
||||
name='Head Height', default=2,
|
||||
min=0, soft_min=0, max=MAX_INPUT_NUMBER,
|
||||
name='Head Height', default=2*createMesh.GLOBAL_SCALE,
|
||||
min=0, soft_min=0, max=MAX_INPUT_NUMBER*createMesh.GLOBAL_SCALE,
|
||||
description='Height of the Hex Head',
|
||||
unit='LENGTH',
|
||||
)
|
||||
bf_Hex_Head_Flat_Distance: FloatProperty(
|
||||
attr='bf_Hex_Head_Flat_Distance',
|
||||
name='Flat Dist', default=5.5,
|
||||
name='Flat Dist', default=5.5*createMesh.GLOBAL_SCALE,
|
||||
min=0, soft_min=0,
|
||||
max=MAX_INPUT_NUMBER,
|
||||
max=MAX_INPUT_NUMBER*createMesh.GLOBAL_SCALE,
|
||||
description='Flat Distance of the Hex Head',
|
||||
unit='LENGTH',
|
||||
)
|
||||
bf_12_Point_Head_Height: FloatProperty(
|
||||
attr='bf_12_Point_Head_Height',
|
||||
name='Head Height', default=3.0,
|
||||
min=0, soft_min=0, max=MAX_INPUT_NUMBER,
|
||||
name='Head Height', default=3.0*createMesh.GLOBAL_SCALE,
|
||||
min=0, soft_min=0, max=MAX_INPUT_NUMBER*createMesh.GLOBAL_SCALE,
|
||||
description='Height of the 12 Point Head',
|
||||
unit='LENGTH',
|
||||
)
|
||||
bf_12_Point_Head_Flat_Distance: FloatProperty(
|
||||
attr='bf_12_Point_Head_Flat_Distance',
|
||||
name='Flat Dist', default=3.0,
|
||||
min=0.001, soft_min=0, #limit to 0.001 to avoid calculation error
|
||||
max=MAX_INPUT_NUMBER,
|
||||
name='Flat Dist', default=3.0*createMesh.GLOBAL_SCALE,
|
||||
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,
|
||||
description='Flat Distance of the 12 Point Head',
|
||||
unit='LENGTH',
|
||||
)
|
||||
bf_12_Point_Head_Flange_Dia: FloatProperty(
|
||||
attr='bf_12_Point_Head_Flange_Dia',
|
||||
name='12 Point Head Flange Dia', default=5.5,
|
||||
name='12 Point Head Flange Dia', default=5.5*createMesh.GLOBAL_SCALE,
|
||||
min=0, soft_min=0,
|
||||
max=MAX_INPUT_NUMBER,
|
||||
max=MAX_INPUT_NUMBER*createMesh.GLOBAL_SCALE,
|
||||
description='Flange diameter of the 12 point Head',
|
||||
unit='LENGTH',
|
||||
)
|
||||
bf_CounterSink_Head_Dia: FloatProperty(
|
||||
attr='bf_CounterSink_Head_Dia',
|
||||
name='Head Dia', default=6.300000190734863,
|
||||
name='Head Dia', default=6.300000190734863*createMesh.GLOBAL_SCALE,
|
||||
min=0, soft_min=0,
|
||||
max=MAX_INPUT_NUMBER,
|
||||
max=MAX_INPUT_NUMBER*createMesh.GLOBAL_SCALE,
|
||||
description='Diameter of the Counter Sink Head',
|
||||
unit='LENGTH',
|
||||
)
|
||||
bf_Cap_Head_Height: FloatProperty(
|
||||
attr='bf_Cap_Head_Height',
|
||||
name='Head Height', default=3,
|
||||
name='Head Height', default=3*createMesh.GLOBAL_SCALE,
|
||||
min=0, soft_min=0,
|
||||
max=MAX_INPUT_NUMBER,
|
||||
max=MAX_INPUT_NUMBER*createMesh.GLOBAL_SCALE,
|
||||
description='Height of the Cap Head',
|
||||
unit='LENGTH',
|
||||
)
|
||||
bf_Cap_Head_Dia: FloatProperty(
|
||||
attr='bf_Cap_Head_Dia',
|
||||
name='Head Dia', default=5.5,
|
||||
name='Head Dia', default=5.5*createMesh.GLOBAL_SCALE,
|
||||
min=0, soft_min=0,
|
||||
max=MAX_INPUT_NUMBER,
|
||||
max=MAX_INPUT_NUMBER*createMesh.GLOBAL_SCALE,
|
||||
description='Diameter of the Cap Head',
|
||||
unit='LENGTH',
|
||||
)
|
||||
bf_Dome_Head_Dia: FloatProperty(
|
||||
attr='bf_Dome_Head_Dia',
|
||||
name='Dome Head Dia', default=5.599999904632568,
|
||||
name='Dome Head Dia', default=5.599999904632568*createMesh.GLOBAL_SCALE,
|
||||
min=0, soft_min=0,
|
||||
max=MAX_INPUT_NUMBER,
|
||||
max=MAX_INPUT_NUMBER*createMesh.GLOBAL_SCALE,
|
||||
description='Length of the unthreaded shank',
|
||||
unit='LENGTH',
|
||||
)
|
||||
bf_Pan_Head_Dia: FloatProperty(
|
||||
attr='bf_Pan_Head_Dia',
|
||||
name='Pan Head Dia', default=5.599999904632568,
|
||||
name='Pan Head Dia', default=5.599999904632568*createMesh.GLOBAL_SCALE,
|
||||
min=0, soft_min=0,
|
||||
max=MAX_INPUT_NUMBER,
|
||||
max=MAX_INPUT_NUMBER*createMesh.GLOBAL_SCALE,
|
||||
description='Diameter of the Pan Head',
|
||||
unit='LENGTH',
|
||||
)
|
||||
|
||||
bf_Philips_Bit_Dia: FloatProperty(
|
||||
attr='bf_Philips_Bit_Dia',
|
||||
name='Bit Dia', default=1.8199999332427979,
|
||||
name='Bit Dia', default=1.8199999332427979*createMesh.GLOBAL_SCALE,
|
||||
min=0, soft_min=0,
|
||||
max=MAX_INPUT_NUMBER,
|
||||
max=MAX_INPUT_NUMBER*createMesh.GLOBAL_SCALE,
|
||||
description='Diameter of the Philips Bit',
|
||||
unit='LENGTH',
|
||||
)
|
||||
|
||||
bf_Thread_Length: FloatProperty(
|
||||
attr='bf_Thread_Length',
|
||||
name='Thread Length', default=6,
|
||||
name='Thread Length', default=6*createMesh.GLOBAL_SCALE,
|
||||
min=0, soft_min=0,
|
||||
max=MAX_INPUT_NUMBER,
|
||||
max=MAX_INPUT_NUMBER*createMesh.GLOBAL_SCALE,
|
||||
description='Length of the Thread',
|
||||
unit='LENGTH',
|
||||
)
|
||||
|
||||
bf_Major_Dia: FloatProperty(
|
||||
attr='bf_Major_Dia',
|
||||
name='Major Dia', default=3,
|
||||
name='Major Dia', default=3*createMesh.GLOBAL_SCALE,
|
||||
min=0, soft_min=0,
|
||||
max=MAX_INPUT_NUMBER,
|
||||
max=MAX_INPUT_NUMBER*createMesh.GLOBAL_SCALE,
|
||||
description='Outside diameter of the Thread',
|
||||
unit='LENGTH',
|
||||
)
|
||||
|
||||
bf_Pitch: FloatProperty(
|
||||
attr='bf_Pitch',
|
||||
name='Pitch', default=0.3499999940395355,
|
||||
min=0.1, soft_min=0.1,
|
||||
max=7.0,
|
||||
name='Pitch', default=0.3499999940395355*createMesh.GLOBAL_SCALE,
|
||||
min=0.1*createMesh.GLOBAL_SCALE, soft_min=0.1*createMesh.GLOBAL_SCALE,
|
||||
max=7.0*createMesh.GLOBAL_SCALE,
|
||||
description='Pitch if the thread',
|
||||
unit='LENGTH',
|
||||
)
|
||||
bf_Minor_Dia: FloatProperty(
|
||||
attr='bf_Minor_Dia',
|
||||
name='Minor Dia', default=2.6211137771606445,
|
||||
name='Minor Dia', default=2.6211137771606445*createMesh.GLOBAL_SCALE,
|
||||
min=0, soft_min=0,
|
||||
max=MAX_INPUT_NUMBER,
|
||||
max=MAX_INPUT_NUMBER*createMesh.GLOBAL_SCALE,
|
||||
description='Inside diameter of the Thread',
|
||||
unit='LENGTH',
|
||||
)
|
||||
@ -288,42 +288,42 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
||||
)
|
||||
bf_Hex_Nut_Height: FloatProperty(
|
||||
attr='bf_Hex_Nut_Height',
|
||||
name='Hex Nut Height', default=2.4000000953674316,
|
||||
Loren Osborn
commented
(Actually commenting on 268-281) According to the info here on Wikipedia illustrated here, https://en.wikipedia.org/wiki/Unified_Thread_Standard#/media/File:ISO_and_UTS_Thread_Dimensions.svg , The default I had originally planned to make this part of a later PR, but I could include it here. (Actually commenting on 268-281)
According to the info here on Wikipedia illustrated here, https://en.wikipedia.org/wiki/Unified_Thread_Standard#/media/File:ISO_and_UTS_Thread_Dimensions.svg , The default `bf_Crest_Percent` should be 12.5% and `bf_Root_Percent` should be 25% necessitating these be changed to `FloatProperty`s...
I had originally planned to make this part of a later PR, but I could include it here.
sw-tya
commented
I would hope that 0.5% is within the tolerance of the threading. A bigger issue is the thread angle, the modelling today uses two diameters and two percentages for building the thread. When making it a float then the context menu box slider buttons will increment in 0.01 steps unless the GUI properties are also updated. I would hope that 0.5% is within the tolerance of the threading.
A bigger issue is the thread angle, the modelling today uses two diameters and two percentages for building the thread.
For both standard UN and metric the thread angle is 60 degrees, but there are other thread types of BA (47.5 deg), Whitworth (55 deg) and ACME (29 deg). The BA even has a rounded root profile.
When making it a float then the context menu box slider buttons will increment in 0.01 steps unless the GUI properties are also updated.
The global scale has changed the behaviour of the buttons already e.g. the diameter entry steps in 1cm jumps making it un-useable. I tried editing the FloatProperty with "precision" and/or "step" but it did not seem to do the right thing.
Loren Osborn
commented
Modifying the inputs to include an angle as one of the inputs was part of a larger change I was working on, but turned out to be more involved, so I hadn't planned on backporting that part. I understand that the minor diameter inc/dec buttons are unfortunately useless currently. I don't know what can be easily done about this. Suggestions welcome. Modifying the inputs to include an angle as one of the inputs was part of a larger change I was working on, but turned out to be more involved, so I hadn't planned on backporting that part. I understand that the minor diameter inc/dec buttons are unfortunately useless currently. I don't know what can be easily done about this.
Suggestions welcome.
|
||||
name='Hex Nut Height', default=2.4000000953674316*createMesh.GLOBAL_SCALE,
|
||||
min=0, soft_min=0,
|
||||
max=MAX_INPUT_NUMBER,
|
||||
max=MAX_INPUT_NUMBER*createMesh.GLOBAL_SCALE,
|
||||
description='Height of the Hex Nut',
|
||||
unit='LENGTH',
|
||||
)
|
||||
bf_Hex_Nut_Flat_Distance: FloatProperty(
|
||||
attr='bf_Hex_Nut_Flat_Distance',
|
||||
name='Hex Nut Flat Dist', default=5.5,
|
||||
name='Hex Nut Flat Dist', default=5.5*createMesh.GLOBAL_SCALE,
|
||||
min=0, soft_min=0,
|
||||
max=MAX_INPUT_NUMBER,
|
||||
max=MAX_INPUT_NUMBER*createMesh.GLOBAL_SCALE,
|
||||
description='Flat distance of the Hex Nut',
|
||||
unit='LENGTH',
|
||||
)
|
||||
bf_12_Point_Nut_Height: FloatProperty(
|
||||
attr='bf_12_Point_Nut_Height',
|
||||
name='12 Point Nut Height', default=2.4000000953674316,
|
||||
name='12 Point Nut Height', default=2.4000000953674316*createMesh.GLOBAL_SCALE,
|
||||
min=0, soft_min=0,
|
||||
max=MAX_INPUT_NUMBER,
|
||||
max=MAX_INPUT_NUMBER*createMesh.GLOBAL_SCALE,
|
||||
description='Height of the 12 Point Nut',
|
||||
unit='LENGTH',
|
||||
)
|
||||
|
||||
bf_12_Point_Nut_Flat_Distance: FloatProperty(
|
||||
attr='bf_12_Point_Nut_Flat_Distance',
|
||||
name='12 Point Nut Flat Dist', default=3.0,
|
||||
min=0.001, soft_min=0, #limit to 0.001 to avoid calculation error
|
||||
max=MAX_INPUT_NUMBER,
|
||||
name='12 Point Nut Flat Dist', default=3.0*createMesh.GLOBAL_SCALE,
|
||||
min=0.001*createMesh.GLOBAL_SCALE, soft_min=0, #limit to 0.001 to avoid calculation error
|
||||
max=MAX_INPUT_NUMBER*createMesh.GLOBAL_SCALE,
|
||||
description='Flat distance of the 12 point Nut',
|
||||
unit='LENGTH',
|
||||
)
|
||||
bf_12_Point_Nut_Flange_Dia: FloatProperty(
|
||||
attr='bf_12_Point_Nut_Flange_Dia',
|
||||
name='12 Point Nut Flange Dia', default=5.5,
|
||||
name='12 Point Nut Flange Dia', default=5.5*createMesh.GLOBAL_SCALE,
|
||||
min=0, soft_min=0,
|
||||
max=MAX_INPUT_NUMBER,
|
||||
max=MAX_INPUT_NUMBER*createMesh.GLOBAL_SCALE,
|
||||
description='Flange diameter of the 12 point Nut',
|
||||
unit='LENGTH',
|
||||
)
|
||||
|
@ -4,8 +4,8 @@
|
||||
|
||||
bl_info = {
|
||||
"name": "BoltFactory",
|
||||
"author": "Aaron Keith",
|
||||
"version": (0, 4, 0),
|
||||
"author": "Aaron Keith (with minor cleanups by Loren Osborn)",
|
||||
"version": (0, 4, 1),
|
||||
"blender": (2, 80, 0),
|
||||
"location": "View3D > Add > Mesh",
|
||||
"description": "Add a bolt or nut",
|
||||
|
@ -18,7 +18,7 @@ from bpy_extras.object_utils import AddObjectHelper, object_data_add
|
||||
NARROW_UI = 180
|
||||
MAX_INPUT_NUMBER = 50
|
||||
|
||||
GLOBAL_SCALE = 1 # 1 blender unit = X mm
|
||||
GLOBAL_SCALE = 0.001 # GLOBAL_SCALE blender unit = 1 mm
|
||||
|
||||
|
||||
# next two utility functions are stolen from import_obj.py
|
||||
@ -2277,13 +2277,13 @@ def Nut_Mesh(props, context):
|
||||
|
||||
|
||||
if props.bf_Nut_Type == 'bf_Nut_12Pnt':
|
||||
Nut_Height = props.bf_12_Point_Nut_Height
|
||||
Nut_Height = props.bf_12_Point_Nut_Height/GLOBAL_SCALE
|
||||
else:
|
||||
Nut_Height = props.bf_Hex_Nut_Height
|
||||
Nut_Height = props.bf_Hex_Nut_Height/GLOBAL_SCALE
|
||||
|
||||
Thread_Verts, Thread_Faces, New_Nut_Height = Create_Internal_Thread(
|
||||
props.bf_Minor_Dia, props.bf_Major_Dia,
|
||||
props.bf_Pitch, Nut_Height,
|
||||
props.bf_Minor_Dia/GLOBAL_SCALE, props.bf_Major_Dia/GLOBAL_SCALE,
|
||||
props.bf_Pitch/GLOBAL_SCALE, Nut_Height,
|
||||
props.bf_Crest_Percent, props.bf_Root_Percent,
|
||||
1, props.bf_Div_Count
|
||||
)
|
||||
@ -2294,15 +2294,15 @@ def Nut_Mesh(props, context):
|
||||
|
||||
if props.bf_Nut_Type == 'bf_Nut_12Pnt':
|
||||
Head_Verts, Head_Faces, Lock_Nut_Rad = add_12_Point_Nut(
|
||||
props.bf_12_Point_Nut_Flat_Distance,
|
||||
props.bf_Major_Dia, New_Nut_Height,
|
||||
props.bf_12_Point_Nut_Flat_Distance/GLOBAL_SCALE,
|
||||
props.bf_Major_Dia/GLOBAL_SCALE, New_Nut_Height,
|
||||
#Limit the size of the Flange to avoid calculation error
|
||||
max(props.bf_12_Point_Nut_Flange_Dia,props.bf_12_Point_Nut_Flat_Distance)
|
||||
max(props.bf_12_Point_Nut_Flange_Dia/GLOBAL_SCALE,props.bf_12_Point_Nut_Flat_Distance/GLOBAL_SCALE)
|
||||
)
|
||||
else:
|
||||
Head_Verts, Head_Faces, Lock_Nut_Rad = add_Hex_Nut(
|
||||
props.bf_Hex_Nut_Flat_Distance,
|
||||
props.bf_Major_Dia, New_Nut_Height
|
||||
props.bf_Hex_Nut_Flat_Distance/GLOBAL_SCALE,
|
||||
props.bf_Major_Dia/GLOBAL_SCALE, New_Nut_Height
|
||||
)
|
||||
verts.extend((Head_Verts))
|
||||
faces.extend(Copy_Faces(Head_Faces, Face_Start))
|
||||
@ -2344,15 +2344,15 @@ def Bolt_Mesh(props, context):
|
||||
Head_Faces = []
|
||||
Head_Height = 0.0
|
||||
|
||||
ReSized_Allen_Bit_Flat_Distance = props.bf_Allen_Bit_Flat_Distance # set default
|
||||
ReSized_Allen_Bit_Flat_Distance = props.bf_Allen_Bit_Flat_Distance/GLOBAL_SCALE # set default
|
||||
|
||||
Head_Height = props.bf_Hex_Head_Height # will be changed by the Head Functions
|
||||
Head_Height = props.bf_Hex_Head_Height/GLOBAL_SCALE # will be changed by the Head Functions
|
||||
|
||||
if props.bf_Bit_Type == 'bf_Bit_Allen' and props.bf_Head_Type == 'bf_Head_Pan':
|
||||
# need to size Allen bit if it is too big.
|
||||
if Allen_Bit_Dia(props.bf_Allen_Bit_Flat_Distance) > Max_Pan_Bit_Dia(props.bf_Pan_Head_Dia):
|
||||
if Allen_Bit_Dia(props.bf_Allen_Bit_Flat_Distance/GLOBAL_SCALE) > Max_Pan_Bit_Dia(props.bf_Pan_Head_Dia/GLOBAL_SCALE):
|
||||
ReSized_Allen_Bit_Flat_Distance = Allen_Bit_Dia_To_Flat(
|
||||
Max_Pan_Bit_Dia(props.bf_Pan_Head_Dia)
|
||||
Max_Pan_Bit_Dia(props.bf_Pan_Head_Dia/GLOBAL_SCALE)
|
||||
)
|
||||
ReSized_Allen_Bit_Flat_Distance -= ReSized_Allen_Bit_Flat_Distance * 0.05 # It looks better if it is just a bit smaller
|
||||
# print ("Resized Allen Bit Flat Distance to ",ReSized_Allen_Bit_Flat_Distance)
|
||||
@ -2361,63 +2361,63 @@ def Bolt_Mesh(props, context):
|
||||
if props.bf_Bit_Type == 'bf_Bit_Allen':
|
||||
Bit_Verts, Bit_Faces, Bit_Dia = Create_Allen_Bit(
|
||||
ReSized_Allen_Bit_Flat_Distance,
|
||||
props.bf_Allen_Bit_Depth
|
||||
props.bf_Allen_Bit_Depth/GLOBAL_SCALE
|
||||
)
|
||||
|
||||
if props.bf_Bit_Type == 'bf_Bit_Torx':
|
||||
Bit_Verts, Bit_Faces, Bit_Dia = Create_Torx_Bit(
|
||||
Torx_Bit_Size_To_Point_Distance(props.bf_Torx_Size_Type),
|
||||
props.bf_Torx_Bit_Depth
|
||||
props.bf_Torx_Bit_Depth/GLOBAL_SCALE
|
||||
)
|
||||
|
||||
|
||||
if props.bf_Bit_Type == 'bf_Bit_Philips':
|
||||
Bit_Verts, Bit_Faces, Bit_Dia = Create_Phillips_Bit(
|
||||
props.bf_Philips_Bit_Dia,
|
||||
props.bf_Philips_Bit_Dia * (0.5 / 1.82),
|
||||
props.bf_Phillips_Bit_Depth
|
||||
props.bf_Philips_Bit_Dia/GLOBAL_SCALE,
|
||||
props.bf_Philips_Bit_Dia/GLOBAL_SCALE * (0.5 / 1.82),
|
||||
props.bf_Phillips_Bit_Depth/GLOBAL_SCALE
|
||||
)
|
||||
# Head Mesh
|
||||
if props.bf_Head_Type == 'bf_Head_Hex':
|
||||
Head_Verts, Head_Faces, Head_Height = Create_Hex_Head(
|
||||
props.bf_Hex_Head_Flat_Distance, Bit_Dia,
|
||||
props.bf_Shank_Dia, props.bf_Hex_Head_Height
|
||||
props.bf_Hex_Head_Flat_Distance/GLOBAL_SCALE, Bit_Dia,
|
||||
props.bf_Shank_Dia/GLOBAL_SCALE, props.bf_Hex_Head_Height/GLOBAL_SCALE
|
||||
)
|
||||
|
||||
elif props.bf_Head_Type == 'bf_Head_12Pnt':
|
||||
Head_Verts, Head_Faces, Head_Height = Create_12_Point_Head(
|
||||
props.bf_12_Point_Head_Flat_Distance, Bit_Dia,
|
||||
props.bf_Shank_Dia, props.bf_12_Point_Head_Height,
|
||||
props.bf_12_Point_Head_Flat_Distance/GLOBAL_SCALE, Bit_Dia,
|
||||
props.bf_Shank_Dia/GLOBAL_SCALE, props.bf_12_Point_Head_Height/GLOBAL_SCALE,
|
||||
#Limit the size of the Flange to avoid calculation error
|
||||
max(props.bf_12_Point_Head_Flange_Dia,props.bf_12_Point_Head_Flat_Distance)
|
||||
max(props.bf_12_Point_Head_Flange_Dia/GLOBAL_SCALE,props.bf_12_Point_Head_Flat_Distance/GLOBAL_SCALE)
|
||||
)
|
||||
elif props.bf_Head_Type == 'bf_Head_Cap':
|
||||
Head_Verts, Head_Faces, Head_Height = Create_Cap_Head(
|
||||
Bit_Dia, props.bf_Cap_Head_Dia,
|
||||
props.bf_Shank_Dia, props.bf_Cap_Head_Height,
|
||||
props.bf_Cap_Head_Dia * (1.0 / 19.0),
|
||||
props.bf_Cap_Head_Dia * (1.0 / 19.0),
|
||||
Bit_Dia, props.bf_Cap_Head_Dia/GLOBAL_SCALE,
|
||||
props.bf_Shank_Dia, props.bf_Cap_Head_Height/GLOBAL_SCALE,
|
||||
sw-tya
commented
The Shank_Dia has been missed for the GLOBAL_SCALE division. The Shank_Dia has been missed for the GLOBAL_SCALE division.
Loren Osborn
commented
I searched for all
and found a second I verified no similar properties with this regex:
I will fix these two instances of I searched for all `props` that already had division by `GLOBAL_SCALE` somewhere in the file with the following regex:
```
bf_(12_Point_(Head|Nut)_(Flange_Dia|Height)|Allen_Bit_Depth|Cap_Head_(Dia|Height)|Hex_((Head|Nut)_Flat_Distance|Nut_Height)|Pan_Head_Dia|Phillips_Bit_Depth|(CounterSink|Dome)_Head_Dia|Shank_(Dia|Length)|Thread_Length|Torx_Bit_Depth)(?!\s*/\s*GLOBAL_SCALE\b)
```
and found a second `bf_Shank_Dia` not divided by `GLOBAL_SCALE` at line 2419.
I verified no similar properties with this regex:
```
\bprops\s*\.\s*\w+(?<!_Percent)(?<!_Count)(?<!_Type)(?<!\.report(?=\())\b(?!\s*/\s*GLOBAL_SCALE\b)
```
I will fix these two instances of `bf_Shank_Dia` not divided by `GLOBAL_SCALE`.
|
||||
props.bf_Cap_Head_Dia/GLOBAL_SCALE * (1.0 / 19.0),
|
||||
props.bf_Cap_Head_Dia/GLOBAL_SCALE * (1.0 / 19.0),
|
||||
props.bf_Div_Count
|
||||
)
|
||||
elif props.bf_Head_Type == 'bf_Head_Dome':
|
||||
Head_Verts, Head_Faces, Head_Height = Create_Dome_Head(
|
||||
Bit_Dia, props.bf_Dome_Head_Dia,
|
||||
props.bf_Shank_Dia, props.bf_Hex_Head_Height,
|
||||
Bit_Dia, props.bf_Dome_Head_Dia/GLOBAL_SCALE,
|
||||
props.bf_Shank_Dia/GLOBAL_SCALE, props.bf_Hex_Head_Height/GLOBAL_SCALE,
|
||||
1, 1, 0, props.bf_Div_Count
|
||||
)
|
||||
|
||||
elif props.bf_Head_Type == 'bf_Head_Pan':
|
||||
Head_Verts, Head_Faces, Head_Height = Create_Pan_Head(
|
||||
Bit_Dia, props.bf_Pan_Head_Dia,
|
||||
props.bf_Shank_Dia,
|
||||
props.bf_Hex_Head_Height, 1, 1, 0,
|
||||
Bit_Dia, props.bf_Pan_Head_Dia/GLOBAL_SCALE,
|
||||
props.bf_Shank_Dia/GLOBAL_SCALE,
|
||||
props.bf_Hex_Head_Height/GLOBAL_SCALE, 1, 1, 0,
|
||||
props.bf_Div_Count
|
||||
)
|
||||
elif props.bf_Head_Type == 'bf_Head_CounterSink':
|
||||
Head_Verts, Head_Faces, Head_Height = Create_CounterSink_Head(
|
||||
Bit_Dia, props.bf_CounterSink_Head_Dia,
|
||||
props.bf_Shank_Dia, props.bf_CounterSink_Head_Dia,
|
||||
props.bf_CounterSink_Head_Dia * (0.09 / 6.31),
|
||||
Bit_Dia, props.bf_CounterSink_Head_Dia/GLOBAL_SCALE,
|
||||
props.bf_Shank_Dia, props.bf_CounterSink_Head_Dia/GLOBAL_SCALE,
|
||||
props.bf_CounterSink_Head_Dia/GLOBAL_SCALE * (0.09 / 6.31),
|
||||
props.bf_Div_Count
|
||||
)
|
||||
|
||||
@ -2431,9 +2431,9 @@ def Bolt_Mesh(props, context):
|
||||
|
||||
Face_Start = len(verts)
|
||||
Thread_Verts, Thread_Faces, Thread_Height = Create_External_Thread(
|
||||
props.bf_Shank_Dia, props.bf_Shank_Length,
|
||||
props.bf_Minor_Dia, props.bf_Major_Dia,
|
||||
props.bf_Pitch, props.bf_Thread_Length,
|
||||
props.bf_Shank_Dia/GLOBAL_SCALE, props.bf_Shank_Length/GLOBAL_SCALE,
|
||||
props.bf_Minor_Dia/GLOBAL_SCALE, props.bf_Major_Dia/GLOBAL_SCALE,
|
||||
props.bf_Pitch/GLOBAL_SCALE, props.bf_Thread_Length/GLOBAL_SCALE,
|
||||
props.bf_Crest_Percent,
|
||||
props.bf_Root_Percent, props.bf_Div_Count
|
||||
)
|
||||
|
There was a ticket or comment saying that 50mm was too small for the maximal bolt size. The user wanted to make a bolt that was 2 inches which needed 50.8mm
If the scaling is now correctly working I don't see a need to have a limit in here. Practically 250 would be a better limit as that would cover anything that I have seen in agriculture.
Looking at the drivel on Wikipedia I got a bit bored and resorted to ChatGPT which said that specialty bolts can often exceed 4 inches (101.6mm)… which makes me think 250mm is probably overkill, but definitely sufficient, so I’ll make it 250mm
https://www.globalfastener.com/standards/detail_4902.html
That shows a good range.
I hope that people who are in industry are using qualified models rather than open source representations!
Besides even with the limit is is possible to work round it by creating the single item, in a different project, at a reduced scale then importing.
This is a great reference, and I may actually use it in further enhancements I began working on.
I do think we should definitely support up to M160 or 160 mm, but I am hesitant to make this a hard limit until we see a similar reference for "standard"/imperial sizes.... until then we can leave it as the slightly ridiculous 250mm. Do you have a similar reference for imperial?
This page covers imperial: https://www.globalfastener.com/standards/detail.php?sid=MjI4NTQ=
The "asme-b18.2.2" covers standard sizes, the 4 inch heavy nuts are 6 1/8 across flats. A 4 inch connecting nut is 9 1/8.
9.125 inch = 231mm, so 250mm is still a reasonable top end for the input box.
There are copies of this paid for standard accidentally published online which google has found.