SketchConstraintCoincidence_1 = Sketch_1.setCoincident( SketchLine_4.endPoint(), SketchLine_1.startPoint()) SketchConstraintCoincidence_2 = Sketch_1.setCoincident( SketchLine_1.endPoint(), SketchLine_2.startPoint()) SketchConstraintCoincidence_3 = Sketch_1.setCoincident( SketchLine_2.endPoint(), SketchLine_3.startPoint()) SketchConstraintCoincidence_4 = Sketch_1.setCoincident( SketchLine_3.endPoint(), SketchLine_4.startPoint()) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), A) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), B) SketchProjection_1 = Sketch_1.addProjection( model.selection("VERTEX", "Origin"), False) SketchPoint_1 = SketchProjection_1.createdFeature() SketchConstraintCoincidence_5 = Sketch_1.setCoincident( SketchLine_2.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates()) model.do() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Face_1 = model.addFace(Part_1_doc, [ model.selection( "FACE", "PartSet/Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f" ) ]) Extrusion_1 = model.addExtrusion(Part_1_doc, [
SketchLine_1.endPoint(), SketchLine_2.endPoint(), C) SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance( SketchLine_3.endPoint(), SketchLine_4.endPoint(), E) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_12.result(), A) #Cette partie fixe l'objet à l'origine #SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "Origin"), False) #SketchPoint_1 = SketchProjection_1.createdFeature() #SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchAPI_Point(SketchPoint_1).coordinates()) model.do() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Face_1 = model.addFace(Part_1_doc, [ model.selection( "FACE", "PartSet/Sketch_1/Face-SketchLine_12r-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r" ) ]) Extrusion_1 = model.addExtrusion(Part_1_doc, [ model.selection( "FACE", "PartSet/Sketch_1/Face-SketchLine_12r-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r" ) ], model.selection(), F, 0) Fillet_1 = model.addFillet(Part_1_doc, [ model.selection( "EDGE", "[Extrusion_1_1/Generated_Face&PartSet/Sketch_1/SketchLine_7][Extrusion_1_1/To_Face]" ) ], R1) Fillet_2 = model.addFillet(Part_1_doc, [
### ### SHAPER component ### from salome.shaper import model model.begin() partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Point_2 = model.addPoint(Part_1_doc, 0, 0, 0) Point_3 = model.addPoint(Part_1_doc, 1, 1, 0) Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) SketchLine_1 = Sketch_1.addLine(1, 0, 0, 0) SketchProjection_1 = Sketch_1.addProjection( model.selection("VERTEX", "Point_1"), False) SketchPoint_1 = SketchProjection_1.createdFeature() SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchPoint_1.result()) SketchLine_2 = Sketch_1.addLine(0, 0, 0, 1) SketchLine_3 = Sketch_1.addLine(0, 1, 1, 1) SketchLine_4 = Sketch_1.addLine(1, 1, 1, 0) SketchConstraintCoincidence_2 = Sketch_1.setCoincident( SketchLine_4.endPoint(), SketchLine_1.startPoint()) SketchConstraintCoincidence_3 = Sketch_1.setCoincident( SketchLine_1.endPoint(), SketchLine_2.startPoint()) SketchConstraintCoincidence_4 = Sketch_1.setCoincident( SketchLine_2.endPoint(), SketchLine_3.startPoint()) SketchConstraintCoincidence_5 = Sketch_1.setCoincident( SketchLine_3.endPoint(), SketchLine_4.startPoint()) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(A, B, 0, B) SketchLine_2 = Sketch_1.addLine(0, B, 0, 0) SketchLine_3 = Sketch_1.addLine(0, 0, A, 0) SketchLine_4 = Sketch_1.addLine(A, 0, A, B) SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_2.startPoint(), SketchLine_1.startPoint(), A) SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_4.endPoint(), SketchLine_3.endPoint(), B) SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "Origin"), False) SketchPoint_1 = SketchProjection_1.createdFeature() SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates()) model.do() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "PartSet/Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")]) Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "PartSet/Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), C, 0) Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Extrusion_1_1/Generated_Face&PartSet/Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]")], R) Fillet_2 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Fillet_1_1/MF:Fillet&PartSet/Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]")], R) Fillet_3 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Fillet_1_1/MF:Fillet&Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&PartSet/Sketch_1/SketchLine_2]")], R) Fillet_4 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Fillet_3_1/MF:Fillet&PartSet/Sketch_1/SketchLine_2][Fillet_2_1/MF:Fillet&Extrusion_1_1/From_Face]")], R) #Exportez le fichier ".XAO" dans le dossier ./temp
Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOZ")) SketchLine_1 = Sketch_1.addLine(A, B, 0, B) SketchLine_2 = Sketch_1.addLine(0, B, 0, 0) SketchLine_3 = Sketch_1.addLine(0, 0, A, 0) SketchLine_4 = Sketch_1.addLine(A, 0, A, B) SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result()) SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result()) SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), A) SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), B) SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "Origin"), False) SketchPoint_1 = SketchProjection_1.createdFeature() SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchAPI_Point(SketchPoint_1).coordinates()) model.do() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "PartSet/Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")]) Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "PartSet/Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), C, 0) Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&PartSet/Sketch_1/SketchLine_1")) SketchCircle_1 = Sketch_2.addCircle(A/2, -B/2, D1/2) SketchCircle_2 = Sketch_2.addCircle(A/2, -B/2, D2/2) SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchCircle_1.center(), SketchCircle_2.center()) SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&PartSet/Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&PartSet/Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]"), False) SketchPoint_2 = SketchProjection_2.createdFeature() SketchConstraintDistanceVertical_1 = Sketch_2.setVerticalDistance(SketchCircle_1.center(), SketchAPI_Point(SketchPoint_2).coordinates(), C/2)
SketchConstraintCoincidence_47.setName("SketchConstraintCoincidence_56") SketchConstraintHorizontal_13 = Sketch_1.setHorizontal(SketchLine_31.result()) SketchConstraintHorizontal_13.setName("SketchConstraintHorizontal_15") SketchLine_32 = Sketch_1.addLine(0.7, 0.1, 2.5, 0.1) SketchLine_32.setName("SketchLine_37") SketchLine_32.result().setName("SketchLine_37") SketchConstraintCoincidence_48 = Sketch_1.setCoincident(SketchLine_18.endPoint(), SketchLine_32.startPoint()) SketchConstraintCoincidence_48.setName("SketchConstraintCoincidence_54") SketchConstraintCoincidence_49 = Sketch_1.setCoincident(SketchLine_32.endPoint(), SketchLine_12.result()) SketchConstraintCoincidence_49.setName("SketchConstraintCoincidence_57") SketchConstraintHorizontal_14 = Sketch_1.setHorizontal(SketchLine_32.result()) SketchConstraintHorizontal_14.setName("SketchConstraintHorizontal_16") model.do() Sketch_1.setName("Sketch_outer_boundary") Sketch_1.result().setName("Sketch_1") Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_28r-SketchLine_24r-SketchLine_27f-SketchLine_2r")]) Face_1.setName("face_precyl_center") Face_1.result().setName("face_precyl_center") Face_2 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_35r-SketchLine_28f-SketchLine_2r-SketchLine_1r")]) Face_2.setName("face_precyl_below") Face_2.result().setName("face_precyl_below") Face_3 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_27r-SketchLine_30f-SketchLine_3r-SketchLine_2r")]) Face_3.setName("face_precyl_above") Face_3.result().setName("face_precyl_above") Face_4 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_12r-SketchLine_26f-SketchLine_31r-SketchCircle_1_2r")]) Face_4.setName("face_around_circle_ne") Face_4.result().setName("face_around_circle_ne") Face_5 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_29r-SketchLine_17f-SketchLine_4r-SketchLine_3r")]) Face_5.setName("face_postcyl_above") Face_5.result().setName("face_postcyl_above") Face_6 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_30r-SketchLine_23r-SketchLine_29f-SketchLine_3r")])
SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_5.result()) SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_5.result(), SketchLine_7.result()) SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance( SketchLine_1.endPoint(), SketchLine_3.startPoint(), C) SketchConstraintEqual_4 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_10.result()) SketchConstraintEqual_5 = Sketch_1.setEqual(SketchLine_4.result(), SketchLine_8.result()) SketchConstraintDistanceVertical_2 = Sketch_1.setVerticalDistance( SketchLine_3.startPoint(), SketchLine_3.endPoint(), D) SketchConstraintDistanceHorizontal_3 = Sketch_1.setHorizontalDistance( SketchLine_5.endPoint(), SketchLine_6.endPoint(), A - 2 * C - 2 * E) SketchProjection_1 = Sketch_1.addProjection( model.selection("VERTEX", "Origin"), False) SketchPoint_1 = SketchProjection_1.createdFeature() SketchConstraintCoincidence_13 = Sketch_1.setCoincident( SketchLine_1.startPoint(), SketchAPI_Point(SketchPoint_1).coordinates()) model.do() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Face_1 = model.addFace(Part_1_doc, [ model.selection( "FACE", "PartSet/Sketch_1/Face-SketchLine_12r-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r" ) ]) Extrusion_1 = model.addExtrusion(Part_1_doc, [ model.selection(