def __init__(self, doc, name='profile'): # profiles alu en U self.data = { 'side': 20., # mm 'len': 2000., # mm 'thick': 1.5, # mm 'radius': 60.5 + 1.5 - 20., # mm // bague['len'] + thick - side } """make a profile by extrusion""" # retreive configuration side = self.data['side'] thick = self.data['thick'] length = self.data['len'] # make profile shape shape = [] shape.append(Part.makeLine((0, 0, 0), (side, 0, 0))) shape.append(Part.makeLine((side, 0, 0), (side, side, 0))) shape.append(Part.makeLine((side, side, 0), (0, side, 0))) shape.append(Part.makeLine((0, side, 0), (0, side - thick, 0))) shape.append(Part.makeLine((0, side - thick, 0), (side - thick, side - thick, 0))) shape.append(Part.makeLine((side - thick, side - thick, 0), (side - thick, thick, 0))) shape.append(Part.makeLine((side - thick, thick, 0), (0, thick, 0))) shape.append(Part.makeLine((0, thick, 0), (0, 0, 0))) wire = Part.Wire(shape) wire.translate(Vector(0, -side / 2, 0)) face = Part.Face(wire) profil = face.extrude(Vector(0, 0, length)) MecaComponent.__init__(self, doc, profil, name, (0.95, 1., 1.))
def __init__(self, doc, name='fin'): # ailerons self.data = { 'len': 365., # mm 'e': 222., # mm 'p': 55., # mm 'm': 255., # mm 'thick': 3., # mm } # use profile shape to make suppressed parts of the skin shape = [] # 1st part shape.append(Vector(0, 0, 0)) shape.append(Vector(0, 0, self.data['len'])) shape.append(Vector(self.data['e'], 0, self.data['len'] - self.data['p'])) shape.append(Vector(self.data['e'], 0, self.data['len'] - self.data['p'] - self.data['m'])) shape.append(Vector(0, 0, 0)) wire = Part.makePolygon(shape) # center it wire.translate(Vector(0, - self.data['thick'] / 2, 0)) face = Part.Face(wire) # make the volume comp = face.extrude(Vector(0, self.data['thick'], 0)) # center it #comp.translate(Vector(0, - self.data['thick'] / 2, 0)) MecaComponent.__init__(self, doc, comp, name, (0.95, 1., 1.))
def __init__(self, doc, profil, skin, name='disque'): """make a disque by extrusion""" self.data = { 'thick': 5., # mm 'hole radius': 30., # mm 'diameter': skin['diameter'] + skin['thick'], # mm } side = profil['side'] radius = profil['radius'] thick = self.data['thick'] diam = self.data['diameter'] # use profile shape to make suppressed parts of the disque shape = [] # 1st part shape.append(Vector(radius, side / 2, 0)) shape.append(Vector(radius + diam, side / 2, 0)) shape.append(Vector(radius + diam, -side / 2, 0)) shape.append(Vector(radius, -side / 2, 0)) shape.append(Vector(radius, side / 2, 0)) wire0 = Part.makePolygon(shape) face0 = Part.Face(wire0) # 2nd and 3rd parts face1 = Part.Face(wire0) face2 = Part.Face(wire0) # make the volumes cut0 = face0.extrude(Vector(0, 0, thick)) cut0.rotate(Vector(0, 0, 0), Vector(0, 0, 1), 0) cut1 = face1.extrude(Vector(0, 0, thick)) cut1.rotate(Vector(0, 0, 0), Vector(0, 0, 1), 120) cut2 = face2.extrude(Vector(0, 0, thick)) cut2.rotate(Vector(0, 0, 0), Vector(0, 0, 1), 240) # make the disque disque = Part.makeCylinder(diam / 2, thick) disque = disque.cut(cut0) disque = disque.cut(cut1) disque = disque.cut(cut2) # dig the hole hole = Part.makeCylinder(self.data['hole radius'], thick) disque = disque.cut(hole) MecaComponent.__init__(self, doc, disque, name, (0.95, 1., 1.))
def __init__(self, doc, name='ecope'): self.data = { 'diameter': 123., # mm internal 'x': 30, 'y': 20, 'z': 60, 'thick': 2., # mm thickness of the door wall } thick = self.data['thick'] diam_ext = self.data['diameter'] + thick x = self.data['x'] y = self.data['y'] z = self.data['z'] # make the skin skin_ext = Part.makeCylinder(diam_ext / 2, z) # make the external box box_ext = Part.makeBox(x, y, z) box_int = Part.makeBox(x - thick, y - 2 * thick, z - thick) box_int.translate(Vector(0, thick, thick)) box = box_ext.cut(box_int) # suppress parts of flanks to have nerves (the right par is shorter due to the servo) anti_nerv_left = Part.makeBox(x - 7 * thick, y / 2, z - 3 * thick) anti_nerv_left.translate(Vector(0, y / 2, 0)) anti_nerv_right = Part.makeBox(x - 3 * thick, y / 2, z - 3 * thick) anti_nerv = anti_nerv_left.fuse(anti_nerv_right) anti_nerv.translate(Vector(0, 0, 3 * thick)) box = box.cut(anti_nerv) # dig a hole to hold the ecope in position hole = Part.makeBox(x / 2, thick, thick) hole.translate(Vector(-x / 4 + x / 2, -thick / 2 + y / 2, 0)) box = box.cut(hole) # add the holds to prevent the ecope to go away without the parachute door hold = Part.makeBox(2 * thick, 2 * thick, 3 * thick) hold_right = hold.copy() hold_right.translate(Vector(x - 5 * thick, - 2 * thick, 0)) hold_left = hold.copy() hold_left.translate(Vector(x - 5 * thick, y, 0)) box = box.fuse(hold_right) box = box.fuse(hold_left) # finalize the ecope position box.translate(Vector(diam_ext / 2 - x, -y / 2, 0)) box.rotate(Vector(0, 0, 0), Vector(0, 0, 1), 60) ecope = box.common(skin_ext) MecaComponent.__init__(self, doc, ecope, name, (0., 0., 0.))
def __init__(self, doc, prop, name='guide'): self.data = { 'thick': 2., # mm thickness of the guide wall 'len' : prop['len'] + 2. # mm thickness of the guide wall } # make the guide propu = Part.makeCylinder(prop['diameter'] / 2, prop['len']) comp = Part.makeCylinder(prop['diameter'] / 2 + self.data['thick'], self.data['len']) comp = comp.cut(propu) MecaComponent.__init__(self, doc, comp, name, (0., 0., 0.))
def __init__(self, doc, profil, name='bague'): self.data = { 'thick': 10., # mm 'hole radius': 4., # mm 'side': profil['side'] - 2 * profil['thick'], # mm 'len': 60.5, # mm } side = self.data['side'] thick = self.data['thick'] length = self.data['len'] # make bague shape shape = [] # first branch shape.append(Vector(side, -side / 2, 0)) shape.append(Vector(length, -side / 2, 0)) shape.append(Vector(length, side / 2, 0)) shape.append(Vector(side, side / 2, 0)) wire0 = Part.makePolygon(shape) # 2nd and 3rd branches wire1 = wire0.copy() wire1.rotate(Vector(0, 0, 0), Vector(0, 0, 1), 120) wire2 = wire0.copy() wire2.rotate(Vector(0, 0, 0), Vector(0, 0, 1), 240) # union of all branches wire = wire0.fuse(wire1) wire = wire.fuse(wire2) vertexes = [] for edg in wire.Edges: vertexes += edg.Vertexes points = [] for vrt in vertexes: points.append(vrt.Point) points.append(points[0]) # close the wire wire = Part.makePolygon(points) face = Part.Face(wire) # make the volume bague = face.extrude(Vector(0, 0, thick)) # dig the hole hole = Part.makeCylinder(self.data['hole radius'], thick) bague = bague.cut(hole) MecaComponent.__init__(self, doc, bague, name, (0.95, 1., 1.))
def __init__(self, doc, name='servo'): # servo parallalax servo_data = { 'x': 40.5, # mm 'y': 20.0, # mm 'z': 36.1, # mm 'cylindre r': 10.0, # mm 'cylindre h': 6.0, # mm 'cylindre offset x': 30.1, # mm 'cylindre offset z': 36.1, # mm 'maintien x': 7.5, # mm 'maintien y': 20., # mm 'maintien z': 3.5, # mm 'maintien offset z': 26.6, # mm 'taquet x': 30.1, # mm 'taquet y': 5., # mm 'taquet z': 2., # mm } data = servo_data # approximate the servo body = Part.makeBox(data['x'], data['y'], data['z']) maintien1 = Part.makeBox(data['maintien x'], data['maintien y'], data['maintien z']) maintien1.translate(Vector(data['x'], 0, data['maintien offset z'])) maintien2 = Part.makeBox(data['maintien x'], data['maintien y'], data['maintien z']) maintien2.translate(Vector(-data['maintien x'], 0, data['maintien offset z'])) cylindre = Part.makeCylinder(data['cylindre r'], data['cylindre h']) cylindre.translate(Vector(data['cylindre offset x'], data['y'] / 2, data['cylindre offset z'])) taquet = Part.makeBox(data['taquet x'], data['taquet x'], data['taquet z']) taquet.translate(Vector(-data['taquet y'] / 2, -data['taquet y'] / 2, 0)) taq_com = Part.makeCylinder(data['taquet x'] - data['taquet y'], data['taquet z']) taquet = taquet.common(taq_com) taquet.rotate(Vector(0, 0, 0), Vector(0, 0, 1), 180) taquet.translate(Vector(data['cylindre offset x'], data['y'] / 2, data['z'] + data['cylindre h'])) servo = body.fuse(maintien1) servo = servo.fuse(maintien2) servo = servo.fuse(cylindre) servo = servo.fuse(taquet) servo.translate(Vector(-data['x'] / 2, -data['y'] / 2, -data['z'] / 2)) servo.rotate(Vector(0, 0, 0), Vector(1, 0, 0), -90) servo.rotate(Vector(0, 0, 0), Vector(0, 0, 1), 90) servo = servo.common(servo) MecaComponent.__init__(self, doc, servo, name, (0.95, 1., 1.))
def __init__(self, doc, profil, name='skin_item'): self.data = { 'diameter_hi': 123., # mm internal 'diameter_lo': 62., # mm internal 'thick': 2., # mm 'len': 160, # mm } side = profil['side'] radius = profil['radius'] diam_hi_int = self.data['diameter_hi'] diam_hi_ext = self.data['diameter_hi'] + self.data['thick'] diam_lo_int = self.data['diameter_lo'] diam_lo_ext = self.data['diameter_lo'] + self.data['thick'] length = self.data['len'] # use profile shape to make suppressed parts of the skin shape = [] # 1st part shape.append(Vector(radius, side / 2, 0)) shape.append(Vector(radius + diam_hi_ext, side / 2, 0)) shape.append(Vector(radius + diam_hi_ext, -side / 2, 0)) shape.append(Vector(radius, -side / 2, 0)) shape.append(Vector(radius, side / 2, 0)) wire0 = Part.makePolygon(shape) face0 = Part.Face(wire0) # 2nd part face1 = Part.Face(wire0) # make the volumes cut0 = face0.extrude(Vector(0, 0, length)) cut0.rotate(Vector(0, 0, 0), Vector(0, 0, 1), 0) cut1 = face1.extrude(Vector(0, 0, length)) cut1.rotate(Vector(0, 0, 0), Vector(0, 0, 1), 120) # make the skin skin_ext = Part.makeCone(diam_lo_ext / 2, diam_hi_ext / 2, length, Vector(0, 0, 0), Vector(0, 0, 1), 120) skin_int = Part.makeCone(diam_lo_int / 2, diam_hi_int / 2, length, Vector(0, 0, 0), Vector(0, 0, 1), 120) skin = skin_ext.cut(skin_int) # suppress the profiles shape skin = skin.cut(cut0) skin = skin.cut(cut1) MecaComponent.__init__(self, doc, skin, name, (0., 0., 0.))
def __init__(self, doc, name='Pro_54_5G'): # propulseur Pro 54 5G self.data = { 'len': 488. + 16., # mm 'diameter': 54., # mm 'hold diameter': 58., # mm 'hold thick': 9.5, # mm 'tuyere diameter': 32., # mm 'tuyere len': 13., # mm } # approximate the prop prop = self.data body = Part.makeCylinder(prop['diameter'] / 2, prop['len']) hold = Part.makeCylinder(prop['hold diameter'] / 2, prop['hold thick']) hold.translate(Vector(0, 0, -prop['hold thick'])) tuyere = Part.makeCylinder(prop['tuyere diameter'] / 2, prop['tuyere len']) tuyere.translate(Vector(0, 0, -prop['hold thick'] - prop['tuyere len'])) comp = body.fuse(hold) comp = comp.fuse(tuyere) MecaComponent.__init__(self, doc, comp, name, (0.95, 1., 1.))
def __init__(self, doc, profil, name='prop_hold'): self.data = { 'diameter_hi': 123., # mm internal 'diameter_lo': 62., # mm internal 'thick': 2., # mm 'len': 160, # mm } side = profil['side'] radius = profil['radius'] diam_hi_int = self.data['diameter_hi'] diam_hi_ext = self.data['diameter_hi'] + self.data['thick'] diam_lo_int = self.data['diameter_lo'] diam_lo_ext = self.data['diameter_lo'] + self.data['thick'] length = self.data['len'] # use profile shape to make suppressed parts of the skin shape = [] shape.append(Vector(radius - 20, side / 2, 0)) shape.append(Vector(radius + diam_hi_ext, side / 2, 0)) shape.append(Vector(radius + diam_hi_ext, -side / 2, 0)) shape.append(Vector(radius - 20, -side / 2, 0)) shape.append(Vector(radius - 20, side / 2, 0)) wire = Part.makePolygon(shape) face = Part.Face(wire) # make the cut cut = face.extrude(Vector(0, 0, length)) # make the volume shape_int = Part.makeCone(diam_lo_ext / 2, diam_hi_ext / 2, length) lower = Part.makeCone(diam_lo_ext / 2, diam_hi_ext / 2, 30) upper = Part.makeCylinder(diam_hi_ext / 2, 30) upper.translate(Vector(0, 0, 30)) shape_ext = upper.fuse(lower) shape = shape_ext.cut(shape_int) # multiply it by 3 shape0 = shape.copy() shape0.rotate(Vector(0, 0, 0), Vector(0, 0, 1), 0) shape1 = shape.copy() shape1.rotate(Vector(0, 0, 0), Vector(0, 0, 1), 120) shape2 = shape.copy() shape2.rotate(Vector(0, 0, 0), Vector(0, 0, 1), 240) # make a ring ring_ext = Part.makeCylinder(diam_lo_ext / 2 + 5, 10) ring_int = Part.makeCylinder(54 / 2 + 2, 10) ring = ring_ext.cut(ring_int) # join the ring and the shapes hold = ring hold = hold.fuse(shape0) hold = hold.fuse(shape1) hold = hold.fuse(shape2) # suppress cut0 = cut.copy() cut0.rotate(Vector(0, 0, 0), Vector(0, 0, 1), 0) cut1 = cut.copy() cut1.rotate(Vector(0, 0, 0), Vector(0, 0, 1), 120) cut2 = cut.copy() cut2.rotate(Vector(0, 0, 0), Vector(0, 0, 1), 240) cut = ring.fuse(cut0) cut = cut.fuse(cut1) cut = cut.fuse(cut2) # suppress the profiles shapes hold = hold.common(cut) prof_cut0 = profil.comp.Shape.copy() prof_cut0.rotate(Vector(0, 0, 0), Vector(0, 0, 1), 0) prof_cut1 = profil.comp.Shape.copy() prof_cut1.rotate(Vector(0, 0, 0), Vector(0, 0, 1), 120) prof_cut2 = profil.comp.Shape.copy() prof_cut2.rotate(Vector(0, 0, 0), Vector(0, 0, 1), 240) hold = hold.cut(prof_cut0) hold = hold.cut(prof_cut1) hold = hold.cut(prof_cut2) MecaComponent.__init__(self, doc, hold, name, (0., 0., 0.))
def __init__(self, doc, profil, index=None, name='cone'): self.data = { 'diameter': 123., # mm internal 'thick': 2., # mm 'len_lo': 150, # mm 'len_hi': 100, # mm 'struct_thick': 20., # mm } if index == None: return cone_top, cone_side0, cone_side1, cone_side2, cone_struct, \ cone_top_thread, cone_struct_thread = \ cone_setup(doc, profil, self.data) # the top part if index == 3: MecaComponent.__init__(self, doc, cone_top, 'cone_top', (0., 0., 0.)) return # one of the 3 sides if index == 0: MecaComponent.__init__(self, doc, cone_side0, 'cone_side0', (0., 0., 0.)) return elif index == 1: MecaComponent.__init__(self, doc, cone_side1, 'cone_side1', (0., 0., 0.)) return elif index == 2: MecaComponent.__init__(self, doc, cone_side2, 'cone_side2', (0., 0., 0.)) return # the structure elif index == 4: MecaComponent.__init__(self, doc, cone_struct, 'cone_struct', (1., 1., 0.)) return # the top part thread elif index == 5: MecaComponent.__init__(self, doc, cone_top_thread, 'cone_top_thread', (0., 0., 0.)) return # the structure thread elif index == 6: MecaComponent.__init__(self, doc, cone_struct_thread, 'cone_struct_thread', (1., 1., 0.)) return
def __init__(self, doc, profil, name='bague propulsor'): self.data = { 'thick': 10., # mm 'side': profil['side'] - 2 * profil['thick'], # mm 'len': 60.5, # mm 'ring radius': 39., # mm 'hole radius': 29., # mm 'offset z': 120., # mm 'support z': 230., # mm } base = self.data['ring radius'] - self.data['side'] side = self.data['side'] thick = self.data['thick'] length = self.data['len'] # make bague shape shape = [] # first branch shape.append(Vector(base, -side / 2, 0)) shape.append(Vector(length, -side / 2, 0)) shape.append(Vector(length, side / 2, 0)) shape.append(Vector(base, side / 2, 0)) wire0 = Part.makePolygon(shape) # 2nd and 3rd branches wire1 = wire0.copy() wire1.rotate(Vector(0, 0, 0), Vector(0, 0, 1), 120) wire2 = wire0.copy() wire2.rotate(Vector(0, 0, 0), Vector(0, 0, 1), 240) # union of all branches wire = wire0.fuse(wire1) wire = wire.fuse(wire2) vertexes = [] for edg in wire.Edges: vertexes += edg.Vertexes points = [] for vrt in vertexes: points.append(vrt.Point) points.append(points[0]) # close the wire wire = Part.makePolygon(points) face = Part.Face(wire) # make the volume branches = face.extrude(Vector(0, 0, thick)) # make the ring bague = Part.makeCylinder(self.data['ring radius'], thick) hole = Part.makeCylinder(self.data['hole radius'], thick) bague = bague.fuse(branches) bague = bague.cut(hole) # winglet support support_z = self.data['support z'] support0 = Part.makeBox(side / 2, side, support_z) support0.translate(Vector(length - side / 2, -side / 2, -support_z / 2)) support1 = support0.copy() support1.rotate(Vector(0, 0, 0), Vector(0, 0, 1), 120) support2 = support0.copy() support2.rotate(Vector(0, 0, 0), Vector(0, 0, 1), 240) bague = bague.fuse(support0) bague = bague.fuse(support1) bague = bague.fuse(support2) MecaComponent.__init__(self, doc, bague, name, (0.95, 1., 1.))
def __init__(self, doc, length, profil, ecope, name='parachue_skin'): self.data = { 'diameter': 123., # mm internal 'thick': 2., # mm 'len': length, # mm } side = profil['side'] radius = profil['radius'] thick = self.data['thick'] diam_int = self.data['diameter'] diam_ext = self.data['diameter'] + thick z_ecope = ecope['z'] # use profile shape to make suppressed parts of the skin shape = [] shape.append(Vector(radius - 20, side / 2, 0)) shape.append(Vector(radius + diam_ext, side / 2, 0)) shape.append(Vector(radius + diam_ext, -side / 2, 0)) shape.append(Vector(radius - 20, -side / 2, 0)) shape.append(Vector(radius - 20, side / 2, 0)) wire0 = Part.makePolygon(shape) # 1st part face0 = Part.Face(wire0) # 2nd part face1 = Part.Face(wire0) # make the volumes cut0 = face0.extrude(Vector(0, 0, length)) cut0.rotate(Vector(0, 0, 0), Vector(0, 0, 1), 0) cut1 = face1.extrude(Vector(0, 0, length)) cut1.rotate(Vector(0, 0, 0), Vector(0, 0, 1), 120) # make the skin skin_ext = Part.makeCylinder(diam_ext / 2, length, Vector(0, 0, 0), Vector(0, 0, 1), 120) skin_int = Part.makeCylinder(diam_int / 2, length, Vector(0, 0, 0), Vector(0, 0, 1), 120) skin = skin_ext.cut(skin_int) # create bottom and separation planes plane_ext = Part.makeCylinder(diam_int / 2, thick, Vector(0, 0, 0), Vector(0, 0, 1), 120) plane_int = Part.makeCylinder(diam_int / 2 - 30, thick, Vector(0, 0, 0), Vector(0, 0, 1), 120) plane = plane_ext.cut(plane_int) bottom = plane.copy() sepa = plane.copy() sepa.translate(Vector(0, 0, length - z_ecope - thick)) skin = skin.fuse(bottom) skin = skin.fuse(sepa) # add nerves on both sides of the skin # 1st part shape = [] shape.append(Vector(radius, side / 2, 0)) shape.append(Vector(diam_int / 2, side / 2, 0)) shape.append(Vector(diam_int / 2, side / 2 + thick, 0)) shape.append(Vector(radius, side / 2 + thick, 0)) shape.append(Vector(radius, side / 2, 0)) wire = Part.makePolygon(shape) face = Part.Face(wire) # make the volume nerv0 = face.extrude(Vector(0, 0, length)) nerv0.rotate(Vector(0, 0, 0), Vector(0, 0, 1), 0) # 2nd part shape = [] shape.append(Vector(radius, -side / 2, 0)) shape.append(Vector(diam_int / 2, -side / 2, 0)) shape.append(Vector(diam_int / 2, -side / 2 - thick, 0)) shape.append(Vector(radius, -side / 2 - thick, 0)) shape.append(Vector(radius, -side / 2, 0)) wire = Part.makePolygon(shape) face = Part.Face(wire) # make the volume nerv1 = face.extrude(Vector(0, 0, length)) nerv1.rotate(Vector(0, 0, 0), Vector(0, 0, 1), 120) skin = skin.fuse(nerv0) skin = skin.fuse(nerv1) # suppress the profiles shape skin = skin.cut(cut0) skin = skin.cut(cut1) # suppress the ecope shape ecope = ecope.comp.Shape.copy() ecope.translate(Vector(0, 0, length - z_ecope)) skin = skin.cut(ecope) MecaComponent.__init__(self, doc, skin, name, (0., 0., 0.))