def rightGrip():# ->Outline: outline = Outline(None) outline.addLinesFromCoordinateList([[82.5, 0], [82.5, 9.5], [49.642, 9.5]]) arc = a.Arc(Point(49.642, 9.5), Point(28.5, 6.5), c.CW, Point(28.5, 82.5), 20) outline.addLineGroup(arc) outline.addLinesFromCoordinateList([[28.5, 6.5], [28.5, 0]]) outline.addLineGroup(outline.mirror(c.X)) return outline.translate(82.5, 9.5)
def testSimpleDogBone():# ->Outline: temp = Outline(None) temp.addLinesFromCoordinateList([[82.5,0],[82.5,9.5],[49.642, 9.5], [28.5,6.5],[0,6.5]]) temp.addLineGroup(temp.mirror(c.Y)) temp.addLineGroup(temp.mirror(c.X)) temp = temp.translate(82.5, 9.5) temp.finishOutline() return temp
def rightGrip() -> Outline: outline = Outline(None) outline.addLinesFromCoordinateList([[82.5, 0], [82.5, 9.5], [49.642, 9.5]]) arc = a.Arc(Point(49.642, 9.5), Point(28.5, 6.5), c.CW, Point(28.5, 82.5), 20) outline.addLineGroup(arc) outline.addLinesFromCoordinateList([[28.5, 6.5], [28.5, 0]]) outline.addLineGroup(outline.mirror(c.X)) return outline.translate(82.5, 9.5)
def testSimpleDogBone() -> Outline: temp = Outline(None) temp.addLinesFromCoordinateList([[82.5, 0], [82.5, 9.5], [49.642, 9.5], [28.5, 6.5], [0, 6.5]]) temp.addLineGroup(temp.mirror(c.Y)) temp.addLineGroup(temp.mirror(c.X)) temp = temp.translate(82.5, 9.5) temp.finishOutline() return temp
def regularDogBone() ->Outline: dogBone = Outline(None) dogBone.addLinesFromCoordinateList([[82.5, 0], [82.5, 9.5], [49.642, 9.5]]) arc = a.Arc(Point(49.642, 9.5), Point(28.5, 6.5), c.CW, Point(28.5, 82.5), 20) dogBone.addLineGroup(arc) dogBone.addLinesFromCoordinateList([[28.5, 6.5], [0, 6.5]]) dogBone.addLineGroup(dogBone.mirror(c.Y)) dogBone.addLineGroup(dogBone.mirror(c.X)) dogBone = dogBone.translate(82.5, 9.5) dogBone.finishOutline() return dogBone
def regularDogBone() -> Outline: dogBone = Outline(None) dogBone.addLinesFromCoordinateList([[82.5, 0], [82.5, 9.5], [49.642, 9.5]]) arc = a.Arc(Point(49.642, 9.5), Point(28.5, 6.5), c.CW, Point(28.5, 82.5), 20) dogBone.addLineGroup(arc) dogBone.addLinesFromCoordinateList([[28.5, 6.5], [0, 6.5]]) dogBone.addLineGroup(dogBone.mirror(c.Y)) dogBone.addLineGroup(dogBone.mirror(c.X)) dogBone = dogBone.translate(82.5, 9.5) dogBone.finishOutline() dogBone._name = 'regularDogBone' return dogBone
def wideDogBone(gageWidth: float) ->Outline: halfWidth = gageWidth / 2.0 wideDogBone = Outline(None) wideDogBone.addLinesFromCoordinateList([[82.5, 0], [82.5, 9.5 + halfWidth], [49.642, 9.5 + halfWidth]]) wideArc = a.Arc(Point(49.642, 9.5 + halfWidth), Point(28.5, 6.5 + halfWidth), c.CW, Point(28.5, 82.5 + halfWidth), 20) wideDogBone.addLineGroup(wideArc) wideDogBone.addLinesFromCoordinateList([[28.5, 6.5 + halfWidth], [0, 6.5 + halfWidth]]) wideDogBone.addLineGroup(wideDogBone.mirror(c.Y)) wideDogBone.addLineGroup(wideDogBone.mirror(c.X)) return wideDogBone.translate(82.5, 9.5 + halfWidth)
def wideDogBone(gageWidth: float) -> Outline: halfWidth = gageWidth / 2.0 wideDogBone = Outline(None) wideDogBone.addLinesFromCoordinateList([[82.5, 0], [82.5, 9.5 + halfWidth], [49.642, 9.5 + halfWidth]]) wideArc = a.Arc(Point(49.642, 9.5 + halfWidth), Point(28.5, 6.5 + halfWidth), c.CW, Point(28.5, 82.5 + halfWidth), 20) wideDogBone.addLineGroup(wideArc) wideDogBone.addLinesFromCoordinateList([[28.5, 6.5 + halfWidth], [0, 6.5 + halfWidth]]) wideDogBone.addLineGroup(wideDogBone.mirror(c.Y)) wideDogBone.addLineGroup(wideDogBone.mirror(c.X)) return wideDogBone.translate(82.5, 9.5 + halfWidth)
def typeVDogBone(scale: float) -> Outline: typeV = Outline(None) typeV.addLinesFromCoordinateList([[31.75, 0], [31.75, 3.77]]) arc = a.Arc(Point(31.75, 3.77), Point(30.75, 4.77), c.CCW, Point(30.75, 3.77), 5) #1mm fillet typeV.addLineGroup(arc) typeV.addLinesFromCoordinateList([[30.75, 4.77], [13.17, 4.77]]) arc = a.Arc(Point(13.17, 4.77), Point(4.77, 1.59), c.CW, Point(4.77, 14.29)) typeV.addLineGroup(arc) typeV.addLinesFromCoordinateList([[4.77, 1.59], [0, 1.59]]) typeV.addLineGroup(typeV.mirror(c.Y)) typeV.addLineGroup(typeV.mirror(c.X)) typeV = typeV.translate(31.75, 4.77) typeV.finishOutline() typeV = typeV.scale(scale) typeV._name = 'typeVDogBone' return typeV
def regularDogBoneFillet(scale: float) -> Outline: dogBoneF = Outline(None) dogBoneF.addLinesFromCoordinateList([[82.5, 0], [82.5, 4.5]]) arc = a.Arc(Point(82.5, 4.5), Point(77.5, 9.5), c.CCW, Point(77.5, 4.5), 6) #5mm fillet dogBoneF.addLineGroup(arc) dogBoneF.addLinesFromCoordinateList([[77.5, 9.5], [49.642, 9.5]]) arc = a.Arc(Point(49.642, 9.5), Point(28.5, 6.5), c.CW, Point(28.5, 82.5), 20) dogBoneF.addLineGroup(arc) dogBoneF.addLinesFromCoordinateList([[28.5, 6.5], [0, 6.5]]) dogBoneF.addLineGroup(dogBoneF.mirror(c.Y)) dogBoneF.addLineGroup(dogBoneF.mirror(c.X)) dogBoneF = dogBoneF.translate(82.5, 9.5) dogBoneF.finishOutline() dogBoneF = dogBoneF.scale(scale) dogBoneF._name = 'regularDogBoneFillet' return dogBoneF
with open(path + paramFile, 'r') as fp: data = json.load(fp) params = Parameters(data[0], data[1]) for fname, color, angle in zip(fnames, colors, angles): mesh = trimesh.load_mesh(path + fname) meshes.append(mesh) section = mesh.section(plane_origin=[0, 0, 0.01], plane_normal=[0, 0, 1]) loops = section.discrete for loop in loops: outline = Outline() outline._name = fname outline.addCoordLoop(loop * 1000) # 1000 to convert from meters to mm outline = outline.translate(-50, -12) secAngs.append(SecAng(Section(outline), angle)) plt.plot(loop[:, 0] - 0.050, loop[:, 1] - 0.012, color) params.outline = [tuple(secAngs)] gCode = Gcode(params) plt.show() def run(): startTime = time.time() print('\nGenerating code, please wait...') fig = fg.Figura(params, gCode) with open(path + params.outputFileName, 'w') as f:
def center() -> Outline: outline = Outline(None) outline.addLinesFromCoordinateList([[28.5, 6.5], [-28.5, 6.5], [-28.5, -6.5], [28.5, -6.5], [28.5, 6.5]]) return outline.translate(82.5, 9.5)
def center():# ->Outline: outline = Outline(None) outline.addLinesFromCoordinateList([[28.5, 6.5], [-28.5, 6.5], [-28.5, -6.5], [28.5, -6.5], [28.5, 6.5]]) return outline.translate(82.5, 9.5)