WIP: white space changes to BoltFactory to fix flake8 #105083
@ -26,15 +26,14 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
|||||||
bl_options = {'REGISTER', 'UNDO', 'PRESET'}
|
bl_options = {'REGISTER', 'UNDO', 'PRESET'}
|
||||||
bl_description = "Construct many types of Bolts"
|
bl_description = "Construct many types of Bolts"
|
||||||
|
|
||||||
|
|
||||||
MAX_INPUT_NUMBER = 50
|
MAX_INPUT_NUMBER = 50
|
||||||
|
|
||||||
Bolt : BoolProperty(name = "Bolt",
|
Bolt: BoolProperty(name="Bolt",
|
||||||
default = True,
|
default=True,
|
||||||
description = "Bolt")
|
description="Bolt")
|
||||||
change : BoolProperty(name = "Change",
|
change: BoolProperty(name="Change",
|
||||||
default = False,
|
default=False,
|
||||||
description = "change Bolt")
|
description="change Bolt")
|
||||||
|
|
||||||
# Model Types
|
# Model Types
|
||||||
Model_Type_List = [('bf_Model_Bolt', 'BOLT', 'Bolt Model'),
|
Model_Type_List = [('bf_Model_Bolt', 'BOLT', 'Bolt Model'),
|
||||||
@ -48,10 +47,10 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
|||||||
# Head Types
|
# Head Types
|
||||||
Model_Type_List = [('bf_Head_Hex', 'HEX', 'Hex Head'),
|
Model_Type_List = [('bf_Head_Hex', 'HEX', 'Hex Head'),
|
||||||
('bf_Head_12Pnt', '12 POINT', '12 Point Head'),
|
('bf_Head_12Pnt', '12 POINT', '12 Point Head'),
|
||||||
('bf_Head_Cap', 'CAP', 'Cap Head'),
|
('bf_Head_Cap', 'CAP', 'Cap Head'),
|
||||||
('bf_Head_Dome', 'DOME', 'Dome Head'),
|
('bf_Head_Dome', 'DOME', 'Dome Head'),
|
||||||
('bf_Head_Pan', 'PAN', 'Pan Head'),
|
('bf_Head_Pan', 'PAN', 'Pan Head'),
|
||||||
('bf_Head_CounterSink', 'COUNTER SINK', 'Counter Sink Head')]
|
('bf_Head_CounterSink', 'COUNTER SINK', 'Counter Sink Head')]
|
||||||
bf_Head_Type: EnumProperty(
|
bf_Head_Type: EnumProperty(
|
||||||
attr='bf_Head_Type',
|
attr='bf_Head_Type',
|
||||||
name='Head',
|
name='Head',
|
||||||
@ -60,9 +59,9 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
|||||||
)
|
)
|
||||||
# Bit Types
|
# Bit Types
|
||||||
Bit_Type_List = [('bf_Bit_None', 'NONE', 'No Bit Type'),
|
Bit_Type_List = [('bf_Bit_None', 'NONE', 'No Bit Type'),
|
||||||
('bf_Bit_Allen', 'ALLEN', 'Allen Bit Type'),
|
('bf_Bit_Allen', 'ALLEN', 'Allen Bit Type'),
|
||||||
('bf_Bit_Torx', 'TORX', 'Torx Bit Type'),
|
('bf_Bit_Torx', 'TORX', 'Torx Bit Type'),
|
||||||
('bf_Bit_Philips', 'PHILLIPS', 'Phillips Bit Type')]
|
('bf_Bit_Philips', 'PHILLIPS', 'Phillips Bit Type')]
|
||||||
bf_Bit_Type: EnumProperty(
|
bf_Bit_Type: EnumProperty(
|
||||||
attr='bf_Bit_Type',
|
attr='bf_Bit_Type',
|
||||||
name='Bit Type',
|
name='Bit Type',
|
||||||
@ -71,8 +70,8 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
|||||||
)
|
)
|
||||||
# Nut Types
|
# Nut Types
|
||||||
Nut_Type_List = [('bf_Nut_Hex', 'HEX', 'Hex Nut'),
|
Nut_Type_List = [('bf_Nut_Hex', 'HEX', 'Hex Nut'),
|
||||||
('bf_Nut_Lock', 'LOCK', 'Lock Nut'),
|
('bf_Nut_Lock', 'LOCK', 'Lock Nut'),
|
||||||
('bf_Nut_12Pnt', '12 POINT', '12 Point Nut')]
|
('bf_Nut_12Pnt', '12 POINT', '12 Point Nut')]
|
||||||
bf_Nut_Type: EnumProperty(
|
bf_Nut_Type: EnumProperty(
|
||||||
attr='bf_Nut_Type',
|
attr='bf_Nut_Type',
|
||||||
name='Nut Type',
|
name='Nut Type',
|
||||||
@ -121,13 +120,13 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
|||||||
)
|
)
|
||||||
# Torx Size Types
|
# Torx Size Types
|
||||||
Torx_Size_Type_List = [('bf_Torx_T10', 'T10', 'T10'),
|
Torx_Size_Type_List = [('bf_Torx_T10', 'T10', 'T10'),
|
||||||
('bf_Torx_T20', 'T20', 'T20'),
|
('bf_Torx_T20', 'T20', 'T20'),
|
||||||
('bf_Torx_T25', 'T25', 'T25'),
|
('bf_Torx_T25', 'T25', 'T25'),
|
||||||
('bf_Torx_T30', 'T30', 'T30'),
|
('bf_Torx_T30', 'T30', 'T30'),
|
||||||
('bf_Torx_T40', 'T40', 'T40'),
|
('bf_Torx_T40', 'T40', 'T40'),
|
||||||
('bf_Torx_T50', 'T50', 'T50'),
|
('bf_Torx_T50', 'T50', 'T50'),
|
||||||
('bf_Torx_T55', 'T55', 'T55'),
|
('bf_Torx_T55', 'T55', 'T55'),
|
||||||
]
|
]
|
||||||
|
|
||||||
bf_Torx_Size_Type: EnumProperty(
|
bf_Torx_Size_Type: EnumProperty(
|
||||||
attr='bf_Torx_Size_Type',
|
attr='bf_Torx_Size_Type',
|
||||||
@ -168,7 +167,7 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
|||||||
bf_12_Point_Head_Flat_Distance: FloatProperty(
|
bf_12_Point_Head_Flat_Distance: FloatProperty(
|
||||||
attr='bf_12_Point_Head_Flat_Distance',
|
attr='bf_12_Point_Head_Flat_Distance',
|
||||||
name='Flat Dist', default=3.0,
|
name='Flat Dist', default=3.0,
|
||||||
min=0.001, soft_min=0, #limit to 0.001 to avoid calculation error
|
min=0.001, soft_min=0, # limit to 0.001 to avoid calculation error
|
||||||
max=MAX_INPUT_NUMBER,
|
max=MAX_INPUT_NUMBER,
|
||||||
description='Flat Distance of the 12 Point Head',
|
description='Flat Distance of the 12 Point Head',
|
||||||
unit='LENGTH',
|
unit='LENGTH',
|
||||||
@ -327,6 +326,7 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
|||||||
description='Flange diameter of the 12 point Nut',
|
description='Flange diameter of the 12 point Nut',
|
||||||
unit='LENGTH',
|
unit='LENGTH',
|
||||||
)
|
)
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
col = layout.column()
|
col = layout.column()
|
||||||
@ -387,8 +387,6 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
|||||||
col.prop(self, 'bf_Hex_Nut_Height')
|
col.prop(self, 'bf_Hex_Nut_Height')
|
||||||
col.prop(self, 'bf_Hex_Nut_Flat_Distance')
|
col.prop(self, 'bf_Hex_Nut_Flat_Distance')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Thread
|
# Thread
|
||||||
col.label(text='Thread')
|
col.label(text='Thread')
|
||||||
if self.bf_Model_Type == 'bf_Model_Bolt':
|
if self.bf_Model_Type == 'bf_Model_Bolt':
|
||||||
@ -416,7 +414,7 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
|||||||
if bpy.context.mode == "OBJECT":
|
if bpy.context.mode == "OBJECT":
|
||||||
if context.selected_objects != [] and context.active_object and \
|
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 \
|
(context.active_object.data is not None) and ('Bolt' in context.active_object.data.keys()) and \
|
||||||
(self.change == True):
|
(self.change == True):
|
||||||
obj = context.active_object
|
obj = context.active_object
|
||||||
use_smooth = bool(obj.data.polygons[0].use_smooth) # Copy value, do not take a reference
|
use_smooth = bool(obj.data.polygons[0].use_smooth) # Copy value, do not take a reference
|
||||||
|
|
||||||
@ -467,6 +465,7 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
|||||||
|
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
# Register:
|
# Register:
|
||||||
def Bolt_contex_menu(self, context):
|
def Bolt_contex_menu(self, context):
|
||||||
bl_label = 'Change'
|
bl_label = 'Change'
|
||||||
@ -481,18 +480,19 @@ def Bolt_contex_menu(self, context):
|
|||||||
setattr(props, prm, obj.data[prm])
|
setattr(props, prm, obj.data[prm])
|
||||||
layout.separator()
|
layout.separator()
|
||||||
|
|
||||||
|
|
||||||
def menu_func_bolt(self, context):
|
def menu_func_bolt(self, context):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
layout.separator()
|
layout.separator()
|
||||||
oper = self.layout.operator(add_mesh_bolt.bl_idname, text="Bolt", icon="MOD_SCREW")
|
oper = self.layout.operator(add_mesh_bolt.bl_idname, text="Bolt", icon="MOD_SCREW")
|
||||||
oper.change = False
|
oper.change = False
|
||||||
|
|
||||||
|
|
||||||
classes = (
|
classes = (
|
||||||
add_mesh_bolt,
|
add_mesh_bolt,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
for cls in classes:
|
for cls in classes:
|
||||||
bpy.utils.register_class(cls)
|
bpy.utils.register_class(cls)
|
||||||
@ -506,35 +506,36 @@ def unregister():
|
|||||||
for cls in reversed(classes):
|
for cls in reversed(classes):
|
||||||
bpy.utils.unregister_class(cls)
|
bpy.utils.unregister_class(cls)
|
||||||
|
|
||||||
|
|
||||||
def BoltParameters():
|
def BoltParameters():
|
||||||
BoltParameters = [
|
BoltParameters = [
|
||||||
"bf_Model_Type",
|
"bf_Model_Type",
|
||||||
"bf_Head_Type",
|
"bf_Head_Type",
|
||||||
"bf_Bit_Type",
|
"bf_Bit_Type",
|
||||||
"bf_Nut_Type",
|
"bf_Nut_Type",
|
||||||
"bf_Shank_Length",
|
"bf_Shank_Length",
|
||||||
"bf_Shank_Dia",
|
"bf_Shank_Dia",
|
||||||
"bf_Phillips_Bit_Depth",
|
"bf_Phillips_Bit_Depth",
|
||||||
"bf_Allen_Bit_Depth",
|
"bf_Allen_Bit_Depth",
|
||||||
"bf_Allen_Bit_Flat_Distance",
|
"bf_Allen_Bit_Flat_Distance",
|
||||||
"bf_Torx_Bit_Depth",
|
"bf_Torx_Bit_Depth",
|
||||||
"bf_Torx_Size_Type",
|
"bf_Torx_Size_Type",
|
||||||
"bf_Hex_Head_Height",
|
"bf_Hex_Head_Height",
|
||||||
"bf_Hex_Head_Flat_Distance",
|
"bf_Hex_Head_Flat_Distance",
|
||||||
"bf_CounterSink_Head_Dia",
|
"bf_CounterSink_Head_Dia",
|
||||||
"bf_Cap_Head_Height",
|
"bf_Cap_Head_Height",
|
||||||
"bf_Cap_Head_Dia",
|
"bf_Cap_Head_Dia",
|
||||||
"bf_Dome_Head_Dia",
|
"bf_Dome_Head_Dia",
|
||||||
"bf_Pan_Head_Dia",
|
"bf_Pan_Head_Dia",
|
||||||
"bf_Philips_Bit_Dia",
|
"bf_Philips_Bit_Dia",
|
||||||
"bf_Thread_Length",
|
"bf_Thread_Length",
|
||||||
"bf_Major_Dia",
|
"bf_Major_Dia",
|
||||||
"bf_Pitch",
|
"bf_Pitch",
|
||||||
"bf_Minor_Dia",
|
"bf_Minor_Dia",
|
||||||
"bf_Crest_Percent",
|
"bf_Crest_Percent",
|
||||||
"bf_Root_Percent",
|
"bf_Root_Percent",
|
||||||
"bf_Div_Count",
|
"bf_Div_Count",
|
||||||
"bf_Hex_Nut_Height",
|
"bf_Hex_Nut_Height",
|
||||||
"bf_Hex_Nut_Flat_Distance",
|
"bf_Hex_Nut_Flat_Distance",
|
||||||
]
|
]
|
||||||
return BoltParameters
|
return BoltParameters
|
||||||
|
@ -28,12 +28,10 @@ import bpy
|
|||||||
# ### REGISTER ###
|
# ### REGISTER ###
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
Boltfactory.register()
|
Boltfactory.register()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def unregister():
|
def unregister():
|
||||||
Boltfactory.unregister()
|
Boltfactory.unregister()
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ from mathutils import (
|
|||||||
)
|
)
|
||||||
from math import (
|
from math import (
|
||||||
sin, cos,
|
sin, cos,
|
||||||
tan, radians,atan,degrees
|
tan, radians, atan, degrees
|
||||||
)
|
)
|
||||||
from random import triangular
|
from random import triangular
|
||||||
from bpy_extras.object_utils import AddObjectHelper, object_data_add
|
from bpy_extras.object_utils import AddObjectHelper, object_data_add
|
||||||
@ -272,13 +272,14 @@ def Fill_Ring_Face(OFFSET, NUM, FACE_DOWN=0):
|
|||||||
Face[2] = TempFace[2]
|
Face[2] = TempFace[2]
|
||||||
return Ret
|
return Ret
|
||||||
|
|
||||||
|
|
||||||
# Returns a list of faces that makes up a fill pattern around the last vert
|
# Returns a list of faces that makes up a fill pattern around the last vert
|
||||||
def Fill_Fan_Face(OFFSET, NUM, FACE_DOWN=0):
|
def Fill_Fan_Face(OFFSET, NUM, FACE_DOWN=0):
|
||||||
Ret = []
|
Ret = []
|
||||||
Face = [NUM-1,0,1]
|
Face = [NUM-1, 0, 1]
|
||||||
TempFace = [0, 0, 0]
|
TempFace = [0, 0, 0]
|
||||||
A = 0
|
A = 0
|
||||||
#B = 1 unused
|
# B = 1 unused
|
||||||
C = 2
|
C = 2
|
||||||
if NUM < 3:
|
if NUM < 3:
|
||||||
return None
|
return None
|
||||||
@ -296,10 +297,10 @@ def Fill_Fan_Face(OFFSET, NUM, FACE_DOWN=0):
|
|||||||
Face[2] = TempFace[2]
|
Face[2] = TempFace[2]
|
||||||
return Ret
|
return Ret
|
||||||
|
|
||||||
|
|
||||||
# ####################################################################
|
# ####################################################################
|
||||||
# Create Allen Bit
|
# Create Allen Bit
|
||||||
# ####################################################################
|
# ####################################################################
|
||||||
|
|
||||||
def Allen_Fill(OFFSET, FLIP=0):
|
def Allen_Fill(OFFSET, FLIP=0):
|
||||||
faces = []
|
faces = []
|
||||||
Lookup = [[19, 1, 0],
|
Lookup = [[19, 1, 0],
|
||||||
@ -388,10 +389,11 @@ def Create_Allen_Bit(FLAT_DISTANCE, HEIGHT):
|
|||||||
faces.extend(M_Faces)
|
faces.extend(M_Faces)
|
||||||
|
|
||||||
return verts, faces, OUTTER_RADIUS * 2.0
|
return verts, faces, OUTTER_RADIUS * 2.0
|
||||||
|
|
||||||
|
|
||||||
# ####################################################################
|
# ####################################################################
|
||||||
# Create Torx Bit
|
# Create Torx Bit
|
||||||
# ####################################################################
|
# ####################################################################
|
||||||
|
|
||||||
def Torx_Bit_Size_To_Point_Distance(Bit_Size):
|
def Torx_Bit_Size_To_Point_Distance(Bit_Size):
|
||||||
if Bit_Size == 'bf_Torx_T10':
|
if Bit_Size == 'bf_Torx_T10':
|
||||||
return 2.83
|
return 2.83
|
||||||
@ -408,70 +410,70 @@ def Torx_Bit_Size_To_Point_Distance(Bit_Size):
|
|||||||
elif Bit_Size == 'bf_Torx_T55':
|
elif Bit_Size == 'bf_Torx_T55':
|
||||||
return 8.94
|
return 8.94
|
||||||
else:
|
else:
|
||||||
return 2.83 #default to M3
|
return 2.83 # default to M3
|
||||||
|
|
||||||
|
|
||||||
def Torx_Fill(OFFSET, FLIP=0):
|
def Torx_Fill(OFFSET, FLIP=0):
|
||||||
faces = []
|
faces = []
|
||||||
Lookup = [[0,10,11],
|
Lookup = [[0, 10, 11],
|
||||||
[0,11, 12],
|
[0, 11, 12],
|
||||||
[0,12,1],
|
[0, 12, 1],
|
||||||
|
|
||||||
[1, 12, 13],
|
[1, 12, 13],
|
||||||
[1, 13, 14],
|
[1, 13, 14],
|
||||||
[1, 14, 15],
|
[1, 14, 15],
|
||||||
[1, 15, 2],
|
[1, 15, 2],
|
||||||
|
|
||||||
[2, 15, 16],
|
[2, 15, 16],
|
||||||
[2, 16, 17],
|
[2, 16, 17],
|
||||||
[2, 17, 18],
|
[2, 17, 18],
|
||||||
[2, 18, 19],
|
[2, 18, 19],
|
||||||
[2, 19, 3],
|
[2, 19, 3],
|
||||||
|
|
||||||
[3, 19, 20],
|
[3, 19, 20],
|
||||||
[3, 20, 21],
|
[3, 20, 21],
|
||||||
[3, 21, 22],
|
[3, 21, 22],
|
||||||
[3, 22, 23],
|
[3, 22, 23],
|
||||||
[3, 23, 24],
|
[3, 23, 24],
|
||||||
[3, 24, 25],
|
[3, 24, 25],
|
||||||
[3, 25, 4],
|
[3, 25, 4],
|
||||||
|
|
||||||
|
[4, 25, 26],
|
||||||
|
[4, 26, 27],
|
||||||
|
[4, 27, 28],
|
||||||
|
[4, 28, 29],
|
||||||
|
[4, 29, 30],
|
||||||
|
[4, 30, 31],
|
||||||
|
[4, 31, 5],
|
||||||
|
|
||||||
[4, 25, 26],
|
[5, 31, 32],
|
||||||
[4, 26, 27],
|
[5, 32, 33],
|
||||||
[4, 27, 28],
|
[5, 33, 34],
|
||||||
[4, 28, 29],
|
[5, 34, 35],
|
||||||
[4, 29, 30],
|
[5, 35, 36],
|
||||||
[4, 30, 31],
|
[5, 36, 6],
|
||||||
[4, 31, 5],
|
|
||||||
|
|
||||||
[5, 31, 32],
|
[6, 36, 37],
|
||||||
[5, 32, 33],
|
[6, 37, 38],
|
||||||
[5, 33, 34],
|
[6, 38, 39],
|
||||||
[5, 34, 35],
|
[6, 39, 7],
|
||||||
[5, 35, 36],
|
|
||||||
[5, 36, 6],
|
|
||||||
|
|
||||||
[6, 36, 37],
|
[7, 39, 40],
|
||||||
[6, 37, 38],
|
[7, 40, 41],
|
||||||
[6, 38, 39],
|
[7, 41, 42],
|
||||||
[6, 39, 7],
|
[7, 42, 43],
|
||||||
|
[7, 43, 8],
|
||||||
|
|
||||||
[7, 39, 40],
|
[8, 43, 44],
|
||||||
[7, 40, 41],
|
[8, 44, 45],
|
||||||
[7, 41, 42],
|
[8, 45, 46],
|
||||||
[7, 42, 43],
|
[8, 46, 47],
|
||||||
[7, 43, 8],
|
[8, 47, 48],
|
||||||
|
[8, 48, 49],
|
||||||
[8, 43, 44],
|
[8, 49, 50],
|
||||||
[8, 44, 45],
|
[8, 50, 51],
|
||||||
[8, 45, 46],
|
[8, 51, 52],
|
||||||
[8, 46, 47],
|
[8, 52, 9],
|
||||||
[8, 47, 48],
|
|
||||||
[8, 48, 49],
|
|
||||||
[8, 49, 50],
|
|
||||||
[8, 50, 51],
|
|
||||||
[8, 51, 52],
|
|
||||||
[8, 52, 9],
|
|
||||||
]
|
]
|
||||||
for i in Lookup:
|
for i in Lookup:
|
||||||
if FLIP:
|
if FLIP:
|
||||||
@ -482,7 +484,6 @@ def Torx_Fill(OFFSET, FLIP=0):
|
|||||||
return faces
|
return faces
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def Create_Torx_Bit(Point_Distance, HEIGHT):
|
def Create_Torx_Bit(Point_Distance, HEIGHT):
|
||||||
verts = []
|
verts = []
|
||||||
faces = []
|
faces = []
|
||||||
@ -520,8 +521,8 @@ def Create_Torx_Bit(Point_Distance, HEIGHT):
|
|||||||
verts.append([POINT_2_X + x, POINT_2_Y + y, Curve_Height])
|
verts.append([POINT_2_X + x, POINT_2_Y + y, Curve_Height])
|
||||||
|
|
||||||
for i in range(340, 150 + 360, 10):
|
for i in range(340, 150 + 360, 10):
|
||||||
x = sin(radians(i%360)) * SMALL_RADIUS
|
x = sin(radians(i % 360)) * SMALL_RADIUS
|
||||||
y = cos(radians(i%360)) * SMALL_RADIUS
|
y = cos(radians(i % 360)) * SMALL_RADIUS
|
||||||
verts.append([POINT_3_X + x, POINT_3_Y + y, Curve_Height])
|
verts.append([POINT_3_X + x, POINT_3_Y + y, Curve_Height])
|
||||||
|
|
||||||
for i in range(320, 260, -10):
|
for i in range(320, 260, -10):
|
||||||
@ -536,16 +537,16 @@ def Create_Torx_Bit(Point_Distance, HEIGHT):
|
|||||||
y = cos(radians(i)) * OUTTER_RADIUS
|
y = cos(radians(i)) * OUTTER_RADIUS
|
||||||
verts.append([x, y, 0])
|
verts.append([x, y, 0])
|
||||||
|
|
||||||
FaceStart_Top_Curve= len(verts)
|
FaceStart_Top_Curve = len(verts)
|
||||||
Do_Curve(0)
|
Do_Curve(0)
|
||||||
faces.extend(Torx_Fill(FaceStart_Outside, 0))
|
faces.extend(Torx_Fill(FaceStart_Outside, 0))
|
||||||
|
|
||||||
FaceStart_Bottom_Curve= len(verts)
|
FaceStart_Bottom_Curve = len(verts)
|
||||||
Do_Curve(0 - HEIGHT)
|
Do_Curve(0 - HEIGHT)
|
||||||
|
|
||||||
faces.extend(Build_Face_List_Quads(FaceStart_Top_Curve,42 ,1 , True))
|
faces.extend(Build_Face_List_Quads(FaceStart_Top_Curve, 42, 1, True))
|
||||||
|
|
||||||
verts.append([0,0,0 - HEIGHT]) # add center point for fill Fan
|
verts.append([0, 0, 0 - HEIGHT]) # add center point for fill Fan
|
||||||
faces.extend(Fill_Fan_Face(FaceStart_Bottom_Curve, 44))
|
faces.extend(Fill_Fan_Face(FaceStart_Bottom_Curve, 44))
|
||||||
|
|
||||||
M_Verts, M_Faces = Mirror_Verts_Faces(verts, faces, 'x')
|
M_Verts, M_Faces = Mirror_Verts_Faces(verts, faces, 'x')
|
||||||
@ -558,10 +559,10 @@ def Create_Torx_Bit(Point_Distance, HEIGHT):
|
|||||||
|
|
||||||
return verts, faces, OUTTER_RADIUS * 2.0
|
return verts, faces, OUTTER_RADIUS * 2.0
|
||||||
|
|
||||||
|
|
||||||
# ####################################################################
|
# ####################################################################
|
||||||
# Create Phillips Bit
|
# Create Phillips Bit
|
||||||
# ####################################################################
|
# ####################################################################
|
||||||
|
|
||||||
def Phillips_Fill(OFFSET, FLIP=0):
|
def Phillips_Fill(OFFSET, FLIP=0):
|
||||||
faces = []
|
faces = []
|
||||||
Lookup = [[0, 1, 10],
|
Lookup = [[0, 1, 10],
|
||||||
@ -640,7 +641,6 @@ def Create_Phillips_Bit(FLAT_DIA, FLAT_WIDTH, HEIGHT):
|
|||||||
# ####################################################################
|
# ####################################################################
|
||||||
# Create Head Types
|
# Create Head Types
|
||||||
# ####################################################################
|
# ####################################################################
|
||||||
|
|
||||||
def Max_Pan_Bit_Dia(HEAD_DIA):
|
def Max_Pan_Bit_Dia(HEAD_DIA):
|
||||||
HEAD_RADIUS = HEAD_DIA * 0.5
|
HEAD_RADIUS = HEAD_DIA * 0.5
|
||||||
XRad = HEAD_RADIUS * 1.976
|
XRad = HEAD_RADIUS * 1.976
|
||||||
@ -1059,14 +1059,13 @@ def Create_Hex_Head(FLAT, HOLE_DIA, SHANK_DIA, HEIGHT):
|
|||||||
return Spin_Verts, Spin_Faces, 0 - (-HEIGHT)
|
return Spin_Verts, Spin_Faces, 0 - (-HEIGHT)
|
||||||
|
|
||||||
|
|
||||||
|
def Create_12_Point(FLAT, HOLE_DIA, SHANK_DIA, HEIGHT, FLANGE_DIA):
|
||||||
def Create_12_Point(FLAT, HOLE_DIA, SHANK_DIA, HEIGHT,FLANGE_DIA):
|
|
||||||
FLANGE_HEIGHT = (1.89/8.0)*HEIGHT
|
FLANGE_HEIGHT = (1.89/8.0)*HEIGHT
|
||||||
FLAT_HEIGHT = (4.18/8.0)*HEIGHT
|
FLAT_HEIGHT = (4.18/8.0)*HEIGHT
|
||||||
# FLANGE_DIA = (13.27/8.0)*FLAT
|
# FLANGE_DIA = (13.27/8.0)*FLAT
|
||||||
|
|
||||||
FLANGE_RADIUS = FLANGE_DIA * 0.5
|
FLANGE_RADIUS = FLANGE_DIA * 0.5
|
||||||
FLANGE_TAPPER_HEIGHT = HEIGHT - FLANGE_HEIGHT - FLAT_HEIGHT
|
FLANGE_TAPPER_HEIGHT = HEIGHT - FLANGE_HEIGHT - FLAT_HEIGHT
|
||||||
|
|
||||||
# HOLE_DIA = 0.0
|
# HOLE_DIA = 0.0
|
||||||
|
|
||||||
@ -1120,8 +1119,6 @@ def Create_12_Point(FLAT, HOLE_DIA, SHANK_DIA, HEIGHT,FLANGE_DIA):
|
|||||||
|
|
||||||
Row += 1
|
Row += 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# bevel
|
# bevel
|
||||||
x = sin(radians(0)) * TopBevelRadius
|
x = sin(radians(0)) * TopBevelRadius
|
||||||
y = cos(radians(0)) * TopBevelRadius
|
y = cos(radians(0)) * TopBevelRadius
|
||||||
@ -1160,41 +1157,41 @@ def Create_12_Point(FLAT, HOLE_DIA, SHANK_DIA, HEIGHT,FLANGE_DIA):
|
|||||||
|
|
||||||
Row += 1
|
Row += 1
|
||||||
|
|
||||||
|
# 45Deg bevel on the top
|
||||||
|
|
||||||
#45Deg bevel on the top
|
# First we work out how far up the Y axis the vert is
|
||||||
|
v_origin = Vector([0.0, 0.0, 0.0]) # center of the model
|
||||||
#First we work out how far up the Y axis the vert is
|
v_15Deg_Point = Vector([tan(radians(15)) * Half_Flat, Half_Flat, 0.0])
|
||||||
v_origin = Vector([0.0,0.0,0.0]) # center of the model
|
# This is a known point to work back from
|
||||||
v_15Deg_Point = Vector([tan(radians(15)) * Half_Flat,Half_Flat,0.0]) #Is a know point to work back from
|
|
||||||
|
|
||||||
x = tan(radians(0)) * Half_Flat
|
x = tan(radians(0)) * Half_Flat
|
||||||
Point_Distance =(tan(radians(30)) * v_15Deg_Point.x)+Half_Flat
|
Point_Distance = (tan(radians(30)) * v_15Deg_Point.x) + Half_Flat
|
||||||
dvec = vec1 - Vector([x, Point_Distance, 0.0])
|
dvec = vec1 - Vector([x, Point_Distance, 0.0])
|
||||||
verts.append([x, Point_Distance, -dvec.length])
|
verts.append([x, Point_Distance, -dvec.length])
|
||||||
v_0_Deg_Top_Point = Vector([x, Point_Distance, -dvec.length])
|
v_0_Deg_Top_Point = Vector([x, Point_Distance, -dvec.length])
|
||||||
|
|
||||||
v_0_Deg_Point = Vector([x, Point_Distance,0.0])
|
v_0_Deg_Point = Vector([x, Point_Distance, 0.0])
|
||||||
|
|
||||||
v_5Deg_Line = Vector([tan(radians(5)) * Half_Flat, Half_Flat, 0.0])
|
v_5Deg_Line = Vector([tan(radians(5)) * Half_Flat, Half_Flat, 0.0])
|
||||||
v_5Deg_Line.length *= 2 # extende out the line on a 5 deg angle
|
v_5Deg_Line.length *= 2 # extende out the line on a 5 deg angle
|
||||||
|
|
||||||
#We cross 2 lines. One from the origin to the 0 Deg point
|
# We cross 2 lines. One from the origin to the 0 Deg point
|
||||||
#and the second is from the origin extended out past the first line
|
# and the second is from the origin extended out past the first line
|
||||||
# This gives the cross point of the
|
# This gives the cross point of the
|
||||||
v_Cross = geometry.intersect_line_line_2d(v_0_Deg_Point,v_15Deg_Point,v_origin,v_5Deg_Line)
|
v_Cross = geometry.intersect_line_line_2d(v_0_Deg_Point, v_15Deg_Point, v_origin, v_5Deg_Line)
|
||||||
dvec = vec2 - Vector([v_Cross.x,v_Cross.y,0.0])
|
dvec = vec2 - Vector([v_Cross.x, v_Cross.y, 0.0])
|
||||||
verts.append([v_Cross.x,v_Cross.y,-dvec.length])
|
verts.append([v_Cross.x, v_Cross.y, -dvec.length])
|
||||||
v_5_Deg_Top_Point = Vector([v_Cross.x,v_Cross.y,-dvec.length])
|
v_5_Deg_Top_Point = Vector([v_Cross.x, v_Cross.y, -dvec.length])
|
||||||
|
|
||||||
v_10Deg_Line = Vector([tan(radians(10)) * Half_Flat, Half_Flat, 0.0])
|
v_10Deg_Line = Vector([tan(radians(10)) * Half_Flat, Half_Flat, 0.0])
|
||||||
v_10Deg_Line.length *= 2 # extende out the line
|
v_10Deg_Line.length *= 2 # extende out the line
|
||||||
|
|
||||||
v_Cross = geometry.intersect_line_line_2d(v_0_Deg_Point,v_15Deg_Point,v_origin,v_10Deg_Line)
|
v_Cross = geometry.intersect_line_line_2d(v_0_Deg_Point, v_15Deg_Point, v_origin, v_10Deg_Line)
|
||||||
dvec = vec3 - Vector([v_Cross.x,v_Cross.y,0.0])
|
dvec = vec3 - Vector([v_Cross.x, v_Cross.y, 0.0])
|
||||||
verts.append([v_Cross.x,v_Cross.y,-dvec.length])
|
verts.append([v_Cross.x, v_Cross.y, -dvec.length])
|
||||||
v_10_Deg_Top_Point = Vector([v_Cross.x,v_Cross.y,-dvec.length])
|
v_10_Deg_Top_Point = Vector([v_Cross.x, v_Cross.y, -dvec.length])
|
||||||
|
|
||||||
#The remain points are stright forward because y is all the same y height (Half_Flat)
|
# The remain points are stright forward because y is all the same y height (Half_Flat)
|
||||||
x = tan(radians(15)) * Half_Flat
|
x = tan(radians(15)) * Half_Flat
|
||||||
dvec = vec4 - Vector([x, Half_Flat, 0.0])
|
dvec = vec4 - Vector([x, Half_Flat, 0.0])
|
||||||
Lowest_Point = -dvec.length
|
Lowest_Point = -dvec.length
|
||||||
@ -1220,16 +1217,13 @@ def Create_12_Point(FLAT, HOLE_DIA, SHANK_DIA, HEIGHT,FLANGE_DIA):
|
|||||||
v_30_Deg_Top_Point = Vector([x, Half_Flat, -dvec.length])
|
v_30_Deg_Top_Point = Vector([x, Half_Flat, -dvec.length])
|
||||||
Row += 1
|
Row += 1
|
||||||
|
|
||||||
|
# Down Bits
|
||||||
#Down Bits
|
|
||||||
# print ("Point_Distance")
|
# print ("Point_Distance")
|
||||||
# print (Point_Distance)
|
# print (Point_Distance)
|
||||||
|
|
||||||
|
Flange_Adjacent = FLANGE_RADIUS - Point_Distance
|
||||||
|
if (Flange_Adjacent == 0.0):
|
||||||
Flange_Adjacent = FLANGE_RADIUS - Point_Distance
|
Flange_Adjacent = 0.000001
|
||||||
if (Flange_Adjacent == 0.0):
|
|
||||||
Flange_Adjacent = 0.000001
|
|
||||||
Flange_Opposite = FLANGE_TAPPER_HEIGHT
|
Flange_Opposite = FLANGE_TAPPER_HEIGHT
|
||||||
|
|
||||||
# print ("Flange_Opposite")
|
# print ("Flange_Opposite")
|
||||||
@ -1237,107 +1231,118 @@ def Create_12_Point(FLAT, HOLE_DIA, SHANK_DIA, HEIGHT,FLANGE_DIA):
|
|||||||
# print ("Flange_Adjacent")
|
# print ("Flange_Adjacent")
|
||||||
# print (Flange_Adjacent)
|
# print (Flange_Adjacent)
|
||||||
|
|
||||||
FLANGE_ANGLE_RAD = atan(Flange_Opposite/Flange_Adjacent )
|
FLANGE_ANGLE_RAD = atan(Flange_Opposite / Flange_Adjacent)
|
||||||
# FLANGE_ANGLE_RAD = radians(45)
|
# FLANGE_ANGLE_RAD = radians(45)
|
||||||
# print("FLANGE_ANGLE_RAD")
|
# print("FLANGE_ANGLE_RAD")
|
||||||
# print (degrees (FLANGE_ANGLE_RAD))
|
# print (degrees (FLANGE_ANGLE_RAD))
|
||||||
|
|
||||||
|
v_Extended_Flange_Edge = Vector([0.0, 0.0, -HEIGHT + FLANGE_HEIGHT + (tan(FLANGE_ANGLE_RAD) * FLANGE_RADIUS)])
|
||||||
v_Extended_Flange_Edge = Vector([0.0,0.0,-HEIGHT + FLANGE_HEIGHT + (tan(FLANGE_ANGLE_RAD)* FLANGE_RADIUS) ])
|
|
||||||
# print("v_Extended_Flange_Edge")
|
# print("v_Extended_Flange_Edge")
|
||||||
# print (v_Extended_Flange_Edge)
|
# print (v_Extended_Flange_Edge)
|
||||||
|
|
||||||
#0deg
|
# 0deg
|
||||||
v_Flange_Edge = Vector([sin(radians(0)) * FLANGE_RADIUS,cos(radians(0)) * FLANGE_RADIUS,-HEIGHT + FLANGE_HEIGHT ])
|
v_Flange_Edge = Vector([sin(radians(0)) * FLANGE_RADIUS,
|
||||||
v_Cross = geometry.intersect_line_line(v_0_Deg_Top_Point,Vector([v_0_Deg_Top_Point.x,v_0_Deg_Top_Point.y,-HEIGHT]),v_Flange_Edge,v_Extended_Flange_Edge)
|
cos(radians(0)) * FLANGE_RADIUS, -HEIGHT + FLANGE_HEIGHT])
|
||||||
|
v_Cross = geometry.intersect_line_line(v_0_Deg_Top_Point,
|
||||||
|
Vector([v_0_Deg_Top_Point.x, v_0_Deg_Top_Point.y, -HEIGHT]),
|
||||||
|
v_Flange_Edge, v_Extended_Flange_Edge)
|
||||||
verts.append(v_Cross[0])
|
verts.append(v_Cross[0])
|
||||||
|
|
||||||
#5deg
|
# 5deg
|
||||||
v_Flange_Edge = Vector([sin(radians(5)) * FLANGE_RADIUS,cos(radians(5)) * FLANGE_RADIUS,-HEIGHT + FLANGE_HEIGHT ])
|
v_Flange_Edge = Vector([sin(radians(5)) * FLANGE_RADIUS,
|
||||||
v_Cross = geometry.intersect_line_line(v_5_Deg_Top_Point,Vector([v_5_Deg_Top_Point.x,v_5_Deg_Top_Point.y,-HEIGHT]),v_Flange_Edge,v_Extended_Flange_Edge)
|
cos(radians(5)) * FLANGE_RADIUS, -HEIGHT + FLANGE_HEIGHT])
|
||||||
|
v_Cross = geometry.intersect_line_line(v_5_Deg_Top_Point,
|
||||||
|
Vector([v_5_Deg_Top_Point.x, v_5_Deg_Top_Point.y, -HEIGHT]),
|
||||||
|
v_Flange_Edge, v_Extended_Flange_Edge)
|
||||||
verts.append(v_Cross[0])
|
verts.append(v_Cross[0])
|
||||||
|
|
||||||
#10deg
|
# 10deg
|
||||||
v_Flange_Edge = Vector([sin(radians(10)) * FLANGE_RADIUS,cos(radians(10)) * FLANGE_RADIUS,-HEIGHT + FLANGE_HEIGHT ])
|
v_Flange_Edge = Vector([sin(radians(10)) * FLANGE_RADIUS,
|
||||||
v_Cross = geometry.intersect_line_line(v_10_Deg_Top_Point,Vector([v_10_Deg_Top_Point.x,v_10_Deg_Top_Point.y,-HEIGHT]),v_Flange_Edge,v_Extended_Flange_Edge)
|
cos(radians(10)) * FLANGE_RADIUS, -HEIGHT + FLANGE_HEIGHT])
|
||||||
|
v_Cross = geometry.intersect_line_line(v_10_Deg_Top_Point,
|
||||||
|
Vector([v_10_Deg_Top_Point.x, v_10_Deg_Top_Point.y, -HEIGHT]),
|
||||||
|
v_Flange_Edge, v_Extended_Flange_Edge)
|
||||||
verts.append(v_Cross[0])
|
verts.append(v_Cross[0])
|
||||||
|
|
||||||
#15deg
|
# 15deg
|
||||||
v_Flange_Edge = Vector([sin(radians(15)) * FLANGE_RADIUS,cos(radians(15)) * FLANGE_RADIUS,-HEIGHT + FLANGE_HEIGHT ])
|
v_Flange_Edge = Vector([sin(radians(15)) * FLANGE_RADIUS,
|
||||||
v_Cross = geometry.intersect_line_line(v_15_Deg_Top_Point,Vector([v_15_Deg_Top_Point.x,v_15_Deg_Top_Point.y,-HEIGHT]),v_Flange_Edge,v_Extended_Flange_Edge)
|
cos(radians(15)) * FLANGE_RADIUS, -HEIGHT + FLANGE_HEIGHT])
|
||||||
|
v_Cross = geometry.intersect_line_line(v_15_Deg_Top_Point,
|
||||||
|
Vector([v_15_Deg_Top_Point.x, v_15_Deg_Top_Point.y, -HEIGHT]),
|
||||||
|
v_Flange_Edge, v_Extended_Flange_Edge)
|
||||||
verts.append(v_Cross[0])
|
verts.append(v_Cross[0])
|
||||||
|
|
||||||
|
# 20deg
|
||||||
#20deg
|
v_Flange_Edge = Vector([sin(radians(20)) * FLANGE_RADIUS,
|
||||||
v_Flange_Edge = Vector([sin(radians(20)) * FLANGE_RADIUS,cos(radians(20)) * FLANGE_RADIUS,-HEIGHT + FLANGE_HEIGHT ])
|
cos(radians(20)) * FLANGE_RADIUS, -HEIGHT + FLANGE_HEIGHT])
|
||||||
v_Cross = geometry.intersect_line_line(v_20_Deg_Top_Point,Vector([v_20_Deg_Top_Point.x,v_20_Deg_Top_Point.y,-HEIGHT]),v_Flange_Edge,v_Extended_Flange_Edge)
|
v_Cross = geometry.intersect_line_line(v_20_Deg_Top_Point,
|
||||||
|
Vector([v_20_Deg_Top_Point.x, v_20_Deg_Top_Point.y, -HEIGHT]),
|
||||||
|
v_Flange_Edge, v_Extended_Flange_Edge)
|
||||||
verts.append(v_Cross[0])
|
verts.append(v_Cross[0])
|
||||||
|
|
||||||
#25deg
|
# 25deg
|
||||||
v_Flange_Edge = Vector([sin(radians(25)) * FLANGE_RADIUS,cos(radians(25)) * FLANGE_RADIUS,-HEIGHT + FLANGE_HEIGHT ])
|
v_Flange_Edge = Vector([sin(radians(25)) * FLANGE_RADIUS,
|
||||||
v_Cross = geometry.intersect_line_line(v_25_Deg_Top_Point,Vector([v_25_Deg_Top_Point.x,v_25_Deg_Top_Point.y,-HEIGHT]),v_Flange_Edge,v_Extended_Flange_Edge)
|
cos(radians(25)) * FLANGE_RADIUS, -HEIGHT + FLANGE_HEIGHT])
|
||||||
|
v_Cross = geometry.intersect_line_line(v_25_Deg_Top_Point,
|
||||||
|
Vector([v_25_Deg_Top_Point.x, v_25_Deg_Top_Point.y, -HEIGHT]),
|
||||||
|
v_Flange_Edge, v_Extended_Flange_Edge)
|
||||||
verts.append(v_Cross[0])
|
verts.append(v_Cross[0])
|
||||||
|
|
||||||
|
# 30deg
|
||||||
#30deg
|
v_Flange_Edge = Vector([sin(radians(30)) * FLANGE_RADIUS,
|
||||||
v_Flange_Edge = Vector([sin(radians(30)) * FLANGE_RADIUS,cos(radians(30)) * FLANGE_RADIUS,-HEIGHT + FLANGE_HEIGHT ])
|
cos(radians(30)) * FLANGE_RADIUS, -HEIGHT + FLANGE_HEIGHT])
|
||||||
v_Cross = geometry.intersect_line_line(v_30_Deg_Top_Point,Vector([v_30_Deg_Top_Point.x,v_30_Deg_Top_Point.y,-HEIGHT]),v_Flange_Edge,v_Extended_Flange_Edge)
|
v_Cross = geometry.intersect_line_line(v_30_Deg_Top_Point,
|
||||||
|
Vector([v_30_Deg_Top_Point.x, v_30_Deg_Top_Point.y, -HEIGHT]),
|
||||||
|
v_Flange_Edge, v_Extended_Flange_Edge)
|
||||||
verts.append(v_Cross[0])
|
verts.append(v_Cross[0])
|
||||||
|
|
||||||
Row += 1
|
Row += 1
|
||||||
|
|
||||||
|
verts.append([sin(radians(0)) * FLANGE_RADIUS, cos(radians(0)) * FLANGE_RADIUS, -HEIGHT + FLANGE_HEIGHT])
|
||||||
|
verts.append([sin(radians(5)) * FLANGE_RADIUS, cos(radians(5)) * FLANGE_RADIUS, -HEIGHT + FLANGE_HEIGHT])
|
||||||
verts.append([sin(radians(0)) * FLANGE_RADIUS,cos(radians(0)) * FLANGE_RADIUS,-HEIGHT + FLANGE_HEIGHT ])
|
verts.append([sin(radians(10)) * FLANGE_RADIUS, cos(radians(10)) * FLANGE_RADIUS, -HEIGHT + FLANGE_HEIGHT])
|
||||||
verts.append([sin(radians(5)) * FLANGE_RADIUS,cos(radians(5)) * FLANGE_RADIUS,-HEIGHT + FLANGE_HEIGHT])
|
verts.append([sin(radians(15)) * FLANGE_RADIUS, cos(radians(15)) * FLANGE_RADIUS, -HEIGHT + FLANGE_HEIGHT])
|
||||||
verts.append([sin(radians(10)) * FLANGE_RADIUS,cos(radians(10)) * FLANGE_RADIUS,-HEIGHT + FLANGE_HEIGHT])
|
verts.append([sin(radians(20)) * FLANGE_RADIUS, cos(radians(20)) * FLANGE_RADIUS, -HEIGHT + FLANGE_HEIGHT])
|
||||||
verts.append([sin(radians(15)) * FLANGE_RADIUS,cos(radians(15)) * FLANGE_RADIUS,-HEIGHT + FLANGE_HEIGHT])
|
verts.append([sin(radians(25)) * FLANGE_RADIUS, cos(radians(25)) * FLANGE_RADIUS, -HEIGHT + FLANGE_HEIGHT])
|
||||||
verts.append([sin(radians(20)) * FLANGE_RADIUS,cos(radians(20)) * FLANGE_RADIUS,-HEIGHT + FLANGE_HEIGHT])
|
verts.append([sin(radians(30)) * FLANGE_RADIUS, cos(radians(30)) * FLANGE_RADIUS, -HEIGHT + FLANGE_HEIGHT])
|
||||||
verts.append([sin(radians(25)) * FLANGE_RADIUS,cos(radians(25)) * FLANGE_RADIUS,-HEIGHT + FLANGE_HEIGHT])
|
|
||||||
verts.append([sin(radians(30)) * FLANGE_RADIUS,cos(radians(30)) * FLANGE_RADIUS,-HEIGHT + FLANGE_HEIGHT])
|
|
||||||
|
|
||||||
Row += 1
|
Row += 1
|
||||||
|
|
||||||
verts.append([sin(radians(0)) * FLANGE_RADIUS,cos(radians(0)) * FLANGE_RADIUS,-HEIGHT])
|
verts.append([sin(radians(0)) * FLANGE_RADIUS, cos(radians(0)) * FLANGE_RADIUS, -HEIGHT])
|
||||||
verts.append([sin(radians(5)) * FLANGE_RADIUS,cos(radians(5)) * FLANGE_RADIUS,-HEIGHT])
|
verts.append([sin(radians(5)) * FLANGE_RADIUS, cos(radians(5)) * FLANGE_RADIUS, -HEIGHT])
|
||||||
verts.append([sin(radians(10)) * FLANGE_RADIUS,cos(radians(10)) * FLANGE_RADIUS,-HEIGHT])
|
verts.append([sin(radians(10)) * FLANGE_RADIUS, cos(radians(10)) * FLANGE_RADIUS, -HEIGHT])
|
||||||
verts.append([sin(radians(15)) * FLANGE_RADIUS,cos(radians(15)) * FLANGE_RADIUS,-HEIGHT])
|
verts.append([sin(radians(15)) * FLANGE_RADIUS, cos(radians(15)) * FLANGE_RADIUS, -HEIGHT])
|
||||||
verts.append([sin(radians(20)) * FLANGE_RADIUS,cos(radians(20)) * FLANGE_RADIUS,-HEIGHT])
|
verts.append([sin(radians(20)) * FLANGE_RADIUS, cos(radians(20)) * FLANGE_RADIUS, -HEIGHT])
|
||||||
verts.append([sin(radians(25)) * FLANGE_RADIUS,cos(radians(25)) * FLANGE_RADIUS,-HEIGHT])
|
verts.append([sin(radians(25)) * FLANGE_RADIUS, cos(radians(25)) * FLANGE_RADIUS, -HEIGHT])
|
||||||
verts.append([sin(radians(30)) * FLANGE_RADIUS,cos(radians(30)) * FLANGE_RADIUS,-HEIGHT])
|
verts.append([sin(radians(30)) * FLANGE_RADIUS, cos(radians(30)) * FLANGE_RADIUS, -HEIGHT])
|
||||||
|
|
||||||
Row += 1
|
Row += 1
|
||||||
|
|
||||||
|
verts.append([sin(radians(0)) * SHANK_RADIUS, cos(radians(0)) * SHANK_RADIUS, -HEIGHT])
|
||||||
verts.append([sin(radians(0)) * SHANK_RADIUS,cos(radians(0)) * SHANK_RADIUS,-HEIGHT])
|
verts.append([sin(radians(0)) * SHANK_RADIUS, cos(radians(0)) * SHANK_RADIUS, -HEIGHT])
|
||||||
verts.append([sin(radians(0)) * SHANK_RADIUS,cos(radians(0)) * SHANK_RADIUS,-HEIGHT])
|
verts.append([sin(radians(10)) * SHANK_RADIUS, cos(radians(10)) * SHANK_RADIUS, -HEIGHT])
|
||||||
verts.append([sin(radians(10)) * SHANK_RADIUS,cos(radians(10)) * SHANK_RADIUS,-HEIGHT])
|
verts.append([sin(radians(10)) * SHANK_RADIUS, cos(radians(10)) * SHANK_RADIUS, -HEIGHT])
|
||||||
verts.append([sin(radians(10)) * SHANK_RADIUS,cos(radians(10)) * SHANK_RADIUS,-HEIGHT])
|
verts.append([sin(radians(20)) * SHANK_RADIUS, cos(radians(20)) * SHANK_RADIUS, -HEIGHT])
|
||||||
verts.append([sin(radians(20)) * SHANK_RADIUS,cos(radians(20)) * SHANK_RADIUS,-HEIGHT])
|
verts.append([sin(radians(20)) * SHANK_RADIUS, cos(radians(20)) * SHANK_RADIUS, -HEIGHT])
|
||||||
verts.append([sin(radians(20)) * SHANK_RADIUS,cos(radians(20)) * SHANK_RADIUS,-HEIGHT])
|
verts.append([sin(radians(30)) * SHANK_RADIUS, cos(radians(30)) * SHANK_RADIUS, -HEIGHT])
|
||||||
verts.append([sin(radians(30)) * SHANK_RADIUS,cos(radians(30)) * SHANK_RADIUS,-HEIGHT])
|
|
||||||
|
|
||||||
Row += 1
|
Row += 1
|
||||||
|
|
||||||
|
|
||||||
faces.extend(Build_Face_List_Quads(FaceStart, 6, Row - 1))
|
faces.extend(Build_Face_List_Quads(FaceStart, 6, Row - 1))
|
||||||
|
|
||||||
Spin_Verts, Spin_Faces = SpinDup(verts, faces, 360,12, 'z')
|
Spin_Verts, Spin_Faces = SpinDup(verts, faces, 360, 12, 'z')
|
||||||
|
|
||||||
return Spin_Verts, Spin_Faces, 0 - (-HEIGHT)
|
return Spin_Verts, Spin_Faces, 0 - (-HEIGHT)
|
||||||
|
|
||||||
|
|
||||||
def Create_12_Point_Head(FLAT, HOLE_DIA, SHANK_DIA, HEIGHT,FLANGE_DIA):
|
def Create_12_Point_Head(FLAT, HOLE_DIA, SHANK_DIA, HEIGHT, FLANGE_DIA):
|
||||||
#TODO add under head radius
|
# TODO add under head radius
|
||||||
return Create_12_Point(FLAT, HOLE_DIA, SHANK_DIA, HEIGHT,FLANGE_DIA)
|
return Create_12_Point(FLAT, HOLE_DIA, SHANK_DIA, HEIGHT, FLANGE_DIA)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ####################################################################
|
# ####################################################################
|
||||||
# Create External Thread
|
# Create External Thread
|
||||||
# ####################################################################
|
# ####################################################################
|
||||||
|
|
||||||
|
|
||||||
def Thread_Start3(verts, INNER_RADIUS, OUTTER_RADIUS, PITCH, DIV_COUNT,
|
def Thread_Start3(verts, INNER_RADIUS, OUTTER_RADIUS, PITCH, DIV_COUNT,
|
||||||
CREST_PERCENT, ROOT_PERCENT, Height_Offset):
|
CREST_PERCENT, ROOT_PERCENT, Height_Offset):
|
||||||
|
|
||||||
@ -1349,8 +1354,7 @@ def Thread_Start3(verts, INNER_RADIUS, OUTTER_RADIUS, PITCH, DIV_COUNT,
|
|||||||
|
|
||||||
Crest_Height = float(PITCH) * float(CREST_PERCENT) / float(100)
|
Crest_Height = float(PITCH) * float(CREST_PERCENT) / float(100)
|
||||||
Root_Height = float(PITCH) * float(ROOT_PERCENT) / float(100)
|
Root_Height = float(PITCH) * float(ROOT_PERCENT) / float(100)
|
||||||
Root_to_Crest_Height = Crest_to_Root_Height = \
|
Root_to_Crest_Height = Crest_to_Root_Height = (float(PITCH) - (Crest_Height + Root_Height)) / 2.0
|
||||||
(float(PITCH) - (Crest_Height + Root_Height)) / 2.0
|
|
||||||
|
|
||||||
# thread start
|
# thread start
|
||||||
Rank = float(OUTTER_RADIUS - INNER_RADIUS) / float(DIV_COUNT)
|
Rank = float(OUTTER_RADIUS - INNER_RADIUS) / float(DIV_COUNT)
|
||||||
@ -1475,8 +1479,7 @@ def Create_Thread_Start_Verts(INNER_DIA, OUTTER_DIA, PITCH, CREST_PERCENT,
|
|||||||
|
|
||||||
Crest_Height = float(PITCH) * float(CREST_PERCENT) / float(100)
|
Crest_Height = float(PITCH) * float(CREST_PERCENT) / float(100)
|
||||||
Root_Height = float(PITCH) * float(ROOT_PERCENT) / float(100)
|
Root_Height = float(PITCH) * float(ROOT_PERCENT) / float(100)
|
||||||
Root_to_Crest_Height = Crest_to_Root_Height = \
|
Root_to_Crest_Height = Crest_to_Root_Height = (float(PITCH) - (Crest_Height + Root_Height)) / 2.0
|
||||||
(float(PITCH) - (Crest_Height + Root_Height)) / 2.0
|
|
||||||
|
|
||||||
Rank = float(OUTTER_RADIUS - INNER_RADIUS) / float(DIV_COUNT)
|
Rank = float(OUTTER_RADIUS - INNER_RADIUS) / float(DIV_COUNT)
|
||||||
|
|
||||||
@ -1605,8 +1608,7 @@ def Create_Thread_Verts(INNER_DIA, OUTTER_DIA, PITCH, HEIGHT,
|
|||||||
|
|
||||||
Crest_Height = float(PITCH) * float(CREST_PERCENT) / float(100)
|
Crest_Height = float(PITCH) * float(CREST_PERCENT) / float(100)
|
||||||
Root_Height = float(PITCH) * float(ROOT_PERCENT) / float(100)
|
Root_Height = float(PITCH) * float(ROOT_PERCENT) / float(100)
|
||||||
Root_to_Crest_Height = Crest_to_Root_Height = \
|
Root_to_Crest_Height = Crest_to_Root_Height = (float(PITCH) - (Crest_Height + Root_Height)) / 2.0
|
||||||
(float(PITCH) - (Crest_Height + Root_Height)) / 2.0
|
|
||||||
|
|
||||||
Height_Offset = Z_LOCATION
|
Height_Offset = Z_LOCATION
|
||||||
|
|
||||||
@ -1665,8 +1667,7 @@ def Create_Thread_End_Verts(INNER_DIA, OUTTER_DIA, PITCH, CREST_PERCENT,
|
|||||||
|
|
||||||
Crest_Height = float(PITCH) * float(CREST_PERCENT) / float(100)
|
Crest_Height = float(PITCH) * float(CREST_PERCENT) / float(100)
|
||||||
Root_Height = float(PITCH) * float(ROOT_PERCENT) / float(100)
|
Root_Height = float(PITCH) * float(ROOT_PERCENT) / float(100)
|
||||||
Root_to_Crest_Height = Crest_to_Root_Height = \
|
Root_to_Crest_Height = Crest_to_Root_Height = (float(PITCH) - (Crest_Height + Root_Height)) / 2.0
|
||||||
(float(PITCH) - (Crest_Height + Root_Height)) / 2.0
|
|
||||||
|
|
||||||
Row = 0
|
Row = 0
|
||||||
|
|
||||||
@ -1968,7 +1969,7 @@ def add_Nylon_Head(OUTSIDE_RADIUS, Z_LOCATION, DIV_COUNT):
|
|||||||
sVerts, sFaces = SpinDup(verts, faces, 360, DIV_COUNT, 'z')
|
sVerts, sFaces = SpinDup(verts, faces, 360, DIV_COUNT, 'z')
|
||||||
sVerts.extend(verts) # add the start verts to the Spin verts to complete the loop
|
sVerts.extend(verts) # add the start verts to the Spin verts to complete the loop
|
||||||
|
|
||||||
faces.extend(Build_Face_List_Quads(FaceStart, Row - 1, DIV_COUNT,1))
|
faces.extend(Build_Face_List_Quads(FaceStart, Row - 1, DIV_COUNT, 1))
|
||||||
|
|
||||||
return Move_Verts_Up_Z(sVerts, 0), faces, Lowest_Z_Vert
|
return Move_Verts_Up_Z(sVerts, 0), faces, Lowest_Z_Vert
|
||||||
|
|
||||||
@ -2021,15 +2022,13 @@ def add_Nylon_Part(OUTSIDE_RADIUS, Z_LOCATION, DIV_COUNT):
|
|||||||
return sVerts, faces, 0 - Lowest_Z_Vert
|
return sVerts, faces, 0 - Lowest_Z_Vert
|
||||||
|
|
||||||
|
|
||||||
def add_12_Point_Nut(FLAT, HOLE_DIA, HEIGHT,FLANGE_DIA):
|
def add_12_Point_Nut(FLAT, HOLE_DIA, HEIGHT, FLANGE_DIA):
|
||||||
return Create_12_Point(FLAT, HOLE_DIA,HOLE_DIA, HEIGHT,FLANGE_DIA)
|
return Create_12_Point(FLAT, HOLE_DIA, HOLE_DIA, HEIGHT, FLANGE_DIA)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ####################################################################
|
# ####################################################################
|
||||||
# Create Internal Thread
|
# Create Internal Thread
|
||||||
# ####################################################################
|
# ####################################################################
|
||||||
|
|
||||||
def Create_Internal_Thread_Start_Verts(verts, INNER_RADIUS, OUTTER_RADIUS, PITCH, DIV,
|
def Create_Internal_Thread_Start_Verts(verts, INNER_RADIUS, OUTTER_RADIUS, PITCH, DIV,
|
||||||
CREST_PERCENT, ROOT_PERCENT, Height_Offset):
|
CREST_PERCENT, ROOT_PERCENT, Height_Offset):
|
||||||
|
|
||||||
@ -2044,8 +2043,7 @@ def Create_Internal_Thread_Start_Verts(verts, INNER_RADIUS, OUTTER_RADIUS, PITCH
|
|||||||
|
|
||||||
Crest_Height = float(PITCH) * float(CREST_PERCENT) / float(100)
|
Crest_Height = float(PITCH) * float(CREST_PERCENT) / float(100)
|
||||||
Root_Height = float(PITCH) * float(ROOT_PERCENT) / float(100)
|
Root_Height = float(PITCH) * float(ROOT_PERCENT) / float(100)
|
||||||
Root_to_Crest_Height = Crest_to_Root_Height = \
|
Root_to_Crest_Height = Crest_to_Root_Height = (float(PITCH) - (Crest_Height + Root_Height)) / 2.0
|
||||||
(float(PITCH) - (Crest_Height + Root_Height)) / 2.0
|
|
||||||
|
|
||||||
Rank = float(OUTTER_RADIUS - INNER_RADIUS) / float(DIV)
|
Rank = float(OUTTER_RADIUS - INNER_RADIUS) / float(DIV)
|
||||||
|
|
||||||
@ -2115,8 +2113,7 @@ def Create_Internal_Thread_End_Verts(verts, INNER_RADIUS, OUTTER_RADIUS, PITCH,
|
|||||||
|
|
||||||
Crest_Height = float(PITCH) * float(CREST_PERCENT) / float(100)
|
Crest_Height = float(PITCH) * float(CREST_PERCENT) / float(100)
|
||||||
Root_Height = float(PITCH) * float(ROOT_PERCENT) / float(100)
|
Root_Height = float(PITCH) * float(ROOT_PERCENT) / float(100)
|
||||||
Root_to_Crest_Height = Crest_to_Root_Height = \
|
Root_to_Crest_Height = Crest_to_Root_Height = (float(PITCH) - (Crest_Height + Root_Height)) / 2.0
|
||||||
(float(PITCH) - (Crest_Height + Root_Height)) / 2.0
|
|
||||||
|
|
||||||
Rank = float(OUTTER_RADIUS - INNER_RADIUS) / float(DIV_COUNT)
|
Rank = float(OUTTER_RADIUS - INNER_RADIUS) / float(DIV_COUNT)
|
||||||
|
|
||||||
@ -2210,8 +2207,7 @@ def Create_Internal_Thread(INNER_DIA, OUTTER_DIA, PITCH, HEIGHT,
|
|||||||
|
|
||||||
Crest_Height = float(PITCH) * float(CREST_PERCENT) / float(100)
|
Crest_Height = float(PITCH) * float(CREST_PERCENT) / float(100)
|
||||||
Root_Height = float(PITCH) * float(ROOT_PERCENT) / float(100)
|
Root_Height = float(PITCH) * float(ROOT_PERCENT) / float(100)
|
||||||
Root_to_Crest_Height = Crest_to_Root_Height = \
|
Root_to_Crest_Height = Crest_to_Root_Height = (float(PITCH) - (Crest_Height + Root_Height)) / 2.0
|
||||||
(float(PITCH) - (Crest_Height + Root_Height)) / 2.0
|
|
||||||
|
|
||||||
Height_Offset = 0
|
Height_Offset = 0
|
||||||
FaceStart = len(verts)
|
FaceStart = len(verts)
|
||||||
@ -2272,10 +2268,8 @@ def Nut_Mesh(props, context):
|
|||||||
Head_Verts = []
|
Head_Verts = []
|
||||||
Head_Faces = []
|
Head_Faces = []
|
||||||
|
|
||||||
|
|
||||||
Face_Start = len(verts)
|
Face_Start = len(verts)
|
||||||
|
|
||||||
|
|
||||||
if props.bf_Nut_Type == 'bf_Nut_12Pnt':
|
if props.bf_Nut_Type == 'bf_Nut_12Pnt':
|
||||||
Nut_Height = props.bf_12_Point_Nut_Height
|
Nut_Height = props.bf_12_Point_Nut_Height
|
||||||
else:
|
else:
|
||||||
@ -2296,8 +2290,9 @@ def Nut_Mesh(props, context):
|
|||||||
Head_Verts, Head_Faces, Lock_Nut_Rad = add_12_Point_Nut(
|
Head_Verts, Head_Faces, Lock_Nut_Rad = add_12_Point_Nut(
|
||||||
props.bf_12_Point_Nut_Flat_Distance,
|
props.bf_12_Point_Nut_Flat_Distance,
|
||||||
props.bf_Major_Dia, New_Nut_Height,
|
props.bf_Major_Dia, New_Nut_Height,
|
||||||
#Limit the size of the Flange to avoid calculation error
|
# 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, \
|
||||||
|
props.bf_12_Point_Nut_Flat_Distance)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
Head_Verts, Head_Faces, Lock_Nut_Rad = add_Hex_Nut(
|
Head_Verts, Head_Faces, Lock_Nut_Rad = add_Hex_Nut(
|
||||||
@ -2354,7 +2349,8 @@ def Bolt_Mesh(props, context):
|
|||||||
ReSized_Allen_Bit_Flat_Distance = Allen_Bit_Dia_To_Flat(
|
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)
|
||||||
)
|
)
|
||||||
ReSized_Allen_Bit_Flat_Distance -= ReSized_Allen_Bit_Flat_Distance * 0.05 # It looks better if it is just a bit smaller
|
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)
|
# print ("Resized Allen Bit Flat Distance to ",ReSized_Allen_Bit_Flat_Distance)
|
||||||
|
|
||||||
# Bit Mesh
|
# Bit Mesh
|
||||||
@ -2370,7 +2366,6 @@ def Bolt_Mesh(props, context):
|
|||||||
props.bf_Torx_Bit_Depth
|
props.bf_Torx_Bit_Depth
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
if props.bf_Bit_Type == 'bf_Bit_Philips':
|
if props.bf_Bit_Type == 'bf_Bit_Philips':
|
||||||
Bit_Verts, Bit_Faces, Bit_Dia = Create_Phillips_Bit(
|
Bit_Verts, Bit_Faces, Bit_Dia = Create_Phillips_Bit(
|
||||||
props.bf_Philips_Bit_Dia,
|
props.bf_Philips_Bit_Dia,
|
||||||
@ -2388,8 +2383,9 @@ def Bolt_Mesh(props, context):
|
|||||||
Head_Verts, Head_Faces, Head_Height = Create_12_Point_Head(
|
Head_Verts, Head_Faces, Head_Height = Create_12_Point_Head(
|
||||||
props.bf_12_Point_Head_Flat_Distance, Bit_Dia,
|
props.bf_12_Point_Head_Flat_Distance, Bit_Dia,
|
||||||
props.bf_Shank_Dia, props.bf_12_Point_Head_Height,
|
props.bf_Shank_Dia, props.bf_12_Point_Head_Height,
|
||||||
#Limit the size of the Flange to avoid calculation error
|
# 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, \
|
||||||
|
props.bf_12_Point_Head_Flat_Distance)
|
||||||
)
|
)
|
||||||
elif props.bf_Head_Type == 'bf_Head_Cap':
|
elif props.bf_Head_Type == 'bf_Head_Cap':
|
||||||
Head_Verts, Head_Faces, Head_Height = Create_Cap_Head(
|
Head_Verts, Head_Faces, Head_Height = Create_Cap_Head(
|
||||||
@ -2444,12 +2440,8 @@ def Bolt_Mesh(props, context):
|
|||||||
return Move_Verts_Up_Z(verts, Thread_Height), faces
|
return Move_Verts_Up_Z(verts, Thread_Height), faces
|
||||||
|
|
||||||
|
|
||||||
|
# ###### New Mesh
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def Create_New_Mesh(props, context):
|
def Create_New_Mesh(props, context):
|
||||||
|
|
||||||
verts = []
|
verts = []
|
||||||
|
Loading…
Reference in New Issue
Block a user