From 898b3fecd4b6ce3b079379f717a407f1513d2591 Mon Sep 17 00:00:00 2001 From: Ado Date: Fri, 15 Nov 2024 13:59:44 +0100 Subject: [PATCH 1/5] modified scaling calculations --- source/Boltfactory.py | 178 +++++++++--------- source/createMesh.py | 88 +++++---- .../operator/mesh.bolt_add/_default.py | 52 ++--- source/presets/operator/mesh.bolt_add/_m3.py | 52 ++--- source/presets/operator/mesh.bolt_add/_m4.py | 52 ++--- source/presets/operator/mesh.bolt_add/_m5.py | 52 ++--- source/presets/operator/mesh.bolt_add/_m6.py | 52 ++--- source/presets/operator/mesh.bolt_add/_m8.py | 52 ++--- source/presets/operator/mesh.bolt_add/m10.py | 52 ++--- source/presets/operator/mesh.bolt_add/m12.py | 52 ++--- 10 files changed, 342 insertions(+), 340 deletions(-) diff --git a/source/Boltfactory.py b/source/Boltfactory.py index 2ff740b..6f18bb6 100644 --- a/source/Boltfactory.py +++ b/source/Boltfactory.py @@ -77,46 +77,46 @@ class add_mesh_bolt(Operator, AddObjectHelper): name='Nut Type', description='Choose the type of nut you would like', items=Nut_Type_List, default='bf_Nut_Hex' - ) + ) # type: ignore # Shank Types bf_Shank_Length: FloatProperty( attr='bf_Shank_Length', name='Shank Length', default=0, - min=0, soft_min=0, max=MAX_INPUT_NUMBER * createMesh.GLOBAL_SCALE, + min=0, soft_min=0, max=MAX_INPUT_NUMBER, description='Length of the unthreaded shank', - unit='LENGTH', - ) + unit='NONE', + ) # type: ignore bf_Shank_Dia: FloatProperty( attr='bf_Shank_Dia', - name='Shank Dia', default=3 * createMesh.GLOBAL_SCALE, + name='Shank Dia', default=3, min=0, soft_min=0, - max=MAX_INPUT_NUMBER * createMesh.GLOBAL_SCALE, + max=MAX_INPUT_NUMBER, description='Diameter of the shank', - unit='LENGTH', - ) + unit='NONE', + ) # type: ignore bf_Phillips_Bit_Depth: FloatProperty( attr='bf_Phillips_Bit_Depth', - name='Bit Depth', default=1.1431535482406616 * createMesh.GLOBAL_SCALE, + name='Bit Depth', default=1.1431535482406616, min=0, soft_min=0, - max=MAX_INPUT_NUMBER * createMesh.GLOBAL_SCALE, + max=MAX_INPUT_NUMBER, description='Depth of the Phillips Bit', - unit='LENGTH', + unit='NONE', ) bf_Allen_Bit_Depth: FloatProperty( attr='bf_Allen_Bit_Depth', - name='Bit Depth', default=1.5 * createMesh.GLOBAL_SCALE, + name='Bit Depth', default=1.5, min=0, soft_min=0, - max=MAX_INPUT_NUMBER * createMesh.GLOBAL_SCALE, + max=MAX_INPUT_NUMBER, description='Depth of the Allen Bit', - unit='LENGTH', + unit='NONE', ) bf_Allen_Bit_Flat_Distance: FloatProperty( attr='bf_Allen_Bit_Flat_Distance', - name='Flat Dist', default=2.5 * createMesh.GLOBAL_SCALE, + name='Flat Dist', default=2.5, min=0, soft_min=0, - max=MAX_INPUT_NUMBER * createMesh.GLOBAL_SCALE, + max=MAX_INPUT_NUMBER, description='Flat Distance of the Allen Bit', - unit='LENGTH', + unit='NONE', ) # Torx Size Types Torx_Size_Type_List = [('bf_Torx_T10', 'T10', 'T10'), @@ -136,133 +136,133 @@ class add_mesh_bolt(Operator, AddObjectHelper): ) bf_Torx_Bit_Depth: FloatProperty( attr='bf_Torx_Bit_Depth', - name='Bit Depth', default=1.5 * createMesh.GLOBAL_SCALE, + name='Bit Depth', default=1.5, min=0, soft_min=0, - max=MAX_INPUT_NUMBER * createMesh.GLOBAL_SCALE, + max=MAX_INPUT_NUMBER, description='Depth of the Torx Bit', - unit='LENGTH', + unit='NONE', ) bf_Hex_Head_Height: FloatProperty( attr='bf_Hex_Head_Height', - name='Head Height', default=2 * createMesh.GLOBAL_SCALE, - min=0, soft_min=0, max=MAX_INPUT_NUMBER * createMesh.GLOBAL_SCALE, + name='Head Height', default=2, + min=0, soft_min=0, max=MAX_INPUT_NUMBER, description='Height of the Hex Head', - unit='LENGTH', + unit='NONE', ) bf_Hex_Head_Flat_Distance: FloatProperty( attr='bf_Hex_Head_Flat_Distance', - name='Flat Dist', default=5.5 * createMesh.GLOBAL_SCALE, + name='Flat Dist', default=5.5, min=0, soft_min=0, - max=MAX_INPUT_NUMBER * createMesh.GLOBAL_SCALE, + max=MAX_INPUT_NUMBER, description='Flat Distance of the Hex Head', - unit='LENGTH', + unit='NONE', ) bf_12_Point_Head_Height: FloatProperty( attr='bf_12_Point_Head_Height', - name='Head Height', default=3.0 * createMesh.GLOBAL_SCALE, - min=0, soft_min=0, max=MAX_INPUT_NUMBER * createMesh.GLOBAL_SCALE, + name='Head Height', default=3.0, + min=0, soft_min=0, max=MAX_INPUT_NUMBER, description='Height of the 12 Point Head', - unit='LENGTH', + unit='NONE', ) bf_12_Point_Head_Flat_Distance: FloatProperty( attr='bf_12_Point_Head_Flat_Distance', - 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, + name='Flat Dist', default=3.0, + min=0.001, soft_min=0, # limit to 0.001*createMesh.GLOBAL_SCALE to avoid calculation error + max=MAX_INPUT_NUMBER, description='Flat Distance of the 12 Point Head', - unit='LENGTH', + unit='NONE', ) bf_12_Point_Head_Flange_Dia: FloatProperty( attr='bf_12_Point_Head_Flange_Dia', - name='12 Point Head Flange Dia', default=5.5 * createMesh.GLOBAL_SCALE, + name='12 Point Head Flange Dia', default=5.5, min=0, soft_min=0, - max=MAX_INPUT_NUMBER * createMesh.GLOBAL_SCALE, + max=MAX_INPUT_NUMBER, description='Flange diameter of the 12 point Head', - unit='LENGTH', + unit='NONE', ) bf_CounterSink_Head_Dia: FloatProperty( attr='bf_CounterSink_Head_Dia', - name='Head Dia', default=6.300000190734863 * createMesh.GLOBAL_SCALE, + name='Head Dia', default=6.300000190734863, min=0, soft_min=0, - max=MAX_INPUT_NUMBER * createMesh.GLOBAL_SCALE, + max=MAX_INPUT_NUMBER, description='Diameter of the Counter Sink Head', - unit='LENGTH', + unit='NONE', ) bf_Cap_Head_Height: FloatProperty( attr='bf_Cap_Head_Height', - name='Head Height', default=3 * createMesh.GLOBAL_SCALE, + name='Head Height', default=3, min=0, soft_min=0, - max=MAX_INPUT_NUMBER * createMesh.GLOBAL_SCALE, + max=MAX_INPUT_NUMBER, description='Height of the Cap Head', - unit='LENGTH', + unit='NONE', ) bf_Cap_Head_Dia: FloatProperty( attr='bf_Cap_Head_Dia', - name='Head Dia', default=5.5 * createMesh.GLOBAL_SCALE, + name='Head Dia', default=5.5, min=0, soft_min=0, - max=MAX_INPUT_NUMBER * createMesh.GLOBAL_SCALE, + max=MAX_INPUT_NUMBER, description='Diameter of the Cap Head', - unit='LENGTH', + unit='NONE', ) bf_Dome_Head_Dia: FloatProperty( attr='bf_Dome_Head_Dia', - name='Dome Head Dia', default=5.599999904632568 * createMesh.GLOBAL_SCALE, + name='Dome Head Dia', default=5.599999904632568, min=0, soft_min=0, - max=MAX_INPUT_NUMBER * createMesh.GLOBAL_SCALE, + max=MAX_INPUT_NUMBER, description='Length of the unthreaded shank', - unit='LENGTH', + unit='NONE', ) bf_Pan_Head_Dia: FloatProperty( attr='bf_Pan_Head_Dia', - name='Pan Head Dia', default=5.599999904632568 * createMesh.GLOBAL_SCALE, + name='Pan Head Dia', default=5.599999904632568, min=0, soft_min=0, - max=MAX_INPUT_NUMBER * createMesh.GLOBAL_SCALE, + max=MAX_INPUT_NUMBER, description='Diameter of the Pan Head', - unit='LENGTH', + unit='NONE', ) bf_Philips_Bit_Dia: FloatProperty( attr='bf_Philips_Bit_Dia', - name='Bit Dia', default=1.8199999332427979 * createMesh.GLOBAL_SCALE, + name='Bit Dia', default=1.8199999332427979, min=0, soft_min=0, - max=MAX_INPUT_NUMBER * createMesh.GLOBAL_SCALE, + max=MAX_INPUT_NUMBER, description='Diameter of the Philips Bit', - unit='LENGTH', + unit='NONE', ) bf_Thread_Length: FloatProperty( attr='bf_Thread_Length', - name='Thread Length', default=6 * createMesh.GLOBAL_SCALE, + name='Thread Length', default=6, min=0, soft_min=0, - max=MAX_INPUT_NUMBER * createMesh.GLOBAL_SCALE, + max=MAX_INPUT_NUMBER, description='Length of the Thread', - unit='LENGTH', + unit='NONE', ) bf_Major_Dia: FloatProperty( attr='bf_Major_Dia', - name='Major Dia', default=3 * createMesh.GLOBAL_SCALE, + name='Major Dia', default=3, min=0, soft_min=0, - max=MAX_INPUT_NUMBER * createMesh.GLOBAL_SCALE, + max=MAX_INPUT_NUMBER, description='Outside diameter of the Thread', - unit='LENGTH', + unit='NONE', ) bf_Pitch: FloatProperty( attr='bf_Pitch', - 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, + name='Pitch', default=0.3499999940395355, + min=0.1, soft_min=0.1, + max=7.0, description='Pitch if the thread', - unit='LENGTH', + unit='NONE', ) bf_Minor_Dia: FloatProperty( attr='bf_Minor_Dia', - name='Minor Dia', default=2.6211137771606445 * createMesh.GLOBAL_SCALE, + name='Minor Dia', default=2.6211137771606445, min=0, soft_min=0, - max=MAX_INPUT_NUMBER * createMesh.GLOBAL_SCALE, + max=MAX_INPUT_NUMBER, description='Inside diameter of the Thread', - unit='LENGTH', + unit='NONE', ) bf_Crest_Percent: FloatProperty( attr='bf_Crest_Percent', @@ -287,44 +287,44 @@ class add_mesh_bolt(Operator, AddObjectHelper): ) bf_Hex_Nut_Height: FloatProperty( attr='bf_Hex_Nut_Height', - name='Hex Nut Height', default=2.4000000953674316 * createMesh.GLOBAL_SCALE, + name='Hex Nut Height', default=2.4000000953674316, min=0, soft_min=0, - max=MAX_INPUT_NUMBER * createMesh.GLOBAL_SCALE, + max=MAX_INPUT_NUMBER, description='Height of the Hex Nut', - unit='LENGTH', + unit='NONE', ) bf_Hex_Nut_Flat_Distance: FloatProperty( attr='bf_Hex_Nut_Flat_Distance', - name='Hex Nut Flat Dist', default=5.5 * createMesh.GLOBAL_SCALE, + name='Hex Nut Flat Dist', default=5.5, min=0, soft_min=0, - max=MAX_INPUT_NUMBER * createMesh.GLOBAL_SCALE, + max=MAX_INPUT_NUMBER, description='Flat distance of the Hex Nut', - unit='LENGTH', + unit='NONE', ) bf_12_Point_Nut_Height: FloatProperty( attr='bf_12_Point_Nut_Height', - name='12 Point Nut Height', default=2.4000000953674316 * createMesh.GLOBAL_SCALE, + name='12 Point Nut Height', default=2.4000000953674316, min=0, soft_min=0, - max=MAX_INPUT_NUMBER * createMesh.GLOBAL_SCALE, + max=MAX_INPUT_NUMBER, description='Height of the 12 Point Nut', - unit='LENGTH', + unit='NONE', ) bf_12_Point_Nut_Flat_Distance: FloatProperty( attr='bf_12_Point_Nut_Flat_Distance', - 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, + 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, description='Flat distance of the 12 point Nut', - unit='LENGTH', + unit='NONE', ) bf_12_Point_Nut_Flange_Dia: FloatProperty( attr='bf_12_Point_Nut_Flange_Dia', - name='12 Point Nut Flange Dia', default=5.5 * createMesh.GLOBAL_SCALE, + name='12 Point Nut Flange Dia', default=5.5, min=0, soft_min=0, - max=MAX_INPUT_NUMBER * createMesh.GLOBAL_SCALE, + max=MAX_INPUT_NUMBER, description='Flange diameter of the 12 point Nut', - unit='LENGTH', + unit='NONE', ) def draw(self, context): @@ -411,6 +411,12 @@ class add_mesh_bolt(Operator, AddObjectHelper): def execute(self, context): + # This formula ensures that bolts (or other objects) are generated at their default sizes + # regardless of the unit scale setting in the scene. It normalizes the scale to maintain + # consistent dimensions across various unit configurations. + scene = context.scene + adjusted_scale = 1 * (0.001 / scene.unit_settings.scale_length) + if bpy.context.mode == "OBJECT": if context.selected_objects != [] and context.active_object and \ (context.active_object.data is not None) and ('Bolt' in context.active_object.data.keys()) and \ @@ -418,7 +424,7 @@ class add_mesh_bolt(Operator, AddObjectHelper): obj = context.active_object use_smooth = bool(obj.data.polygons[0].use_smooth) # Copy value, do not take a reference - mesh = createMesh.Create_New_Mesh(self, context) + mesh = createMesh.Create_New_Mesh(self, context, adjusted_scale) # Modify existing mesh data object by replacing geometry (but leaving materials etc) bm = bmesh.new() @@ -440,7 +446,7 @@ class add_mesh_bolt(Operator, AddObjectHelper): pass else: - mesh = createMesh.Create_New_Mesh(self, context) + mesh = createMesh.Create_New_Mesh(self, context, adjusted_scale) obj = object_utils.object_data_add(context, mesh, operator=self) obj.data["Bolt"] = True @@ -450,7 +456,7 @@ class add_mesh_bolt(Operator, AddObjectHelper): if bpy.context.mode == "EDIT_MESH": obj = context.edit_object - mesh = createMesh.Create_New_Mesh(self, context) + mesh = createMesh.Create_New_Mesh(self, context, adjusted_scale) bm = bmesh.from_edit_mesh(obj.data) # Access edit mode's mesh data bm.from_mesh(mesh) # Append new mesh data diff --git a/source/createMesh.py b/source/createMesh.py index 8d0fa5c..1ea3919 100644 --- a/source/createMesh.py +++ b/source/createMesh.py @@ -18,9 +18,6 @@ from bpy_extras.object_utils import AddObjectHelper, object_data_add NARROW_UI = 180 MAX_INPUT_NUMBER = 50 -GLOBAL_SCALE = 0.001 # GLOBAL_SCALE blender unit = 1 mm - - # next two utility functions are stolen from import_obj.py def unpack_list(list_of_tuples): @@ -2276,13 +2273,13 @@ def Nut_Mesh(props, context): Face_Start = len(verts) if props.bf_Nut_Type == 'bf_Nut_12Pnt': - Nut_Height = props.bf_12_Point_Nut_Height / GLOBAL_SCALE + Nut_Height = props.bf_12_Point_Nut_Height else: - Nut_Height = props.bf_Hex_Nut_Height / GLOBAL_SCALE + Nut_Height = props.bf_Hex_Nut_Height Thread_Verts, Thread_Faces, New_Nut_Height = Create_Internal_Thread( - props.bf_Minor_Dia / GLOBAL_SCALE, props.bf_Major_Dia / GLOBAL_SCALE, - props.bf_Pitch / GLOBAL_SCALE, Nut_Height, + props.bf_Minor_Dia, props.bf_Major_Dia, + props.bf_Pitch, Nut_Height, props.bf_Crest_Percent, props.bf_Root_Percent, 1, props.bf_Div_Count ) @@ -2293,15 +2290,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 / GLOBAL_SCALE, - props.bf_Major_Dia / GLOBAL_SCALE, New_Nut_Height, + props.bf_12_Point_Nut_Flat_Distance, + props.bf_Major_Dia, New_Nut_Height, # Limit the size of the Flange to avoid calculation error - max(props.bf_12_Point_Nut_Flange_Dia / GLOBAL_SCALE, props.bf_12_Point_Nut_Flat_Distance / GLOBAL_SCALE) + max(props.bf_12_Point_Nut_Flange_Dia, props.bf_12_Point_Nut_Flat_Distance) ) else: Head_Verts, Head_Faces, Lock_Nut_Rad = add_Hex_Nut( - props.bf_Hex_Nut_Flat_Distance / GLOBAL_SCALE, - props.bf_Major_Dia / GLOBAL_SCALE, New_Nut_Height + props.bf_Hex_Nut_Flat_Distance, + props.bf_Major_Dia, New_Nut_Height ) verts.extend((Head_Verts)) faces.extend(Copy_Faces(Head_Faces, Face_Start)) @@ -2343,19 +2340,17 @@ def Bolt_Mesh(props, context): Head_Faces = [] Head_Height = 0.0 - ReSized_Allen_Bit_Flat_Distance = props.bf_Allen_Bit_Flat_Distance / GLOBAL_SCALE # set default + ReSized_Allen_Bit_Flat_Distance = props.bf_Allen_Bit_Flat_Distance # set default - Head_Height = props.bf_Hex_Head_Height / GLOBAL_SCALE # will be changed by the Head Functions + Head_Height = props.bf_Hex_Head_Height # 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 / - GLOBAL_SCALE) > Max_Pan_Bit_Dia( - props.bf_Pan_Head_Dia / - GLOBAL_SCALE): + props.bf_Allen_Bit_Flat_Distance) > Max_Pan_Bit_Dia( + props.bf_Pan_Head_Dia): ReSized_Allen_Bit_Flat_Distance = Allen_Bit_Dia_To_Flat( - Max_Pan_Bit_Dia(props.bf_Pan_Head_Dia / GLOBAL_SCALE) + Max_Pan_Bit_Dia(props.bf_Pan_Head_Dia) ) 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) @@ -2364,62 +2359,62 @@ 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 / GLOBAL_SCALE + props.bf_Allen_Bit_Depth ) 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 / GLOBAL_SCALE + props.bf_Torx_Bit_Depth ) if props.bf_Bit_Type == 'bf_Bit_Philips': Bit_Verts, Bit_Faces, Bit_Dia = Create_Phillips_Bit( - 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 + props.bf_Philips_Bit_Dia, + props.bf_Philips_Bit_Dia * (0.5 / 1.82), + props.bf_Phillips_Bit_Depth ) # 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 / GLOBAL_SCALE, Bit_Dia, - props.bf_Shank_Dia / GLOBAL_SCALE, props.bf_Hex_Head_Height / GLOBAL_SCALE + props.bf_Hex_Head_Flat_Distance, Bit_Dia, + props.bf_Shank_Dia, props.bf_Hex_Head_Height ) 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 / GLOBAL_SCALE, Bit_Dia, - props.bf_Shank_Dia / GLOBAL_SCALE, props.bf_12_Point_Head_Height / GLOBAL_SCALE, + props.bf_12_Point_Head_Flat_Distance, Bit_Dia, + props.bf_Shank_Dia, props.bf_12_Point_Head_Height, # Limit the size of the Flange to avoid calculation error - max(props.bf_12_Point_Head_Flange_Dia / GLOBAL_SCALE, props.bf_12_Point_Head_Flat_Distance / GLOBAL_SCALE) + max(props.bf_12_Point_Head_Flange_Dia, props.bf_12_Point_Head_Flat_Distance) ) elif props.bf_Head_Type == 'bf_Head_Cap': Head_Verts, Head_Faces, Head_Height = Create_Cap_Head( - Bit_Dia, props.bf_Cap_Head_Dia / GLOBAL_SCALE, - props.bf_Shank_Dia / GLOBAL_SCALE, props.bf_Cap_Head_Height / GLOBAL_SCALE, - props.bf_Cap_Head_Dia / GLOBAL_SCALE * (1.0 / 19.0), - props.bf_Cap_Head_Dia / GLOBAL_SCALE * (1.0 / 19.0), + 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), 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 / GLOBAL_SCALE, - props.bf_Shank_Dia / GLOBAL_SCALE, props.bf_Hex_Head_Height / GLOBAL_SCALE, + Bit_Dia, props.bf_Dome_Head_Dia, + props.bf_Shank_Dia, props.bf_Hex_Head_Height, 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 / GLOBAL_SCALE, - props.bf_Shank_Dia / GLOBAL_SCALE, - props.bf_Hex_Head_Height / GLOBAL_SCALE, 1, 1, 0, + Bit_Dia, props.bf_Pan_Head_Dia, + props.bf_Shank_Dia, + props.bf_Hex_Head_Height, 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 / GLOBAL_SCALE, - props.bf_Shank_Dia / GLOBAL_SCALE, props.bf_CounterSink_Head_Dia / GLOBAL_SCALE, - props.bf_CounterSink_Head_Dia / GLOBAL_SCALE * (0.09 / 6.31), + 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), props.bf_Div_Count ) @@ -2433,9 +2428,9 @@ def Bolt_Mesh(props, context): Face_Start = len(verts) Thread_Verts, Thread_Faces, Thread_Height = Create_External_Thread( - 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_Shank_Dia, props.bf_Shank_Length, + props.bf_Minor_Dia, props.bf_Major_Dia, + props.bf_Pitch, props.bf_Thread_Length, props.bf_Crest_Percent, props.bf_Root_Percent, props.bf_Div_Count ) @@ -2446,7 +2441,8 @@ def Bolt_Mesh(props, context): return Move_Verts_Up_Z(verts, Thread_Height), faces -def Create_New_Mesh(props, context): + +def Create_New_Mesh(props, context, adjusted_scale): verts = [] faces = [] @@ -2465,7 +2461,7 @@ def Create_New_Mesh(props, context): verts, faces = RemoveDoubles(verts, faces) - verts = Scale_Mesh_Verts(verts, GLOBAL_SCALE) + verts = Scale_Mesh_Verts(verts, adjusted_scale) mesh = bpy.data.meshes.new(name=sObjName) mesh.from_pydata(verts, edges, faces) diff --git a/source/presets/operator/mesh.bolt_add/_default.py b/source/presets/operator/mesh.bolt_add/_default.py index f0f29de..b9db29f 100644 --- a/source/presets/operator/mesh.bolt_add/_default.py +++ b/source/presets/operator/mesh.bolt_add/_default.py @@ -5,33 +5,33 @@ op.bf_Model_Type = 'bf_Model_Bolt' op.bf_Head_Type = 'bf_Head_Hex' op.bf_Bit_Type = 'bf_Bit_None' op.bf_Nut_Type = 'bf_Nut_Hex' -op.bf_Shank_Length = 0.0 / 1000.0 -op.bf_Shank_Dia = 3.0 / 1000.0 -op.bf_Phillips_Bit_Depth = 1.1431535482406616 / 1000.0 -op.bf_Allen_Bit_Depth = 1.5 / 1000.0 -op.bf_Allen_Bit_Flat_Distance = 2.5 / 1000.0 -op.bf_Torx_Bit_Depth = 1.5 / 1000.0 +op.bf_Shank_Length = 0.0 +op.bf_Shank_Dia = 3.0 +op.bf_Phillips_Bit_Depth = 1.1431535482406616 +op.bf_Allen_Bit_Depth = 1.5 +op.bf_Allen_Bit_Flat_Distance = 2.5 +op.bf_Torx_Bit_Depth = 1.5 op.bf_Torx_Size_Type = 'bf_Torx_T10' -op.bf_Hex_Head_Height = 2.0 / 1000.0 -op.bf_Hex_Head_Flat_Distance = 5.5 / 1000.0 -op.bf_12_Point_Head_Height = 3.0 / 1000.0 -op.bf_12_Point_Head_Flat_Distance = 3.0 / 1000.0 -op.bf_12_Point_Head_Flange_Dia = 5.72 / 1000.0 -op.bf_CounterSink_Head_Dia = 6.300000190734863 / 1000.0 -op.bf_Cap_Head_Height = 3.0 / 1000.0 -op.bf_Cap_Head_Dia = 5.5 / 1000.0 -op.bf_Dome_Head_Dia = 5.599999904632568 / 1000.0 -op.bf_Pan_Head_Dia = 5.599999904632568 / 1000.0 -op.bf_Philips_Bit_Dia = 1.8199999332427979 / 1000.0 -op.bf_Thread_Length = 6.0 / 1000.0 -op.bf_Major_Dia = 3.0 / 1000.0 -op.bf_Pitch = 0.3499999940395355 / 1000.0 -op.bf_Minor_Dia = 2.6211137771606445 / 1000.0 +op.bf_Hex_Head_Height = 2.0 +op.bf_Hex_Head_Flat_Distance = 5.5 +op.bf_12_Point_Head_Height = 3.0 +op.bf_12_Point_Head_Flat_Distance = 3.0 +op.bf_12_Point_Head_Flange_Dia = 5.72 +op.bf_CounterSink_Head_Dia = 6.300000190734863 +op.bf_Cap_Head_Height = 3.0 +op.bf_Cap_Head_Dia = 5.5 +op.bf_Dome_Head_Dia = 5.599999904632568 +op.bf_Pan_Head_Dia = 5.599999904632568 +op.bf_Philips_Bit_Dia = 1.8199999332427979 +op.bf_Thread_Length = 6.0 +op.bf_Major_Dia = 3.0 +op.bf_Pitch = 0.3499999940395355 +op.bf_Minor_Dia = 2.6211137771606445 op.bf_Crest_Percent = 12.5 op.bf_Root_Percent = 25 op.bf_Div_Count = 36 -op.bf_Hex_Nut_Height = 2.4000000953674316 / 1000.0 -op.bf_Hex_Nut_Flat_Distance = 5.5 / 1000.0 -op.bf_12_Point_Nut_Height = 3.0 / 1000.0 -op.bf_12_Point_Nut_Flat_Distance = 3.0 / 1000.0 -op.bf_12_Point_Nut_Flange_Dia = 5.72 / 1000.0 +op.bf_Hex_Nut_Height = 2.4000000953674316 +op.bf_Hex_Nut_Flat_Distance = 5.5 +op.bf_12_Point_Nut_Height = 3.0 +op.bf_12_Point_Nut_Flat_Distance = 3.0 +op.bf_12_Point_Nut_Flange_Dia = 5.72 diff --git a/source/presets/operator/mesh.bolt_add/_m3.py b/source/presets/operator/mesh.bolt_add/_m3.py index f0f29de..b9db29f 100644 --- a/source/presets/operator/mesh.bolt_add/_m3.py +++ b/source/presets/operator/mesh.bolt_add/_m3.py @@ -5,33 +5,33 @@ op.bf_Model_Type = 'bf_Model_Bolt' op.bf_Head_Type = 'bf_Head_Hex' op.bf_Bit_Type = 'bf_Bit_None' op.bf_Nut_Type = 'bf_Nut_Hex' -op.bf_Shank_Length = 0.0 / 1000.0 -op.bf_Shank_Dia = 3.0 / 1000.0 -op.bf_Phillips_Bit_Depth = 1.1431535482406616 / 1000.0 -op.bf_Allen_Bit_Depth = 1.5 / 1000.0 -op.bf_Allen_Bit_Flat_Distance = 2.5 / 1000.0 -op.bf_Torx_Bit_Depth = 1.5 / 1000.0 +op.bf_Shank_Length = 0.0 +op.bf_Shank_Dia = 3.0 +op.bf_Phillips_Bit_Depth = 1.1431535482406616 +op.bf_Allen_Bit_Depth = 1.5 +op.bf_Allen_Bit_Flat_Distance = 2.5 +op.bf_Torx_Bit_Depth = 1.5 op.bf_Torx_Size_Type = 'bf_Torx_T10' -op.bf_Hex_Head_Height = 2.0 / 1000.0 -op.bf_Hex_Head_Flat_Distance = 5.5 / 1000.0 -op.bf_12_Point_Head_Height = 3.0 / 1000.0 -op.bf_12_Point_Head_Flat_Distance = 3.0 / 1000.0 -op.bf_12_Point_Head_Flange_Dia = 5.72 / 1000.0 -op.bf_CounterSink_Head_Dia = 6.300000190734863 / 1000.0 -op.bf_Cap_Head_Height = 3.0 / 1000.0 -op.bf_Cap_Head_Dia = 5.5 / 1000.0 -op.bf_Dome_Head_Dia = 5.599999904632568 / 1000.0 -op.bf_Pan_Head_Dia = 5.599999904632568 / 1000.0 -op.bf_Philips_Bit_Dia = 1.8199999332427979 / 1000.0 -op.bf_Thread_Length = 6.0 / 1000.0 -op.bf_Major_Dia = 3.0 / 1000.0 -op.bf_Pitch = 0.3499999940395355 / 1000.0 -op.bf_Minor_Dia = 2.6211137771606445 / 1000.0 +op.bf_Hex_Head_Height = 2.0 +op.bf_Hex_Head_Flat_Distance = 5.5 +op.bf_12_Point_Head_Height = 3.0 +op.bf_12_Point_Head_Flat_Distance = 3.0 +op.bf_12_Point_Head_Flange_Dia = 5.72 +op.bf_CounterSink_Head_Dia = 6.300000190734863 +op.bf_Cap_Head_Height = 3.0 +op.bf_Cap_Head_Dia = 5.5 +op.bf_Dome_Head_Dia = 5.599999904632568 +op.bf_Pan_Head_Dia = 5.599999904632568 +op.bf_Philips_Bit_Dia = 1.8199999332427979 +op.bf_Thread_Length = 6.0 +op.bf_Major_Dia = 3.0 +op.bf_Pitch = 0.3499999940395355 +op.bf_Minor_Dia = 2.6211137771606445 op.bf_Crest_Percent = 12.5 op.bf_Root_Percent = 25 op.bf_Div_Count = 36 -op.bf_Hex_Nut_Height = 2.4000000953674316 / 1000.0 -op.bf_Hex_Nut_Flat_Distance = 5.5 / 1000.0 -op.bf_12_Point_Nut_Height = 3.0 / 1000.0 -op.bf_12_Point_Nut_Flat_Distance = 3.0 / 1000.0 -op.bf_12_Point_Nut_Flange_Dia = 5.72 / 1000.0 +op.bf_Hex_Nut_Height = 2.4000000953674316 +op.bf_Hex_Nut_Flat_Distance = 5.5 +op.bf_12_Point_Nut_Height = 3.0 +op.bf_12_Point_Nut_Flat_Distance = 3.0 +op.bf_12_Point_Nut_Flange_Dia = 5.72 diff --git a/source/presets/operator/mesh.bolt_add/_m4.py b/source/presets/operator/mesh.bolt_add/_m4.py index 8513f9f..9c757c4 100644 --- a/source/presets/operator/mesh.bolt_add/_m4.py +++ b/source/presets/operator/mesh.bolt_add/_m4.py @@ -5,33 +5,33 @@ op.bf_Model_Type = 'bf_Model_Bolt' op.bf_Head_Type = 'bf_Head_Hex' op.bf_Bit_Type = 'bf_Bit_None' op.bf_Nut_Type = 'bf_Nut_Hex' -op.bf_Shank_Length = 0.0 / 1000.0 -op.bf_Shank_Dia = 4.0 / 1000.0 -op.bf_Phillips_Bit_Depth = 1.6330764293670654 / 1000.0 -op.bf_Allen_Bit_Depth = 2.0 / 1000.0 -op.bf_Allen_Bit_Flat_Distance = 3.0 / 1000.0 -op.bf_Torx_Bit_Depth = 2.0 / 1000.0 +op.bf_Shank_Length = 0.0 +op.bf_Shank_Dia = 4.0 +op.bf_Phillips_Bit_Depth = 1.6330764293670654 +op.bf_Allen_Bit_Depth = 2.0 +op.bf_Allen_Bit_Flat_Distance = 3.0 +op.bf_Torx_Bit_Depth = 2.0 op.bf_Torx_Size_Type = 'bf_Torx_T20' -op.bf_Hex_Head_Height = 2.799999952316284 / 1000.0 -op.bf_Hex_Head_Flat_Distance = 7.0 / 1000.0 -op.bf_12_Point_Head_Height = 4.0 / 1000.0 -op.bf_12_Point_Head_Flat_Distance = 4.0 / 1000.0 -op.bf_12_Point_Head_Flange_Dia = 7.22 / 1000.0 -op.bf_CounterSink_Head_Dia = 9.399999618530273 / 1000.0 -op.bf_Cap_Head_Height = 4.0 / 1000.0 -op.bf_Cap_Head_Dia = 7.0 / 1000.0 -op.bf_Dome_Head_Dia = 8.0 / 1000.0 -op.bf_Pan_Head_Dia = 8.0 / 1000.0 -op.bf_Philips_Bit_Dia = 2.5999999046325684 / 1000.0 -op.bf_Thread_Length = 8.0 / 1000.0 -op.bf_Major_Dia = 4.0 / 1000.0 -op.bf_Pitch = 0.5 / 1000.0 -op.bf_Minor_Dia = 3.4587340354919434 / 1000.0 +op.bf_Hex_Head_Height = 2.799999952316284 +op.bf_Hex_Head_Flat_Distance = 7.0 +op.bf_12_Point_Head_Height = 4.0 +op.bf_12_Point_Head_Flat_Distance = 4.0 +op.bf_12_Point_Head_Flange_Dia = 7.22 +op.bf_CounterSink_Head_Dia = 9.399999618530273 +op.bf_Cap_Head_Height = 4.0 +op.bf_Cap_Head_Dia = 7.0 +op.bf_Dome_Head_Dia = 8.0 +op.bf_Pan_Head_Dia = 8.0 +op.bf_Philips_Bit_Dia = 2.5999999046325684 +op.bf_Thread_Length = 8.0 +op.bf_Major_Dia = 4.0 +op.bf_Pitch = 0.5 +op.bf_Minor_Dia = 3.4587340354919434 op.bf_Crest_Percent = 12.5 op.bf_Root_Percent = 25 op.bf_Div_Count = 36 -op.bf_Hex_Nut_Height = 3.200000047683716 / 1000.0 -op.bf_Hex_Nut_Flat_Distance = 7.0 / 1000.0 -op.bf_12_Point_Nut_Height = 4.0 / 1000.0 -op.bf_12_Point_Nut_Flat_Distance = 4.0 / 1000.0 -op.bf_12_Point_Nut_Flange_Dia = 7.22 / 1000.0 +op.bf_Hex_Nut_Height = 3.200000047683716 +op.bf_Hex_Nut_Flat_Distance = 7.0 +op.bf_12_Point_Nut_Height = 4.0 +op.bf_12_Point_Nut_Flat_Distance = 4.0 +op.bf_12_Point_Nut_Flange_Dia = 7.22 diff --git a/source/presets/operator/mesh.bolt_add/_m5.py b/source/presets/operator/mesh.bolt_add/_m5.py index 1a43a52..ddb09fc 100644 --- a/source/presets/operator/mesh.bolt_add/_m5.py +++ b/source/presets/operator/mesh.bolt_add/_m5.py @@ -5,33 +5,33 @@ op.bf_Model_Type = 'bf_Model_Bolt' op.bf_Head_Type = 'bf_Head_Hex' op.bf_Bit_Type = 'bf_Bit_None' op.bf_Nut_Type = 'bf_Nut_Hex' -op.bf_Shank_Length = 0.0 / 1000.0 -op.bf_Shank_Dia = 5.0 / 1000.0 -op.bf_Phillips_Bit_Depth = 1.9392783641815186 / 1000.0 -op.bf_Allen_Bit_Depth = 2.5 / 1000.0 -op.bf_Allen_Bit_Flat_Distance = 4.0 / 1000.0 -op.bf_Torx_Bit_Depth = 2.5 / 1000.0 +op.bf_Shank_Length = 0.0 +op.bf_Shank_Dia = 5.0 +op.bf_Phillips_Bit_Depth = 1.9392783641815186 +op.bf_Allen_Bit_Depth = 2.5 +op.bf_Allen_Bit_Flat_Distance = 4.0 +op.bf_Torx_Bit_Depth = 2.5 op.bf_Torx_Size_Type = 'bf_Torx_T25' -op.bf_Hex_Head_Height = 3.5 / 1000.0 -op.bf_Hex_Head_Flat_Distance = 8.0 / 1000.0 -op.bf_12_Point_Head_Height = 5.0 / 1000.0 -op.bf_12_Point_Head_Flat_Distance = 5.0 / 1000.0 -op.bf_12_Point_Head_Flange_Dia = 8.72 / 1000.0 -op.bf_CounterSink_Head_Dia = 10.399999618530273 / 1000.0 -op.bf_Cap_Head_Height = 5.0 / 1000.0 -op.bf_Cap_Head_Dia = 8.5 / 1000.0 -op.bf_Dome_Head_Dia = 9.5 / 1000.0 -op.bf_Pan_Head_Dia = 9.5 / 1000.0 -op.bf_Philips_Bit_Dia = 3.0875000953674316 / 1000.0 -op.bf_Thread_Length = 10.0 / 1000.0 -op.bf_Major_Dia = 5.0 / 1000.0 -op.bf_Pitch = 0.5 / 1000.0 -op.bf_Minor_Dia = 4.458734035491943 / 1000.0 +op.bf_Hex_Head_Height = 3.5 +op.bf_Hex_Head_Flat_Distance = 8.0 +op.bf_12_Point_Head_Height = 5.0 +op.bf_12_Point_Head_Flat_Distance = 5.0 +op.bf_12_Point_Head_Flange_Dia = 8.72 +op.bf_CounterSink_Head_Dia = 10.399999618530273 +op.bf_Cap_Head_Height = 5.0 +op.bf_Cap_Head_Dia = 8.5 +op.bf_Dome_Head_Dia = 9.5 +op.bf_Pan_Head_Dia = 9.5 +op.bf_Philips_Bit_Dia = 3.0875000953674316 +op.bf_Thread_Length = 10.0 +op.bf_Major_Dia = 5.0 +op.bf_Pitch = 0.5 +op.bf_Minor_Dia = 4.458734035491943 op.bf_Crest_Percent = 12.5 op.bf_Root_Percent = 25 op.bf_Div_Count = 36 -op.bf_Hex_Nut_Height = 4.0 / 1000.0 -op.bf_Hex_Nut_Flat_Distance = 8.0 / 1000.0 -op.bf_12_Point_Nut_Height = 5.0 / 1000.0 -op.bf_12_Point_Nut_Flat_Distance = 5.0 / 1000.0 -op.bf_12_Point_Nut_Flange_Dia = 8.72 / 1000.0 +op.bf_Hex_Nut_Height = 4.0 +op.bf_Hex_Nut_Flat_Distance = 8.0 +op.bf_12_Point_Nut_Height = 5.0 +op.bf_12_Point_Nut_Flat_Distance = 5.0 +op.bf_12_Point_Nut_Flange_Dia = 8.72 diff --git a/source/presets/operator/mesh.bolt_add/_m6.py b/source/presets/operator/mesh.bolt_add/_m6.py index 33d82d7..aeed7bf 100644 --- a/source/presets/operator/mesh.bolt_add/_m6.py +++ b/source/presets/operator/mesh.bolt_add/_m6.py @@ -5,33 +5,33 @@ op.bf_Model_Type = 'bf_Model_Bolt' op.bf_Head_Type = 'bf_Head_Hex' op.bf_Bit_Type = 'bf_Bit_None' op.bf_Nut_Type = 'bf_Nut_Hex' -op.bf_Shank_Length = 0.0 / 1000.0 -op.bf_Shank_Dia = 6.0 / 1000.0 -op.bf_Phillips_Bit_Depth = 2.4496147632598877 / 1000.0 -op.bf_Allen_Bit_Depth = 3.0 / 1000.0 -op.bf_Allen_Bit_Flat_Distance = 5.0 / 1000.0 -op.bf_Torx_Bit_Depth = 3.0 / 1000.0 +op.bf_Shank_Length = 0.0 +op.bf_Shank_Dia = 6.0 +op.bf_Phillips_Bit_Depth = 2.4496147632598877 +op.bf_Allen_Bit_Depth = 3.0 +op.bf_Allen_Bit_Flat_Distance = 5.0 +op.bf_Torx_Bit_Depth = 3.0 op.bf_Torx_Size_Type = 'bf_Torx_T30' -op.bf_Hex_Head_Height = 4.0 / 1000.0 -op.bf_Hex_Head_Flat_Distance = 10.0 / 1000.0 -op.bf_12_Point_Head_Height = 6.0 / 1000.0 -op.bf_12_Point_Head_Flat_Distance = 6.0 / 1000.0 -op.bf_12_Point_Head_Flange_Dia = 10.22 / 1000.0 -op.bf_CounterSink_Head_Dia = 12.600000381469727 / 1000.0 -op.bf_Cap_Head_Height = 6.0 / 1000.0 -op.bf_Cap_Head_Dia = 10.0 / 1000.0 -op.bf_Dome_Head_Dia = 12.0 / 1000.0 -op.bf_Pan_Head_Dia = 12.0 / 1000.0 -op.bf_Philips_Bit_Dia = 3.9000000953674316 / 1000.0 -op.bf_Thread_Length = 12.0 / 1000.0 -op.bf_Major_Dia = 6.0 / 1000.0 -op.bf_Pitch = 0.75 / 1000.0 -op.bf_Minor_Dia = 5.188100814819336 / 1000.0 +op.bf_Hex_Head_Height = 4.0 +op.bf_Hex_Head_Flat_Distance = 10.0 +op.bf_12_Point_Head_Height = 6.0 +op.bf_12_Point_Head_Flat_Distance = 6.0 +op.bf_12_Point_Head_Flange_Dia = 10.22 +op.bf_CounterSink_Head_Dia = 12.600000381469727 +op.bf_Cap_Head_Height = 6.0 +op.bf_Cap_Head_Dia = 10.0 +op.bf_Dome_Head_Dia = 12.0 +op.bf_Pan_Head_Dia = 12.0 +op.bf_Philips_Bit_Dia = 3.9000000953674316 +op.bf_Thread_Length = 12.0 +op.bf_Major_Dia = 6.0 +op.bf_Pitch = 0.75 +op.bf_Minor_Dia = 5.188100814819336 op.bf_Crest_Percent = 12.5 op.bf_Root_Percent = 25 op.bf_Div_Count = 36 -op.bf_Hex_Nut_Height = 5.0 / 1000.0 -op.bf_Hex_Nut_Flat_Distance = 10.0 / 1000.0 -op.bf_12_Point_Nut_Height = 6.0 / 1000.0 -op.bf_12_Point_Nut_Flat_Distance = 6.0 / 1000.0 -op.bf_12_Point_Nut_Flange_Dia = 10.22 / 1000.0 +op.bf_Hex_Nut_Height = 5.0 +op.bf_Hex_Nut_Flat_Distance = 10.0 +op.bf_12_Point_Nut_Height = 6.0 +op.bf_12_Point_Nut_Flat_Distance = 6.0 +op.bf_12_Point_Nut_Flange_Dia = 10.22 diff --git a/source/presets/operator/mesh.bolt_add/_m8.py b/source/presets/operator/mesh.bolt_add/_m8.py index 8f7bb49..1386068 100644 --- a/source/presets/operator/mesh.bolt_add/_m8.py +++ b/source/presets/operator/mesh.bolt_add/_m8.py @@ -5,33 +5,33 @@ op.bf_Model_Type = 'bf_Model_Bolt' op.bf_Head_Type = 'bf_Head_Hex' op.bf_Bit_Type = 'bf_Bit_None' op.bf_Nut_Type = 'bf_Nut_Hex' -op.bf_Shank_Length = 0.0 / 1000.0 -op.bf_Shank_Dia = 8.0 / 1000.0 -op.bf_Phillips_Bit_Depth = 3.266152858734131 / 1000.0 -op.bf_Allen_Bit_Depth = 4.0 / 1000.0 -op.bf_Allen_Bit_Flat_Distance = 6.0 / 1000.0 -op.bf_Torx_Bit_Depth = 4.0 / 1000.0 +op.bf_Shank_Length = 0.0 +op.bf_Shank_Dia = 8.0 +op.bf_Phillips_Bit_Depth = 3.266152858734131 +op.bf_Allen_Bit_Depth = 4.0 +op.bf_Allen_Bit_Flat_Distance = 6.0 +op.bf_Torx_Bit_Depth = 4.0 op.bf_Torx_Size_Type = 'bf_Torx_T40' -op.bf_Hex_Head_Height = 5.300000190734863 / 1000.0 -op.bf_Hex_Head_Flat_Distance = 13.0 / 1000.0 -op.bf_12_Point_Head_Height = 8.0 / 1000.0 -op.bf_12_Point_Head_Flat_Distance = 8.0 / 1000.0 -op.bf_12_Point_Head_Flange_Dia = 13.27 / 1000.0 -op.bf_CounterSink_Head_Dia = 17.299999237060547 / 1000.0 -op.bf_Cap_Head_Height = 8.0 / 1000.0 -op.bf_Cap_Head_Dia = 13.5 / 1000.0 -op.bf_Dome_Head_Dia = 16.0 / 1000.0 -op.bf_Pan_Head_Dia = 16.0 / 1000.0 -op.bf_Philips_Bit_Dia = 5.199999809265137 / 1000.0 -op.bf_Thread_Length = 16.0 / 1000.0 -op.bf_Major_Dia = 8.0 / 1000.0 -op.bf_Pitch = 1.0 / 1000.0 -op.bf_Minor_Dia = 6.917468070983887 / 1000.0 +op.bf_Hex_Head_Height = 5.300000190734863 +op.bf_Hex_Head_Flat_Distance = 13.0 +op.bf_12_Point_Head_Height = 8.0 +op.bf_12_Point_Head_Flat_Distance = 8.0 +op.bf_12_Point_Head_Flange_Dia = 13.27 +op.bf_CounterSink_Head_Dia = 17.299999237060547 +op.bf_Cap_Head_Height = 8.0 +op.bf_Cap_Head_Dia = 13.5 +op.bf_Dome_Head_Dia = 16.0 +op.bf_Pan_Head_Dia = 16.0 +op.bf_Philips_Bit_Dia = 5.199999809265137 +op.bf_Thread_Length = 16.0 +op.bf_Major_Dia = 8.0 +op.bf_Pitch = 1.0 +op.bf_Minor_Dia = 6.917468070983887 op.bf_Crest_Percent = 12.5 op.bf_Root_Percent = 25 op.bf_Div_Count = 36 -op.bf_Hex_Nut_Height = 6.5 / 1000.0 -op.bf_Hex_Nut_Flat_Distance = 13.0 / 1000.0 -op.bf_12_Point_Nut_Height = 8.0 / 1000.0 -op.bf_12_Point_Nut_Flat_Distance = 8.0 / 1000.0 -op.bf_12_Point_Nut_Flange_Dia = 13.27 / 1000.0 +op.bf_Hex_Nut_Height = 6.5 +op.bf_Hex_Nut_Flat_Distance = 13.0 +op.bf_12_Point_Nut_Height = 8.0 +op.bf_12_Point_Nut_Flat_Distance = 8.0 +op.bf_12_Point_Nut_Flange_Dia = 13.27 diff --git a/source/presets/operator/mesh.bolt_add/m10.py b/source/presets/operator/mesh.bolt_add/m10.py index faf892a..7efe6ec 100644 --- a/source/presets/operator/mesh.bolt_add/m10.py +++ b/source/presets/operator/mesh.bolt_add/m10.py @@ -5,33 +5,33 @@ op.bf_Model_Type = 'bf_Model_Bolt' op.bf_Head_Type = 'bf_Head_Hex' op.bf_Bit_Type = 'bf_Bit_None' op.bf_Nut_Type = 'bf_Nut_Hex' -op.bf_Shank_Length = 0.0 / 1000.0 -op.bf_Shank_Dia = 10.0 / 1000.0 -op.bf_Phillips_Bit_Depth = 4.082691192626953 / 1000.0 -op.bf_Allen_Bit_Depth = 5.0 / 1000.0 -op.bf_Allen_Bit_Flat_Distance = 8.0 / 1000.0 -op.bf_Torx_Bit_Depth = 5.0 / 1000.0 +op.bf_Shank_Length = 0.0 +op.bf_Shank_Dia = 10.0 +op.bf_Phillips_Bit_Depth = 4.082691192626953 +op.bf_Allen_Bit_Depth = 5.0 +op.bf_Allen_Bit_Flat_Distance = 8.0 +op.bf_Torx_Bit_Depth = 5.0 op.bf_Torx_Size_Type = 'bf_Torx_T50' -op.bf_Hex_Head_Height = 6.400000095367432 / 1000.0 -op.bf_Hex_Head_Flat_Distance = 17.0 / 1000.0 -op.bf_12_Point_Head_Height = 10.0 / 1000.0 -op.bf_12_Point_Head_Flat_Distance = 10.0 / 1000.0 -op.bf_12_Point_Head_Flange_Dia = 16.27 / 1000.0 -op.bf_CounterSink_Head_Dia = 20.0 / 1000.0 -op.bf_Cap_Head_Height = 10.0 / 1000.0 -op.bf_Cap_Head_Dia = 16.0 / 1000.0 -op.bf_Dome_Head_Dia = 20.0 / 1000.0 -op.bf_Pan_Head_Dia = 20.0 / 1000.0 -op.bf_Philips_Bit_Dia = 6.5 / 1000.0 -op.bf_Thread_Length = 20.0 / 1000.0 -op.bf_Major_Dia = 10.0 / 1000.0 -op.bf_Pitch = 1.25 / 1000.0 -op.bf_Minor_Dia = 8.646835327148438 / 1000.0 +op.bf_Hex_Head_Height = 6.400000095367432 +op.bf_Hex_Head_Flat_Distance = 17.0 +op.bf_12_Point_Head_Height = 10.0 +op.bf_12_Point_Head_Flat_Distance = 10.0 +op.bf_12_Point_Head_Flange_Dia = 16.27 +op.bf_CounterSink_Head_Dia = 20.0 +op.bf_Cap_Head_Height = 10.0 +op.bf_Cap_Head_Dia = 16.0 +op.bf_Dome_Head_Dia = 20.0 +op.bf_Pan_Head_Dia = 20.0 +op.bf_Philips_Bit_Dia = 6.5 +op.bf_Thread_Length = 20.0 +op.bf_Major_Dia = 10.0 +op.bf_Pitch = 1.25 +op.bf_Minor_Dia = 8.646835327148438 op.bf_Crest_Percent = 12.5 op.bf_Root_Percent = 25 op.bf_Div_Count = 36 -op.bf_Hex_Nut_Height = 8.0 / 1000.0 -op.bf_Hex_Nut_Flat_Distance = 17.0 / 1000.0 -op.bf_12_Point_Nut_Height = 10.0 / 1000.0 -op.bf_12_Point_Nut_Flat_Distance = 10.0 / 1000.0 -op.bf_12_Point_Nut_Flange_Dia = 16.27 / 1000.0 +op.bf_Hex_Nut_Height = 8.0 +op.bf_Hex_Nut_Flat_Distance = 17.0 +op.bf_12_Point_Nut_Height = 10.0 +op.bf_12_Point_Nut_Flat_Distance = 10.0 +op.bf_12_Point_Nut_Flange_Dia = 16.27 diff --git a/source/presets/operator/mesh.bolt_add/m12.py b/source/presets/operator/mesh.bolt_add/m12.py index 8ffc693..8ede454 100644 --- a/source/presets/operator/mesh.bolt_add/m12.py +++ b/source/presets/operator/mesh.bolt_add/m12.py @@ -5,33 +5,33 @@ op.bf_Model_Type = 'bf_Model_Bolt' op.bf_Head_Type = 'bf_Head_Hex' op.bf_Bit_Type = 'bf_Bit_None' op.bf_Nut_Type = 'bf_Nut_Hex' -op.bf_Shank_Length = 33.0 / 1000.0 -op.bf_Shank_Dia = 12.0 / 1000.0 -op.bf_Phillips_Bit_Depth = 4.899229526519775 / 1000.0 -op.bf_Allen_Bit_Depth = 6.0 / 1000.0 -op.bf_Allen_Bit_Flat_Distance = 10.0 / 1000.0 -op.bf_Torx_Bit_Depth = 6.0 / 1000.0 +op.bf_Shank_Length = 33.0 +op.bf_Shank_Dia = 12.0 +op.bf_Phillips_Bit_Depth = 4.899229526519775 +op.bf_Allen_Bit_Depth = 6.0 +op.bf_Allen_Bit_Flat_Distance = 10.0 +op.bf_Torx_Bit_Depth = 6.0 op.bf_Torx_Size_Type = 'bf_Torx_T55' -op.bf_Hex_Head_Height = 7.5 / 1000.0 -op.bf_Hex_Head_Flat_Distance = 19.0 / 1000.0 -op.bf_12_Point_Head_Height = 12.0 / 1000.0 -op.bf_12_Point_Head_Flat_Distance = 12.0 / 1000.0 -op.bf_12_Point_Head_Flange_Dia = 18.27 / 1000.0 -op.bf_CounterSink_Head_Dia = 22.0 / 1000.0 -op.bf_Cap_Head_Height = 12.0 / 1000.0 -op.bf_Cap_Head_Dia = 18.5 / 1000.0 -op.bf_Dome_Head_Dia = 24.0 / 1000.0 -op.bf_Pan_Head_Dia = 24.0 / 1000.0 -op.bf_Philips_Bit_Dia = 7.800000190734863 / 1000.0 -op.bf_Thread_Length = 32.0 / 1000.0 -op.bf_Major_Dia = 12.0 / 1000.0 -op.bf_Pitch = 1.5 / 1000.0 -op.bf_Minor_Dia = 10.376201629638672 / 1000.0 +op.bf_Hex_Head_Height = 7.5 +op.bf_Hex_Head_Flat_Distance = 19.0 +op.bf_12_Point_Head_Height = 12.0 +op.bf_12_Point_Head_Flat_Distance = 12.0 +op.bf_12_Point_Head_Flange_Dia = 18.27 +op.bf_CounterSink_Head_Dia = 22.0 +op.bf_Cap_Head_Height = 12.0 +op.bf_Cap_Head_Dia = 18.5 +op.bf_Dome_Head_Dia = 24.0 +op.bf_Pan_Head_Dia = 24.0 +op.bf_Philips_Bit_Dia = 7.800000190734863 +op.bf_Thread_Length = 32.0 +op.bf_Major_Dia = 12.0 +op.bf_Pitch = 1.5 +op.bf_Minor_Dia = 10.376201629638672 op.bf_Crest_Percent = 12.5 op.bf_Root_Percent = 25 op.bf_Div_Count = 36 -op.bf_Hex_Nut_Height = 10.0 / 1000.0 -op.bf_Hex_Nut_Flat_Distance = 19.0 / 1000.0 -op.bf_12_Point_Nut_Height = 12.0 / 1000.0 -op.bf_12_Point_Nut_Flat_Distance = 12.0 / 1000.0 -op.bf_12_Point_Nut_Flange_Dia = 18.27 / 1000.0 +op.bf_Hex_Nut_Height = 10.0 +op.bf_Hex_Nut_Flat_Distance = 19.0 +op.bf_12_Point_Nut_Height = 12.0 +op.bf_12_Point_Nut_Flat_Distance = 12.0 +op.bf_12_Point_Nut_Flange_Dia = 18.27 -- 2.30.2 From 83420f20d14c8713d6c15cffcd0ae6f9a8fb237c Mon Sep 17 00:00:00 2001 From: Ado Date: Fri, 15 Nov 2024 20:52:06 +0100 Subject: [PATCH 2/5] added "(mm)" to all labels to help with dimension clarity --- source/Boltfactory.py | 52 +++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/source/Boltfactory.py b/source/Boltfactory.py index 6f18bb6..40fb855 100644 --- a/source/Boltfactory.py +++ b/source/Boltfactory.py @@ -81,14 +81,14 @@ class add_mesh_bolt(Operator, AddObjectHelper): # Shank Types bf_Shank_Length: FloatProperty( attr='bf_Shank_Length', - name='Shank Length', default=0, + name='Shank Length (mm)', default=0, min=0, soft_min=0, max=MAX_INPUT_NUMBER, description='Length of the unthreaded shank', unit='NONE', ) # type: ignore bf_Shank_Dia: FloatProperty( attr='bf_Shank_Dia', - name='Shank Dia', default=3, + name='Shank Dia (mm)', default=3, min=0, soft_min=0, max=MAX_INPUT_NUMBER, description='Diameter of the shank', @@ -96,7 +96,7 @@ class add_mesh_bolt(Operator, AddObjectHelper): ) # type: ignore bf_Phillips_Bit_Depth: FloatProperty( attr='bf_Phillips_Bit_Depth', - name='Bit Depth', default=1.1431535482406616, + name='Bit Depth (mm)', default=1.1431535482406616, min=0, soft_min=0, max=MAX_INPUT_NUMBER, description='Depth of the Phillips Bit', @@ -104,7 +104,7 @@ class add_mesh_bolt(Operator, AddObjectHelper): ) bf_Allen_Bit_Depth: FloatProperty( attr='bf_Allen_Bit_Depth', - name='Bit Depth', default=1.5, + name='Bit Depth (mm)', default=1.5, min=0, soft_min=0, max=MAX_INPUT_NUMBER, description='Depth of the Allen Bit', @@ -112,7 +112,7 @@ class add_mesh_bolt(Operator, AddObjectHelper): ) bf_Allen_Bit_Flat_Distance: FloatProperty( attr='bf_Allen_Bit_Flat_Distance', - name='Flat Dist', default=2.5, + name='Flat Dist (mm)', default=2.5, min=0, soft_min=0, max=MAX_INPUT_NUMBER, description='Flat Distance of the Allen Bit', @@ -136,7 +136,7 @@ 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 (mm)', default=1.5, min=0, soft_min=0, max=MAX_INPUT_NUMBER, description='Depth of the Torx Bit', @@ -144,14 +144,14 @@ class add_mesh_bolt(Operator, AddObjectHelper): ) bf_Hex_Head_Height: FloatProperty( attr='bf_Hex_Head_Height', - name='Head Height', default=2, + name='Head Height (mm)', default=2, min=0, soft_min=0, max=MAX_INPUT_NUMBER, description='Height of the Hex Head', unit='NONE', ) bf_Hex_Head_Flat_Distance: FloatProperty( attr='bf_Hex_Head_Flat_Distance', - name='Flat Dist', default=5.5, + name='Flat Dist (mm)', default=5.5, min=0, soft_min=0, max=MAX_INPUT_NUMBER, description='Flat Distance of the Hex Head', @@ -159,14 +159,14 @@ class add_mesh_bolt(Operator, AddObjectHelper): ) bf_12_Point_Head_Height: FloatProperty( attr='bf_12_Point_Head_Height', - name='Head Height', default=3.0, + name='Head Height (mm)', default=3.0, min=0, soft_min=0, max=MAX_INPUT_NUMBER, description='Height of the 12 Point Head', unit='NONE', ) bf_12_Point_Head_Flat_Distance: FloatProperty( attr='bf_12_Point_Head_Flat_Distance', - name='Flat Dist', default=3.0, + name='Flat Dist (mm)', default=3.0, min=0.001, soft_min=0, # limit to 0.001*createMesh.GLOBAL_SCALE to avoid calculation error max=MAX_INPUT_NUMBER, description='Flat Distance of the 12 Point Head', @@ -174,7 +174,7 @@ class add_mesh_bolt(Operator, AddObjectHelper): ) 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 (mm)', default=5.5, min=0, soft_min=0, max=MAX_INPUT_NUMBER, description='Flange diameter of the 12 point Head', @@ -182,7 +182,7 @@ class add_mesh_bolt(Operator, AddObjectHelper): ) bf_CounterSink_Head_Dia: FloatProperty( attr='bf_CounterSink_Head_Dia', - name='Head Dia', default=6.300000190734863, + name='Head Dia (mm)', default=6.300000190734863, min=0, soft_min=0, max=MAX_INPUT_NUMBER, description='Diameter of the Counter Sink Head', @@ -190,7 +190,7 @@ class add_mesh_bolt(Operator, AddObjectHelper): ) bf_Cap_Head_Height: FloatProperty( attr='bf_Cap_Head_Height', - name='Head Height', default=3, + name='Head Height (mm)', default=3, min=0, soft_min=0, max=MAX_INPUT_NUMBER, description='Height of the Cap Head', @@ -198,7 +198,7 @@ class add_mesh_bolt(Operator, AddObjectHelper): ) bf_Cap_Head_Dia: FloatProperty( attr='bf_Cap_Head_Dia', - name='Head Dia', default=5.5, + name='Head Dia (mm)', default=5.5, min=0, soft_min=0, max=MAX_INPUT_NUMBER, description='Diameter of the Cap Head', @@ -206,7 +206,7 @@ class add_mesh_bolt(Operator, AddObjectHelper): ) bf_Dome_Head_Dia: FloatProperty( attr='bf_Dome_Head_Dia', - name='Dome Head Dia', default=5.599999904632568, + name='Dome Head Dia (mm)', default=5.599999904632568, min=0, soft_min=0, max=MAX_INPUT_NUMBER, description='Length of the unthreaded shank', @@ -214,7 +214,7 @@ class add_mesh_bolt(Operator, AddObjectHelper): ) bf_Pan_Head_Dia: FloatProperty( attr='bf_Pan_Head_Dia', - name='Pan Head Dia', default=5.599999904632568, + name='Pan Head Dia (mm)', default=5.599999904632568, min=0, soft_min=0, max=MAX_INPUT_NUMBER, description='Diameter of the Pan Head', @@ -223,7 +223,7 @@ class add_mesh_bolt(Operator, AddObjectHelper): bf_Philips_Bit_Dia: FloatProperty( attr='bf_Philips_Bit_Dia', - name='Bit Dia', default=1.8199999332427979, + name='Bit Dia (mm)', default=1.8199999332427979, min=0, soft_min=0, max=MAX_INPUT_NUMBER, description='Diameter of the Philips Bit', @@ -232,7 +232,7 @@ class add_mesh_bolt(Operator, AddObjectHelper): bf_Thread_Length: FloatProperty( attr='bf_Thread_Length', - name='Thread Length', default=6, + name='Thread Length (mm)', default=6, min=0, soft_min=0, max=MAX_INPUT_NUMBER, description='Length of the Thread', @@ -241,7 +241,7 @@ class add_mesh_bolt(Operator, AddObjectHelper): bf_Major_Dia: FloatProperty( attr='bf_Major_Dia', - name='Major Dia', default=3, + name='Major Dia (mm)', default=3, min=0, soft_min=0, max=MAX_INPUT_NUMBER, description='Outside diameter of the Thread', @@ -250,7 +250,7 @@ class add_mesh_bolt(Operator, AddObjectHelper): bf_Pitch: FloatProperty( attr='bf_Pitch', - name='Pitch', default=0.3499999940395355, + name='Pitch (mm)', default=0.3499999940395355, min=0.1, soft_min=0.1, max=7.0, description='Pitch if the thread', @@ -258,7 +258,7 @@ class add_mesh_bolt(Operator, AddObjectHelper): ) bf_Minor_Dia: FloatProperty( attr='bf_Minor_Dia', - name='Minor Dia', default=2.6211137771606445, + name='Minor Dia (mm)', default=2.6211137771606445, min=0, soft_min=0, max=MAX_INPUT_NUMBER, description='Inside diameter of the Thread', @@ -287,7 +287,7 @@ class add_mesh_bolt(Operator, AddObjectHelper): ) bf_Hex_Nut_Height: FloatProperty( attr='bf_Hex_Nut_Height', - name='Hex Nut Height', default=2.4000000953674316, + name='Hex Nut Height (mm)', default=2.4000000953674316, min=0, soft_min=0, max=MAX_INPUT_NUMBER, description='Height of the Hex Nut', @@ -295,7 +295,7 @@ class add_mesh_bolt(Operator, AddObjectHelper): ) 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 (mm)', default=5.5, min=0, soft_min=0, max=MAX_INPUT_NUMBER, description='Flat distance of the Hex Nut', @@ -303,7 +303,7 @@ class add_mesh_bolt(Operator, AddObjectHelper): ) 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 (mm)', default=2.4000000953674316, min=0, soft_min=0, max=MAX_INPUT_NUMBER, description='Height of the 12 Point Nut', @@ -312,7 +312,7 @@ class add_mesh_bolt(Operator, AddObjectHelper): bf_12_Point_Nut_Flat_Distance: FloatProperty( attr='bf_12_Point_Nut_Flat_Distance', - name='12 Point Nut Flat Dist', default=3.0, + name='12 Point Nut Flat Dist (mm)', default=3.0, min=0.001, soft_min=0, # limit to 0.001 to avoid calculation error max=MAX_INPUT_NUMBER, description='Flat distance of the 12 point Nut', @@ -320,7 +320,7 @@ class add_mesh_bolt(Operator, AddObjectHelper): ) 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 (mm)', default=5.5, min=0, soft_min=0, max=MAX_INPUT_NUMBER, description='Flange diameter of the 12 point Nut', -- 2.30.2 From 136d79fce21ffef57a2711c0e2d88c8b0ebdae1c Mon Sep 17 00:00:00 2001 From: Ado Date: Sat, 16 Nov 2024 10:35:53 +0100 Subject: [PATCH 3/5] Added option to select head type "none" --- source/Boltfactory.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/source/Boltfactory.py b/source/Boltfactory.py index 40fb855..caa4734 100644 --- a/source/Boltfactory.py +++ b/source/Boltfactory.py @@ -28,6 +28,11 @@ class add_mesh_bolt(Operator, AddObjectHelper): MAX_INPUT_NUMBER = 250 # mm + def update_head_type(self, context): + # Reset bit type when head type is set to None. + if self.bf_Head_Type == 'bf_Head_None': + self.bf_Bit_Type = 'bf_Bit_None' + Bolt: BoolProperty(name="Bolt", default=True, description="Bolt") @@ -45,7 +50,8 @@ class add_mesh_bolt(Operator, AddObjectHelper): items=Model_Type_List, default='bf_Model_Bolt' ) # Head Types - Model_Type_List = [('bf_Head_Hex', 'HEX', 'Hex Head'), + Model_Type_List = [('bf_Head_None', 'NONE', 'No Head'), + ('bf_Head_Hex', 'HEX', 'Hex Head'), ('bf_Head_12Pnt', '12 POINT', '12 Point Head'), ('bf_Head_Cap', 'CAP', 'Cap Head'), ('bf_Head_Dome', 'DOME', 'Dome Head'), @@ -55,7 +61,8 @@ class add_mesh_bolt(Operator, AddObjectHelper): attr='bf_Head_Type', name='Head', description='Choose the type off Head you would like', - items=Model_Type_List, default='bf_Head_Hex' + items=Model_Type_List, default='bf_Head_Hex', + update=update_head_type # Call this function when the head type changes ) # Bit Types Bit_Type_List = [('bf_Bit_None', 'NONE', 'No Bit Type'), @@ -337,7 +344,10 @@ class add_mesh_bolt(Operator, AddObjectHelper): # Bit if self.bf_Model_Type == 'bf_Model_Bolt': - col.prop(self, 'bf_Bit_Type') + if self.bf_Head_Type == 'bf_Head_None': + col.label(text="No bit type availabe when Head is None.") + else: + col.prop(self, 'bf_Bit_Type') if self.bf_Bit_Type == 'bf_Bit_None': pass elif self.bf_Bit_Type == 'bf_Bit_Allen': @@ -353,7 +363,9 @@ class add_mesh_bolt(Operator, AddObjectHelper): # Head if self.bf_Model_Type == 'bf_Model_Bolt': col.prop(self, 'bf_Head_Type') - if self.bf_Head_Type == 'bf_Head_Hex': + if self.bf_Head_Type == 'bf_Head_None': + pass + elif self.bf_Head_Type == 'bf_Head_Hex': col.prop(self, 'bf_Hex_Head_Height') col.prop(self, 'bf_Hex_Head_Flat_Distance') elif self.bf_Head_Type == 'bf_Head_12Pnt': -- 2.30.2 From c91e27dca585ce88d6756d45e93d87d99be025de Mon Sep 17 00:00:00 2001 From: Ado Date: Wed, 20 Nov 2024 19:57:52 +0100 Subject: [PATCH 4/5] removed unnecessary multiplication --- source/Boltfactory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/Boltfactory.py b/source/Boltfactory.py index caa4734..b3e90b4 100644 --- a/source/Boltfactory.py +++ b/source/Boltfactory.py @@ -427,7 +427,7 @@ class add_mesh_bolt(Operator, AddObjectHelper): # regardless of the unit scale setting in the scene. It normalizes the scale to maintain # consistent dimensions across various unit configurations. scene = context.scene - adjusted_scale = 1 * (0.001 / scene.unit_settings.scale_length) + adjusted_scale = 0.001 / scene.unit_settings.scale_length if bpy.context.mode == "OBJECT": if context.selected_objects != [] and context.active_object and \ -- 2.30.2 From 2fa0e0e5510e273efa4dff0cce594eece609d1c8 Mon Sep 17 00:00:00 2001 From: Ado Date: Fri, 22 Nov 2024 14:39:48 +0100 Subject: [PATCH 5/5] updated inaccurate comment --- source/Boltfactory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/Boltfactory.py b/source/Boltfactory.py index b3e90b4..bf7566d 100644 --- a/source/Boltfactory.py +++ b/source/Boltfactory.py @@ -174,7 +174,7 @@ class add_mesh_bolt(Operator, AddObjectHelper): bf_12_Point_Head_Flat_Distance: FloatProperty( attr='bf_12_Point_Head_Flat_Distance', name='Flat Dist (mm)', default=3.0, - min=0.001, soft_min=0, # limit to 0.001*createMesh.GLOBAL_SCALE to avoid calculation error + min=0.001, soft_min=0, # limit to 0.001 to avoid calculation error max=MAX_INPUT_NUMBER, description='Flat Distance of the 12 Point Head', unit='NONE', -- 2.30.2