diff options
author | Aaron Keith <aaroninusa@gmail.com> | 2010-08-22 14:25:52 +0400 |
---|---|---|
committer | Aaron Keith <aaroninusa@gmail.com> | 2010-08-22 14:25:52 +0400 |
commit | 64cd75ababfe8b35187eac331354f717f59bc0ed (patch) | |
tree | 438a80905d0d0cb7136ae0cd0702204f351e36d7 /add_mesh_BoltFactory/createMesh.py | |
parent | a84278ad5a3ded81544062f7717861cb8c7b37dd (diff) |
Added counter sink head type
Diffstat (limited to 'add_mesh_BoltFactory/createMesh.py')
-rw-r--r-- | add_mesh_BoltFactory/createMesh.py | 66 |
1 files changed, 59 insertions, 7 deletions
diff --git a/add_mesh_BoltFactory/createMesh.py b/add_mesh_BoltFactory/createMesh.py index 86c1b40d..3fd892e3 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 + + |