diff --git a/add_mesh_BoltFactory/Boltfactory.py b/add_mesh_BoltFactory/Boltfactory.py index 4ba11db076233fc7ed0054970b23273fcbe9d89e..27c0d8ccd9ab832d82c5dc8c57f125f59b2e7480 100644 --- a/add_mesh_BoltFactory/Boltfactory.py +++ b/add_mesh_BoltFactory/Boltfactory.py @@ -59,11 +59,12 @@ class add_mesh_bolt(bpy.types.Operator): description='Choose the type off model you would like', items = Model_Type_List, default = 'bf_Model_Bolt') - #Head Types + #Head Types Model_Type_List = [('bf_Head_Hex','HEX','Hex Head'), ('bf_Head_Cap','CAP','Cap 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_Type = EnumProperty( attr='bf_Head_Type', name='Head', description='Choose the type off Head you would like', @@ -123,6 +124,11 @@ class add_mesh_bolt(bpy.types.Operator): min = 0, soft_min = 0, max = MAX_INPUT_NUMBER, description='Flat Distance of the Hex Head') + bf_CounterSink_Head_Dia = FloatProperty( attr='bf_CounterSink_Head_Dia', + name='Head Dia', default = 5.5, + min = 0, soft_min = 0, max = MAX_INPUT_NUMBER, + description='Diameter of the Counter Sink Head') + bf_Cap_Head_Height = FloatProperty( attr='bf_Cap_Head_Height', name='Head Height', default = 5.5, min = 0, soft_min = 0, max = MAX_INPUT_NUMBER, @@ -210,12 +216,20 @@ class add_mesh_bolt(bpy.types.Operator): col.prop(props, 'bf_Model_Type') col.prop(props, 'bf_presets') col.separator() - #Shank + + #Bit if props.bf_Model_Type == 'bf_Model_Bolt': - col.label(text='Shank') - col.prop(props, 'bf_Shank_Length') - col.prop(props, 'bf_Shank_Dia') + col.prop(props, 'bf_Bit_Type') + if props.bf_Bit_Type == 'bf_Bit_None': + DoNothing = 1; + elif props.bf_Bit_Type == 'bf_Bit_Allen': + col.prop(props,'bf_Allen_Bit_Depth') + col.prop(props,'bf_Allen_Bit_Flat_Distance') + elif props.bf_Bit_Type == 'bf_Bit_Philips': + col.prop(props,'bf_Phillips_Bit_Depth') + col.prop(props,'bf_Philips_Bit_Dia') col.separator() + #Head if props.bf_Model_Type == 'bf_Model_Bolt': col.prop(props, 'bf_Head_Type') @@ -229,19 +243,20 @@ class add_mesh_bolt(bpy.types.Operator): col.prop(props,'bf_Dome_Head_Dia') elif props.bf_Head_Type == 'bf_Head_Pan': col.prop(props,'bf_Pan_Head_Dia') + elif props.bf_Head_Type == 'bf_Head_CounterSink': + col.prop(props,'bf_CounterSink_Head_Dia') col.separator() - #Bit + #Shank if props.bf_Model_Type == 'bf_Model_Bolt': - col.prop(props, 'bf_Bit_Type') - if props.bf_Bit_Type == 'bf_Bit_None': - DoNothing = 1; - elif props.bf_Bit_Type == 'bf_Bit_Allen': - col.prop(props,'bf_Allen_Bit_Depth') - col.prop(props,'bf_Allen_Bit_Flat_Distance') - elif props.bf_Bit_Type == 'bf_Bit_Philips': - col.prop(props,'bf_Phillips_Bit_Depth') - col.prop(props,'bf_Philips_Bit_Dia') + col.label(text='Shank') + col.prop(props, 'bf_Shank_Length') + col.prop(props, 'bf_Shank_Dia') col.separator() + #Nut + if props.bf_Model_Type == 'bf_Model_Nut': + col.prop(props, 'bf_Nut_Type') + col.prop(props,'bf_Hex_Nut_Height') + col.prop(props,'bf_Hex_Nut_Flat_Distance') #Thread col.label(text='Thread') if props.bf_Model_Type == 'bf_Model_Bolt': @@ -251,11 +266,7 @@ class add_mesh_bolt(bpy.types.Operator): col.prop(props,'bf_Pitch') col.prop(props,'bf_Crest_Percent') col.prop(props,'bf_Root_Percent') - #Nut - if props.bf_Model_Type == 'bf_Model_Nut': - col.prop(props, 'bf_Nut_Type') - col.prop(props,'bf_Hex_Nut_Height') - col.prop(props,'bf_Hex_Nut_Flat_Distance') + ##### POLL ##### @@ -272,13 +283,14 @@ class add_mesh_bolt(bpy.types.Operator): if not self.last_preset or props.bf_presets != self.last_preset: #print('setting Preset', props.bf_presets) setProps(props, props.bf_presets, self.presetsPath) + props.bf_Phillips_Bit_Depth = float(Get_Phillips_Bit_Height(props.bf_Philips_Bit_Dia)) self.last_preset = props.bf_presets - props.bf_Phillips_Bit_Depth = float(Get_Phillips_Bit_Height(props.bf_Philips_Bit_Dia)) - props.bf_Philips_Bit_Dia = props.bf_Pan_Head_Dia*(1.82/5.6) - props.bf_Minor_Dia = props.bf_Major_Dia - (1.082532 * props.bf_Pitch) + #props.bf_Phillips_Bit_Depth = float(Get_Phillips_Bit_Height(props.bf_Philips_Bit_Dia)) + #props.bf_Philips_Bit_Dia = props.bf_Pan_Head_Dia*(1.82/5.6) + #props.bf_Minor_Dia = props.bf_Major_Dia - (1.082532 * props.bf_Pitch) Create_New_Mesh(props, context, self.align_matrix) diff --git a/add_mesh_BoltFactory/createMesh.py b/add_mesh_BoltFactory/createMesh.py index 86c1b40d46747ce8b5d636fa95927e4fe19f5997..3fd892e32356543fa3df3a391e8e365a3d56866b 100644 --- a/add_mesh_BoltFactory/createMesh.py +++ b/add_mesh_BoltFactory/createMesh.py @@ -16,6 +16,7 @@ # # ##### END GPL LICENSE BLOCK ##### + import os #remove this import bpy @@ -576,7 +577,7 @@ def Create_Pan_Head(HOLE_DIA,HEAD_DIA,SHANK_DIA,HEIGHT,RAD1,RAD2,FACE_OFFSET): sVerts,sFaces = SpinDup(verts,faces,360,DIV,'z') 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,1)) + faces.extend(Build_Face_List_Quads(FaceStart,Row-1,DIV)) Global_Head_Height = HEIGHT ; @@ -644,12 +645,60 @@ def Create_Dome_Head(HOLE_DIA,HEAD_DIA,SHANK_DIA,HEIGHT,RAD1,RAD2,FACE_OFFSET): sVerts,sFaces = SpinDup(verts,faces,360,DIV,'z') 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,1)) + faces.extend(Build_Face_List_Quads(FaceStart,Row-1,DIV)) return sVerts,faces,Dome_Height +def Create_CounterSink_Head(HOLE_DIA,HEAD_DIA,SHANK_DIA,HEIGHT,RAD1): + DIV = 36 + + HOLE_RADIUS = HOLE_DIA * 0.5 + HEAD_RADIUS = HEAD_DIA * 0.5 + SHANK_RADIUS = SHANK_DIA * 0.5 + + + verts = [] + faces = [] + Row = 0 + BEVEL = HEIGHT * 0.01 + + + +# HEAD_RADIUS = (HEIGHT/tan(radians(60))) + SHANK_RADIUS + HEIGHT = tan(radians(60)) * (HEAD_RADIUS - SHANK_RADIUS) + #print (RAD1) + + FaceStart = len(verts) + + verts.append([HOLE_RADIUS,0.0,0.0]) + Row += 1 + + #rad + + for i in range(0,100,10): + x = sin(radians(i))*RAD1 + z = cos(radians(i))*RAD1 + verts.append([(HEAD_RADIUS-RAD1)+x,0.0,(0.0-RAD1)+z]) + Row += 1 + + + verts.append([SHANK_RADIUS,0.0,0.0-HEIGHT]) + Row += 1 + + + sVerts,sFaces = SpinDup(verts,faces,360,DIV,'z') + 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,1)) + + return sVerts,faces,HEIGHT + + + + def Create_Cap_Head(HOLE_DIA,HEAD_DIA,SHANK_DIA,HEIGHT,RAD1,RAD2): DIV = 36 @@ -696,12 +745,11 @@ def Create_Cap_Head(HOLE_DIA,HEAD_DIA,SHANK_DIA,HEIGHT,RAD1,RAD2): 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,1)) + faces.extend(Build_Face_List_Quads(FaceStart,Row-1,DIV)) return sVerts,faces,HEIGHT+RAD2 - def Create_Hex_Head(FLAT,HOLE_DIA,SHANK_DIA,HEIGHT): verts = [] @@ -1599,7 +1647,7 @@ def add_Nylon_Head(OUTSIDE_RADIUS,Z_LOCATION = 0): 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)) - + return Move_Verts_Up_Z(sVerts,0),faces,Lowest_Z_Vert @@ -1652,7 +1700,7 @@ def add_Nylon_Part(OUTSIDE_RADIUS,Z_LOCATION = 0): sVerts,sFaces = SpinDup(verts,faces,360,DIV,'z') 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)) + faces.extend(Build_Face_List_Quads(FaceStart,Row-1,DIV,1)) return sVerts,faces,0 - Lowest_Z_Vert @@ -1989,6 +2037,9 @@ def Bolt_Mesh(props, context): elif props.bf_Head_Type == 'bf_Head_Pan': Head_Verts,Head_Faces,Head_Height = Create_Pan_Head(Bit_Dia,props.bf_Pan_Head_Dia,props.bf_Shank_Dia,props.bf_Hex_Head_Height,1,1,0) + elif props.bf_Head_Type == 'bf_Head_CounterSink': + Head_Verts,Head_Faces,Head_Height = Create_CounterSink_Head(Bit_Dia,props.bf_CounterSink_Head_Dia,props.bf_Shank_Dia,props.bf_CounterSink_Head_Dia,props.bf_CounterSink_Head_Dia*(0.09/6.31)) +#Head_Verts,Head_Faces,Head_Height = Create_CounterSink_Head(Bit_Dia,props.bf_CounterSink_Head_Dia,props.bf_Shank_Dia,props.bf_CounterSink_Head_Dia,props.bf_CounterSink_Head_Dia*(1.0/19.0)) Face_Start = len(verts) verts.extend(Move_Verts_Up_Z(Bit_Verts,Head_Height)) @@ -2054,4 +2105,5 @@ def Create_New_Mesh(props, context, align_matrix): #print("Created_Object") return - \ No newline at end of file + + diff --git a/add_mesh_BoltFactory/presets/M10.py b/add_mesh_BoltFactory/presets/M10.py index 162acd26bfe03431f205352d8a40460c0df59359..3ebc8ec5fcbb7ee4c4bc34716a61832aa8ddf1b5 100644 --- a/add_mesh_BoltFactory/presets/M10.py +++ b/add_mesh_BoltFactory/presets/M10.py @@ -4,16 +4,17 @@ props.bf_Pitch = 1.25 #Fine props.bf_Crest_Percent = 10 props.bf_Root_Percent = 10 props.bf_Major_Dia = 10.0 -#props.bf_Minor_Dia = props.bf_Major_Dia - (1.082532 * props.bf_Pitch) +props.bf_Minor_Dia = props.bf_Major_Dia - (1.082532 * props.bf_Pitch) props.bf_Hex_Head_Flat_Distance = 17.0 props.bf_Hex_Head_Height = 6.4 props.bf_Cap_Head_Dia = 16.0 props.bf_Cap_Head_Height = 10.0 +props.bf_CounterSink_Head_Dia = 20.0 props.bf_Allen_Bit_Flat_Distance = 8.0 props.bf_Allen_Bit_Depth = 5.0 props.bf_Pan_Head_Dia = 20.0 props.bf_Dome_Head_Dia = 20.0 -#props.bf_Philips_Bit_Dia = props.bf_Pan_Head_Dia*(1.82/5.6) +props.bf_Philips_Bit_Dia = props.bf_Pan_Head_Dia*(1.82/5.6) #props.bf_Phillips_Bit_Depth = Get_Phillips_Bit_Height(props.bf_Philips_Bit_Dia) props.bf_Hex_Nut_Height = 8.0 props.bf_Hex_Nut_Flat_Distance = 17.0 diff --git a/add_mesh_BoltFactory/presets/M12.py b/add_mesh_BoltFactory/presets/M12.py index 58b7f57069745fa775087b23bd313746bce7fdbb..03b305d3c69f7719a8b1e9979af5e361db7cda8a 100644 --- a/add_mesh_BoltFactory/presets/M12.py +++ b/add_mesh_BoltFactory/presets/M12.py @@ -3,16 +3,17 @@ props.bf_Pitch = 1.50 #Fine props.bf_Crest_Percent = 10 props.bf_Root_Percent = 10 props.bf_Major_Dia = 12.0 -#props.bf_Minor_Dia = props.bf_Major_Dia - (1.082532 * props.bf_Pitch) +props.bf_Minor_Dia = props.bf_Major_Dia - (1.082532 * props.bf_Pitch) props.bf_Hex_Head_Flat_Distance = 19.0 props.bf_Hex_Head_Height = 7.5 props.bf_Cap_Head_Dia = 18.5 props.bf_Cap_Head_Height = 12.0 +props.bf_CounterSink_Head_Dia = 22.0 props.bf_Allen_Bit_Flat_Distance = 10.0 props.bf_Allen_Bit_Depth = 6.0 props.bf_Pan_Head_Dia = 24.0 props.bf_Dome_Head_Dia = 24.0 -#props.bf_Philips_Bit_Dia = props.bf_Pan_Head_Dia*(1.82/5.6) +props.bf_Philips_Bit_Dia = props.bf_Pan_Head_Dia*(1.82/5.6) #props.bf_Phillips_Bit_Depth = Get_Phillips_Bit_Height(props.bf_Philips_Bit_Dia) props.bf_Hex_Nut_Height = 10.0 props.bf_Hex_Nut_Flat_Distance = 19.0 diff --git a/add_mesh_BoltFactory/presets/M3.py b/add_mesh_BoltFactory/presets/M3.py index ec047c39d44293ec688ebb40b113b2463684c42d..c8e2673c512230088b5225cff95040620a858187 100644 --- a/add_mesh_BoltFactory/presets/M3.py +++ b/add_mesh_BoltFactory/presets/M3.py @@ -4,16 +4,17 @@ props.bf_Pitch = 0.35 #Fine props.bf_Crest_Percent = 10 props.bf_Root_Percent = 10 props.bf_Major_Dia = 3.0 -#props.bf_Minor_Dia = props.bf_Major_Dia - (1.082532 * props.bf_Pitch) +props.bf_Minor_Dia = props.bf_Major_Dia - (1.082532 * props.bf_Pitch) props.bf_Hex_Head_Flat_Distance = 5.5 props.bf_Hex_Head_Height = 2.0 props.bf_Cap_Head_Dia = 5.5 props.bf_Cap_Head_Height = 3.0 +props.bf_CounterSink_Head_Dia = 6.3 props.bf_Allen_Bit_Flat_Distance = 2.5 props.bf_Allen_Bit_Depth = 1.5 props.bf_Pan_Head_Dia = 5.6 props.bf_Dome_Head_Dia = 5.6 -#props.bf_Philips_Bit_Dia = props.bf_Pan_Head_Dia*(1.82/5.6) +props.bf_Philips_Bit_Dia = props.bf_Pan_Head_Dia*(1.82/5.6) #props.bf_Phillips_Bit_Depth = Get_Phillips_Bit_Height(props.bf_Philips_Bit_Dia) props.bf_Hex_Nut_Height = 2.4 props.bf_Hex_Nut_Flat_Distance = 5.5 diff --git a/add_mesh_BoltFactory/presets/M4.py b/add_mesh_BoltFactory/presets/M4.py index 83f69701f5dd9c09da746b5929d14ab6ede5b040..200c8d555efc4d50c5114f5b374cd3aa2867123c 100644 --- a/add_mesh_BoltFactory/presets/M4.py +++ b/add_mesh_BoltFactory/presets/M4.py @@ -4,16 +4,17 @@ props.bf_Pitch = 0.5 #Fine props.bf_Crest_Percent = 10 props.bf_Root_Percent = 10 props.bf_Major_Dia = 4.0 -#props.bf_Minor_Dia = props.bf_Major_Dia - (1.082532 * props.bf_Pitch) +props.bf_Minor_Dia = props.bf_Major_Dia - (1.082532 * props.bf_Pitch) props.bf_Hex_Head_Flat_Distance = 7.0 props.bf_Hex_Head_Height = 2.8 props.bf_Cap_Head_Dia = 7.0 props.bf_Cap_Head_Height = 4.0 +props.bf_CounterSink_Head_Dia = 9.4 props.bf_Allen_Bit_Flat_Distance = 3.0 props.bf_Allen_Bit_Depth = 2.0 props.bf_Pan_Head_Dia = 8.0 props.bf_Dome_Head_Dia = 8.0 -#props.bf_Philips_Bit_Dia = props.bf_Pan_Head_Dia*(1.82/5.6) +props.bf_Philips_Bit_Dia = props.bf_Pan_Head_Dia*(1.82/5.6) #props.bf_Phillips_Bit_Depth = Get_Phillips_Bit_Height(props.bf_Philips_Bit_Dia) props.bf_Hex_Nut_Height = 3.2 props.bf_Hex_Nut_Flat_Distance = 7.0 diff --git a/add_mesh_BoltFactory/presets/M5.py b/add_mesh_BoltFactory/presets/M5.py index 5eec9efca0f94eb632d8da727690e57bc61c9a96..65cd1a9efe8446def9ce65dc5a1aea1c01f164f5 100644 --- a/add_mesh_BoltFactory/presets/M5.py +++ b/add_mesh_BoltFactory/presets/M5.py @@ -4,16 +4,17 @@ props.bf_Pitch = 0.5 #Fine props.bf_Crest_Percent = 10 props.bf_Root_Percent = 10 props.bf_Major_Dia = 5.0 -#props.bf_Minor_Dia = props.bf_Major_Dia - (1.082532 * props.bf_Pitch) +props.bf_Minor_Dia = props.bf_Major_Dia - (1.082532 * props.bf_Pitch) props.bf_Hex_Head_Flat_Distance = 8.0 props.bf_Hex_Head_Height = 3.5 props.bf_Cap_Head_Dia = 8.5 props.bf_Cap_Head_Height = 5.0 +props.bf_CounterSink_Head_Dia = 10.4 props.bf_Allen_Bit_Flat_Distance = 4.0 props.bf_Allen_Bit_Depth = 2.5 props.bf_Pan_Head_Dia = 9.5 props.bf_Dome_Head_Dia = 9.5 -#props.bf_Philips_Bit_Dia = props.bf_Pan_Head_Dia*(1.82/5.6) +props.bf_Philips_Bit_Dia = props.bf_Pan_Head_Dia*(1.82/5.6) #props.bf_Phillips_Bit_Depth = Get_Phillips_Bit_Height(props.bf_Philips_Bit_Dia) props.bf_Hex_Nut_Height = 4.0 props.bf_Hex_Nut_Flat_Distance = 8.0 diff --git a/add_mesh_BoltFactory/presets/M6.py b/add_mesh_BoltFactory/presets/M6.py index 49f833c088d355c9698e3484c6327577f1f4e15c..38b2f7b68460ccadafbf96535dd0f82623654bcd 100644 --- a/add_mesh_BoltFactory/presets/M6.py +++ b/add_mesh_BoltFactory/presets/M6.py @@ -4,16 +4,17 @@ props.bf_Pitch = 0.75 #Fine props.bf_Crest_Percent = 10 props.bf_Root_Percent = 10 props.bf_Major_Dia = 6.0 -#props.bf_Minor_Dia = props.bf_Major_Dia - (1.082532 * props.bf_Pitch) +props.bf_Minor_Dia = props.bf_Major_Dia - (1.082532 * props.bf_Pitch) props.bf_Hex_Head_Flat_Distance = 10.0 props.bf_Hex_Head_Height = 4.0 props.bf_Cap_Head_Dia = 10.0 props.bf_Cap_Head_Height = 6.0 +props.bf_CounterSink_Head_Dia = 12.6 props.bf_Allen_Bit_Flat_Distance = 5.0 props.bf_Allen_Bit_Depth = 3.0 props.bf_Pan_Head_Dia = 12.0 props.bf_Dome_Head_Dia = 12.0 -#props.bf_Philips_Bit_Dia = props.bf_Pan_Head_Dia*(1.82/5.6) +props.bf_Philips_Bit_Dia = props.bf_Pan_Head_Dia*(1.82/5.6) #props.bf_Phillips_Bit_Depth = Get_Phillips_Bit_Height(props.bf_Philips_Bit_Dia) props.bf_Hex_Nut_Height = 5.0 props.bf_Hex_Nut_Flat_Distance = 10.0 diff --git a/add_mesh_BoltFactory/presets/M8.py b/add_mesh_BoltFactory/presets/M8.py index 6bb00bf29dc0cb54a9f22a09e27cf8a443342e7c..56fd432d562ec14a2f8ef7d604cb83ab3e403edb 100644 --- a/add_mesh_BoltFactory/presets/M8.py +++ b/add_mesh_BoltFactory/presets/M8.py @@ -4,16 +4,17 @@ props.bf_Pitch = 1.00 #Fine props.bf_Crest_Percent = 10 props.bf_Root_Percent = 10 props.bf_Major_Dia = 8.0 -#props.bf_Minor_Dia = props.bf_Major_Dia - (1.082532 * props.bf_Pitch) +props.bf_Minor_Dia = props.bf_Major_Dia - (1.082532 * props.bf_Pitch) props.bf_Hex_Head_Flat_Distance = 13.0 props.bf_Hex_Head_Height = 5.3 props.bf_Cap_Head_Dia = 13.5 props.bf_Cap_Head_Height = 8.0 +props.bf_CounterSink_Head_Dia = 17.3 props.bf_Allen_Bit_Flat_Distance = 6.0 props.bf_Allen_Bit_Depth = 4.0 props.bf_Pan_Head_Dia = 16.0 props.bf_Dome_Head_Dia = 16.0 -#props.bf_Philips_Bit_Dia = props.bf_Pan_Head_Dia*(1.82/5.6) +props.bf_Philips_Bit_Dia = props.bf_Pan_Head_Dia*(1.82/5.6) #props.bf_Phillips_Bit_Depth = Get_Phillips_Bit_Height(props.bf_Philips_Bit_Dia) props.bf_Hex_Nut_Height = 6.5 props.bf_Hex_Nut_Flat_Distance = 13.0