Added Torx bit type

This commit is contained in:
Aaron Keith 2020-04-16 15:13:38 +12:00
parent cc1a2f5af8
commit 32bf6e71b6
10 changed files with 234 additions and 0 deletions

View File

@ -73,6 +73,7 @@ class add_mesh_bolt(Operator, AddObjectHelper):
# Bit Types
Bit_Type_List = [('bf_Bit_None', 'NONE', 'No Bit Type'),
('bf_Bit_Allen', 'ALLEN', 'Allen Bit Type'),
('bf_Bit_Torx', 'TORX', 'Torx Bit Type'),
('bf_Bit_Philips', 'PHILLIPS', 'Phillips Bit Type')]
bf_Bit_Type: EnumProperty(
attr='bf_Bit_Type',
@ -129,6 +130,30 @@ class add_mesh_bolt(Operator, AddObjectHelper):
description='Flat Distance of the Allen Bit',
unit='LENGTH',
)
# Torx Size Types
Torx_Size_Type_List = [('bf_Torx_T10', 'T10', 'T10'),
('bf_Torx_T20', 'T20', 'T20'),
('bf_Torx_T25', 'T25', 'T25'),
('bf_Torx_T30', 'T30', 'T30'),
('bf_Torx_T40', 'T40', 'T40'),
('bf_Torx_T50', 'T50', 'T50'),
('bf_Torx_T55', 'T55', 'T55'),
]
bf_Torx_Size_Type: EnumProperty(
attr='bf_Torx_Size_Type',
name='Torx Size',
description='Size of the Torx Bit',
items=Torx_Size_Type_List, default='bf_Torx_T20'
)
bf_Torx_Bit_Depth: FloatProperty(
attr='bf_Torx_Bit_Depth',
name='Bit Depth', default=1.5,
min=0, soft_min=0,
max=MAX_INPUT_NUMBER,
description='Depth of the Torx Bit',
unit='LENGTH',
)
bf_Hex_Head_Height: FloatProperty(
attr='bf_Hex_Head_Height',
name='Head Height', default=2,
@ -434,6 +459,8 @@ def BoltParameters():
"bf_Phillips_Bit_Depth",
"bf_Allen_Bit_Depth",
"bf_Allen_Bit_Flat_Distance",
"bf_Torx_Bit_Depth",
"bf_Torx_Size_Type",
"bf_Hex_Head_Height",
"bf_Hex_Head_Flat_Distance",
"bf_CounterSink_Head_Dia",

View File

@ -285,6 +285,29 @@ def Fill_Ring_Face(OFFSET, NUM, FACE_DOWN=0):
Face[2] = TempFace[2]
return Ret
# Returns a list of faces that makes up a fill pattern around the last vert
def Fill_Fan_Face(OFFSET, NUM, FACE_DOWN=0):
Ret = []
Face = [NUM-1,0,1]
TempFace = [0, 0, 0]
A = 0
#B = 1 unsed
C = 2
if NUM < 3:
return None
for _i in range(NUM - 2):
TempFace[0] = Face[A]
TempFace[1] = Face[C]
TempFace[2] = Face[C]+1
if FACE_DOWN:
Ret.append([OFFSET + Face[2], OFFSET + Face[1], OFFSET + Face[0]])
else:
Ret.append([OFFSET + Face[2], OFFSET + Face[1], OFFSET + Face[0]])
Face[0] = TempFace[0]
Face[1] = TempFace[1]
Face[2] = TempFace[2]
return Ret
# ####################################################################
# Create Allen Bit
@ -378,7 +401,175 @@ def Create_Allen_Bit(FLAT_DISTANCE, HEIGHT):
faces.extend(M_Faces)
return verts, faces, OUTTER_RADIUS * 2.0
# ####################################################################
# Create Torx Bit
# ####################################################################
def Torx_Bit_Size_To_Point_Distance(Bit_Size):
if Bit_Size == 'bf_Torx_T10':
return 2.83
elif Bit_Size == 'bf_Torx_T20':
return 3.94
elif Bit_Size == 'bf_Torx_T25':
return 4.52
elif Bit_Size == 'bf_Torx_T30':
return 5.61
elif Bit_Size == 'bf_Torx_T40':
return 6.75
elif Bit_Size == 'bf_Torx_T50':
return 8.94
elif Bit_Size == 'bf_Torx_T55':
return 8.94
else:
return 2.83 #default to M3
def Torx_Fill(OFFSET, FLIP=0):
faces = []
Lookup = [[0,10,11],
[0,11, 12],
[0,12,1],
[1, 12, 13],
[1, 13, 14],
[1, 14, 15],
[1, 15, 2],
[2, 15, 16],
[2, 16, 17],
[2, 17, 18],
[2, 18, 19],
[2, 19, 3],
[3, 19, 20],
[3, 20, 21],
[3, 21, 22],
[3, 22, 23],
[3, 23, 24],
[3, 24, 25],
[3, 25, 4],
[4, 25, 26],
[4, 26, 27],
[4, 27, 28],
[4, 28, 29],
[4, 29, 30],
[4, 30, 31],
[4, 31, 5],
[5, 31, 32],
[5, 32, 33],
[5, 33, 34],
[5, 34, 35],
[5, 35, 36],
[5, 36, 6],
[6, 36, 37],
[6, 37, 38],
[6, 38, 39],
[6, 39, 7],
[7, 39, 40],
[7, 40, 41],
[7, 41, 42],
[7, 42, 43],
[7, 43, 8],
[8, 43, 44],
[8, 44, 45],
[8, 45, 46],
[8, 46, 47],
[8, 47, 48],
[8, 48, 49],
[8, 49, 50],
[8, 50, 51],
[8, 51, 52],
[8, 52, 9],
]
for i in Lookup:
if FLIP:
faces.append([OFFSET + i[2], OFFSET + i[1], OFFSET + i[0]])
else:
faces.append([OFFSET + i[0], OFFSET + i[1], OFFSET + i[2]])
return faces
def Create_Torx_Bit(Point_Distance, HEIGHT):
verts = []
faces = []
POINT_RADIUS = Point_Distance * 0.5
OUTTER_RADIUS = POINT_RADIUS * 1.05
POINT_1_Y = POINT_RADIUS * 0.816592592592593
POINT_2_X = POINT_RADIUS * 0.511111111111111
POINT_2_Y = POINT_RADIUS * 0.885274074074074
POINT_3_X = POINT_RADIUS * 0.7072
POINT_3_Y = POINT_RADIUS * 0.408296296296296
POINT_4_X = POINT_RADIUS * 1.02222222222222
SMALL_RADIUS = POINT_RADIUS * 0.183407407407407
BIG_RADIUS = POINT_RADIUS * 0.333333333333333
# Values for T40 # POINT_1_Y = 2.756
# POINT_2_X = 1.725
# POINT_2_Y = 2.9878
# POINT_3_X = 2.3868
# POINT_3_Y = 1.378
# POINT_4_X = 3.45
#
# SMALL_RADIUS = 0.619
# BIG_RADIUS = 1.125
def Do_Curve(Curve_Height):
for i in range(0, 90, 10):
x = sin(radians(i)) * SMALL_RADIUS
y = cos(radians(i)) * SMALL_RADIUS
verts.append([x, POINT_1_Y + y, Curve_Height])
for i in range(260, 150, -10):
x = sin(radians(i)) * BIG_RADIUS
y = cos(radians(i)) * BIG_RADIUS
verts.append([POINT_2_X + x, POINT_2_Y + y, Curve_Height])
for i in range(340, 150 + 360, 10):
x = sin(radians(i%360)) * SMALL_RADIUS
y = cos(radians(i%360)) * SMALL_RADIUS
verts.append([POINT_3_X + x, POINT_3_Y + y, Curve_Height])
for i in range(320, 260, -10):
x = sin(radians(i)) * BIG_RADIUS
y = cos(radians(i)) * BIG_RADIUS
verts.append([POINT_4_X + x, y, Curve_Height])
FaceStart_Outside = len(verts)
for i in range(0, 100, 10):
x = sin(radians(i)) * OUTTER_RADIUS
y = cos(radians(i)) * OUTTER_RADIUS
verts.append([x, y, 0])
FaceStart_Top_Curve= len(verts)
Do_Curve(0)
faces.extend(Torx_Fill(FaceStart_Outside, 0))
FaceStart_Bottom_Curve= len(verts)
Do_Curve(0 - HEIGHT)
faces.extend(Build_Face_List_Quads(FaceStart_Top_Curve,42 ,1 , True))
verts.append([0,0,0 - HEIGHT]) # add center point for fill Fan
faces.extend(Fill_Fan_Face(FaceStart_Bottom_Curve, 44))
M_Verts, M_Faces = Mirror_Verts_Faces(verts, faces, 'x')
verts.extend(M_Verts)
faces.extend(M_Faces)
M_Verts, M_Faces = Mirror_Verts_Faces(verts, faces, 'y')
verts.extend(M_Verts)
faces.extend(M_Faces)
return verts, faces, OUTTER_RADIUS * 2.0
# ####################################################################
# Create Phillips Bit

View File

@ -10,6 +10,8 @@ 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
op.bf_Hex_Head_Flat_Distance = 5.5
op.bf_CounterSink_Head_Dia = 6.300000190734863

View File

@ -10,6 +10,8 @@ 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
op.bf_Hex_Head_Flat_Distance = 17.0
op.bf_CounterSink_Head_Dia = 20.0

View File

@ -10,6 +10,8 @@ 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
op.bf_Hex_Head_Flat_Distance = 19.0
op.bf_CounterSink_Head_Dia = 22.0

View File

@ -10,6 +10,8 @@ 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
op.bf_Hex_Head_Flat_Distance = 5.5
op.bf_CounterSink_Head_Dia = 6.300000190734863

View File

@ -10,6 +10,8 @@ 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
op.bf_Hex_Head_Flat_Distance = 7.0
op.bf_CounterSink_Head_Dia = 9.399999618530273

View File

@ -10,6 +10,8 @@ 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
op.bf_Hex_Head_Flat_Distance = 8.0
op.bf_CounterSink_Head_Dia = 10.399999618530273

View File

@ -10,6 +10,8 @@ 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
op.bf_Hex_Head_Flat_Distance = 10.0
op.bf_CounterSink_Head_Dia = 12.600000381469727

View File

@ -10,6 +10,8 @@ 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
op.bf_Hex_Head_Flat_Distance = 13.0
op.bf_CounterSink_Head_Dia = 17.299999237060547