Changeset View
Changeset View
Standalone View
Standalone View
add_mesh_BoltFactory/createMesh.py
| Context not available. | |||||
| # make up an array of 4 point polygon. | # make up an array of 4 point polygon. | ||||
| def Build_Face_List_Quads(OFFSET,COLUM,ROW,FLIP = 0): | def Build_Face_List_Quads(OFFSET,COLUM,ROW,FLIP = 0): | ||||
| Ret =[] | Ret =[] | ||||
| RowStart = 0; | RowStart = 0 | ||||
| for j in range(ROW): | for j in range(ROW): | ||||
| for i in range(COLUM): | for i in range(COLUM): | ||||
| Res1 = RowStart + i; | Res1 = RowStart + i | ||||
| Res2 = RowStart + i + (COLUM +1) | Res2 = RowStart + i + (COLUM +1) | ||||
| Res3 = RowStart + i + (COLUM +1) +1 | Res3 = RowStart + i + (COLUM +1) +1 | ||||
| Res4 = RowStart+i+1 | Res4 = RowStart+i+1 | ||||
| Context not available. | |||||
| return None | return None | ||||
| for i in range(NUM-2): | for i in range(NUM-2): | ||||
| if (i%2): | if (i%2): | ||||
| TempFace[0] = Face[C]; | TempFace[0] = Face[C] | ||||
| TempFace[1] = Face[C] + 1; | TempFace[1] = Face[C] + 1 | ||||
| TempFace[2] = Face[B]; | TempFace[2] = Face[B] | ||||
| if FACE_DOWN: | if FACE_DOWN: | ||||
| Ret.append([OFFSET+Face[2],OFFSET+Face[1],OFFSET+Face[0]]) | Ret.append([OFFSET+Face[2],OFFSET+Face[1],OFFSET+Face[0]]) | ||||
| else: | else: | ||||
| Ret.append([OFFSET+Face[0],OFFSET+Face[1],OFFSET+Face[2]]) | Ret.append([OFFSET+Face[0],OFFSET+Face[1],OFFSET+Face[2]]) | ||||
| else: | else: | ||||
| TempFace[0] =Face[C]; | TempFace[0] =Face[C] | ||||
| if Face[C] == 0: | if Face[C] == 0: | ||||
| TempFace[1] = NUM-1; | TempFace[1] = NUM-1 | ||||
| else: | else: | ||||
| TempFace[1] = Face[C] - 1; | TempFace[1] = Face[C] - 1 | ||||
| TempFace[2] = Face[B]; | TempFace[2] = Face[B] | ||||
| if FACE_DOWN: | if FACE_DOWN: | ||||
| Ret.append([OFFSET+Face[0],OFFSET+Face[1],OFFSET+Face[2]]) | Ret.append([OFFSET+Face[0],OFFSET+Face[1],OFFSET+Face[2]]) | ||||
| else: | else: | ||||
| Context not available. | |||||
| Flat_Height = HEIGHT - Undercut_Height - Shank_Bevel | Flat_Height = HEIGHT - Undercut_Height - Shank_Bevel | ||||
| #Undercut_Height = 5 | #Undercut_Height = 5 | ||||
| SHANK_RADIUS = SHANK_DIA/2 | SHANK_RADIUS = SHANK_DIA/2 | ||||
| Row = 0; | Row = 0 | ||||
| verts.append([0.0,0.0,0.0]) | verts.append([0.0,0.0,0.0]) | ||||
| Context not available. | |||||
| def Thread_Start3(verts,INNER_RADIUS,OUTTER_RADIUS,PITCH,DIV,CREST_PERCENT,ROOT_PERCENT,Height_Offset): | def Thread_Start3(verts,INNER_RADIUS,OUTTER_RADIUS,PITCH,DIV,CREST_PERCENT,ROOT_PERCENT,Height_Offset): | ||||
| Ret_Row = 0; | Ret_Row = 0 | ||||
| # Half_Pitch = float(PITCH)/2 # UNUSED | # Half_Pitch = float(PITCH)/2 # UNUSED | ||||
| Height_Start = Height_Offset - PITCH | Height_Start = Height_Offset - PITCH | ||||
| Context not available. | |||||
| OUTTER_RADIUS = OUTTER_DIA/2 | OUTTER_RADIUS = OUTTER_DIA/2 | ||||
| Opp = abs(START_RADIUS - OUTTER_RADIUS) | Opp = abs(START_RADIUS - OUTTER_RADIUS) | ||||
| Taper_Lentgh = Opp/tan(radians(31)); | Taper_Lentgh = Opp/tan(radians(31)) | ||||
| if Taper_Lentgh > LENGTH: | if Taper_Lentgh > LENGTH: | ||||
| Taper_Lentgh = 0 | Taper_Lentgh = 0 | ||||
| Context not available. | |||||
| Row = 0 | Row = 0 | ||||
| Lowest_Z_Vert = 0; | Lowest_Z_Vert = 0 | ||||
| Height_Offset = Z_LOCATION | Height_Offset = Z_LOCATION | ||||
| Context not available. | |||||
| Row = 0 | Row = 0 | ||||
| Lowest_Z_Vert = 0; | Lowest_Z_Vert = 0 | ||||
| Height_Offset = Z_LOCATION | Height_Offset = Z_LOCATION | ||||
| Context not available. | |||||
| Height_Offset = Z_LOCATION | Height_Offset = Z_LOCATION | ||||
| Lowest_Z_Vert = 0; | Lowest_Z_Vert = 0 | ||||
| for j in range(Num): | for j in range(Num): | ||||
| Context not available. | |||||
| Max_Height = Tapper_Height_Start - PITCH | Max_Height = Tapper_Height_Start - PITCH | ||||
| Lowest_Z_Vert = 0; | Lowest_Z_Vert = 0 | ||||
| # FaceStart = len(verts) # UNUSED | # FaceStart = len(verts) # UNUSED | ||||
| for j in range(4): | for j in range(4): | ||||
| Context not available. | |||||
| # Thread_Len = 0 # UNUSED | # Thread_Len = 0 # UNUSED | ||||
| Face_Start = len(verts) | Face_Start = len(verts) | ||||
| Offset = 0.0; | Offset = 0.0 | ||||
| Shank_Verts,Shank_Row,Offset = Create_Shank_Verts(SHANK_DIA,OUTTER_DIA,SHANK_LENGTH,Offset) | Shank_Verts,Shank_Row,Offset = Create_Shank_Verts(SHANK_DIA,OUTTER_DIA,SHANK_LENGTH,Offset) | ||||
| Total_Row += Shank_Row | Total_Row += Shank_Row | ||||
| Context not available. | |||||
| Global_NutRad = TopBevelRadius | Global_NutRad = TopBevelRadius | ||||
| Row = 0; | Row = 0 | ||||
| Lowest_Z_Vert = 0.0; | Lowest_Z_Vert = 0.0 | ||||
| verts.append([0.0,0.0,0.0]) | verts.append([0.0,0.0,0.0]) | ||||
| Context not available. | |||||
| def Create_Internal_Thread_Start_Verts(verts,INNER_RADIUS,OUTTER_RADIUS,PITCH,DIV,CREST_PERCENT,ROOT_PERCENT,Height_Offset): | def Create_Internal_Thread_Start_Verts(verts,INNER_RADIUS,OUTTER_RADIUS,PITCH,DIV,CREST_PERCENT,ROOT_PERCENT,Height_Offset): | ||||
| Ret_Row = 0; | Ret_Row = 0 | ||||
| Height_Offset = Height_Offset + PITCH #Move the offset up so that the verts start at | Height_Offset = Height_Offset + PITCH #Move the offset up so that the verts start at | ||||
| #at the correct place (Height_Start) | #at the correct place (Height_Start) | ||||
| Context not available. | |||||
| def Create_Internal_Thread_End_Verts(verts,INNER_RADIUS,OUTTER_RADIUS,PITCH,DIV,CREST_PERCENT,ROOT_PERCENT,Height_Offset): | def Create_Internal_Thread_End_Verts(verts,INNER_RADIUS,OUTTER_RADIUS,PITCH,DIV,CREST_PERCENT,ROOT_PERCENT,Height_Offset): | ||||
| Ret_Row = 0; | Ret_Row = 0 | ||||
| # Half_Pitch = float(PITCH)/2 # UNUSED | # Half_Pitch = float(PITCH)/2 # UNUSED | ||||
| #Height_End = Height_Offset - PITCH - PITCH - PITCH- PITCH - PITCH- PITCH | #Height_End = Height_Offset - PITCH - PITCH - PITCH- PITCH - PITCH- PITCH | ||||
| Context not available. | |||||