diff --git a/add_mesh_BoltFactory/Boltfactory.py b/add_mesh_BoltFactory/Boltfactory.py index b3d3b1089c4d79643aec7df6008c16fa3a2c4486..4ade3da05384c9c81138158d32f9bd4c34affce0 100644 --- a/add_mesh_BoltFactory/Boltfactory.py +++ b/add_mesh_BoltFactory/Boltfactory.py @@ -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", diff --git a/add_mesh_BoltFactory/createMesh.py b/add_mesh_BoltFactory/createMesh.py index ccdd4372fd86e1f4790d91699c586c9a90b1d487..c9e5c665eae1fa6049fc387ce92dcff92280cfb0 100644 --- a/add_mesh_BoltFactory/createMesh.py +++ b/add_mesh_BoltFactory/createMesh.py @@ -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 diff --git a/presets/operator/mesh.bolt_add/default.py b/presets/operator/mesh.bolt_add/default.py index 5c1e33dd3a9f3cb92f482bdd3ea0b122cedd145a..ce8dff4de684732fd13a122121f59f731037531c 100644 --- a/presets/operator/mesh.bolt_add/default.py +++ b/presets/operator/mesh.bolt_add/default.py @@ -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 diff --git a/presets/operator/mesh.bolt_add/m10.py b/presets/operator/mesh.bolt_add/m10.py index b92d009eb1befa36df1569b6a82fd9b3430c4253..9ad4c986bf5ba68beab6de9579d039eaf26f411c 100644 --- a/presets/operator/mesh.bolt_add/m10.py +++ b/presets/operator/mesh.bolt_add/m10.py @@ -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 diff --git a/presets/operator/mesh.bolt_add/m12.py b/presets/operator/mesh.bolt_add/m12.py index cbec7589ac8fa7bf797a3f3594bc21fc8ae92330..266dbb6b211387fda621cb9db9d83fdf52f6c1b3 100644 --- a/presets/operator/mesh.bolt_add/m12.py +++ b/presets/operator/mesh.bolt_add/m12.py @@ -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 diff --git a/presets/operator/mesh.bolt_add/m3.py b/presets/operator/mesh.bolt_add/m3.py index 5c1e33dd3a9f3cb92f482bdd3ea0b122cedd145a..ce8dff4de684732fd13a122121f59f731037531c 100644 --- a/presets/operator/mesh.bolt_add/m3.py +++ b/presets/operator/mesh.bolt_add/m3.py @@ -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 diff --git a/presets/operator/mesh.bolt_add/m4.py b/presets/operator/mesh.bolt_add/m4.py index a4349c5aaa3fc3d8fab6b2a2b377ccdbefc9bba8..0c638588096477a190ff43bf4fc84806a033b23a 100644 --- a/presets/operator/mesh.bolt_add/m4.py +++ b/presets/operator/mesh.bolt_add/m4.py @@ -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 diff --git a/presets/operator/mesh.bolt_add/m5.py b/presets/operator/mesh.bolt_add/m5.py index 7f53703c4b29972ecdfcfa0b312ee9cbbec14775..02926b412ef46dbd5dc7af502aabdf332ceabc25 100644 --- a/presets/operator/mesh.bolt_add/m5.py +++ b/presets/operator/mesh.bolt_add/m5.py @@ -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 diff --git a/presets/operator/mesh.bolt_add/m6.py b/presets/operator/mesh.bolt_add/m6.py index 225776be84e2cc0a0caf3e5ab65bf94c78c741eb..3423866bc52fdee91021c3b01be67296ab3770c6 100644 --- a/presets/operator/mesh.bolt_add/m6.py +++ b/presets/operator/mesh.bolt_add/m6.py @@ -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 diff --git a/presets/operator/mesh.bolt_add/m8.py b/presets/operator/mesh.bolt_add/m8.py index 547cc719933c2944d9abe81b746b88965a24ebc5..d123a1ed04fea037ef5227fa3a3f8b4d1094a7a0 100644 --- a/presets/operator/mesh.bolt_add/m8.py +++ b/presets/operator/mesh.bolt_add/m8.py @@ -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