|
| 1 | +#!/usr/bin/env python |
| 2 | + |
| 3 | +### |
| 4 | +### This file is based on the automatically generated one by SALOME v9.12.0 with dump python functionality |
| 5 | +### |
| 6 | + |
| 7 | +import sys |
| 8 | +import salome |
| 9 | + |
| 10 | +salome.salome_init() |
| 11 | +import salome_notebook |
| 12 | +notebook = salome_notebook.NoteBook() |
| 13 | + |
| 14 | +### |
| 15 | +### SHAPER component |
| 16 | +### |
| 17 | + |
| 18 | +from salome.shaper import model |
| 19 | + |
| 20 | +model.begin() |
| 21 | +partSet = model.moduleDocument() |
| 22 | + |
| 23 | +### Create Part |
| 24 | +Part_1 = model.addPart(partSet) |
| 25 | +Part_1_doc = Part_1.document() |
| 26 | + |
| 27 | +### Create Box |
| 28 | +Box_1 = model.addBox(Part_1_doc, 10, 10, 10) |
| 29 | + |
| 30 | +### Create Sketch |
| 31 | +Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Top")) |
| 32 | + |
| 33 | +### Create SketchPoint |
| 34 | +SketchPoint_1 = Sketch_1.addPoint(0, 5) |
| 35 | +SketchPoint_1.setAuxiliary(True) |
| 36 | + |
| 37 | +### Create SketchProjection |
| 38 | +SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), False) |
| 39 | +SketchLine_1 = SketchProjection_1.createdFeature() |
| 40 | +Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_1.result()) |
| 41 | + |
| 42 | +### Create SketchPoint |
| 43 | +SketchPoint_2 = Sketch_1.addPoint(10, 5) |
| 44 | + |
| 45 | +### Create SketchProjection |
| 46 | +SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), False) |
| 47 | +SketchLine_2 = SketchProjection_2.createdFeature() |
| 48 | +Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_2.result()) |
| 49 | +Sketch_1.setMiddlePoint(SketchPoint_1.coordinates(), SketchLine_1.result()) |
| 50 | +Sketch_1.setMiddlePoint(SketchPoint_2.coordinates(), SketchLine_2.result()) |
| 51 | + |
| 52 | +### Create SketchLine |
| 53 | +SketchLine_3 = Sketch_1.addLine(0, 5, 10, 5) |
| 54 | +SketchLine_3.setAuxiliary(True) |
| 55 | +Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_3.startPoint()) |
| 56 | +Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_3.endPoint()) |
| 57 | + |
| 58 | +### Create SketchLine |
| 59 | +SketchLine_4 = Sketch_1.addLine(4, 10, 5, 5) |
| 60 | + |
| 61 | +### Create SketchProjection |
| 62 | +SketchProjection_3 = Sketch_1.addProjection(model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"), False) |
| 63 | +SketchLine_5 = SketchProjection_3.createdFeature() |
| 64 | +Sketch_1.setCoincident(SketchLine_4.startPoint(), SketchLine_5.result()) |
| 65 | +Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_3.result()) |
| 66 | + |
| 67 | +### Create SketchLine |
| 68 | +SketchLine_6 = Sketch_1.addLine(5, 5, 6, 10) |
| 69 | +Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_6.startPoint()) |
| 70 | +Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_5.result()) |
| 71 | + |
| 72 | +### Create SketchLine |
| 73 | +SketchLine_7 = Sketch_1.addLine(4, 10, 6, 10) |
| 74 | +Sketch_1.setCoincident(SketchLine_4.startPoint(), SketchLine_7.startPoint()) |
| 75 | +Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.endPoint()) |
| 76 | +Sketch_1.setDistance(SketchLine_7.endPoint(), SketchLine_2.result(), 4, True) |
| 77 | +Sketch_1.setDistance(SketchLine_1.result(), SketchLine_4.startPoint(), 4, True) |
| 78 | +Sketch_1.setMiddlePoint(SketchLine_4.endPoint(), SketchLine_3.result()) |
| 79 | +model.do() |
| 80 | + |
| 81 | +### Create ExtrusionCut |
| 82 | +ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4f-SketchLine_6f-SketchLine_7r")], model.selection(), 0, 10, [model.selection("SOLID", "Box_1_1")]) |
| 83 | + |
| 84 | +### Create Sketch |
| 85 | +Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Front")) |
| 86 | + |
| 87 | +### Create SketchPoint |
| 88 | +SketchPoint_3 = Sketch_2.addPoint(5, 10) |
| 89 | +SketchPoint_3.setAuxiliary(True) |
| 90 | + |
| 91 | +### Create SketchProjection |
| 92 | +SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Box_1_1/Top][Box_1_1/Front]"), False) |
| 93 | +SketchLine_8 = SketchProjection_4.createdFeature() |
| 94 | +Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchLine_8.result()) |
| 95 | + |
| 96 | +### Create SketchPoint |
| 97 | +SketchPoint_4 = Sketch_2.addPoint(5, 0) |
| 98 | + |
| 99 | +### Create SketchProjection |
| 100 | +SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Box_1_1/Bottom][Box_1_1/Front]"), False) |
| 101 | +SketchLine_9 = SketchProjection_5.createdFeature() |
| 102 | +Sketch_2.setCoincident(SketchPoint_4.coordinates(), SketchLine_9.result()) |
| 103 | +Sketch_2.setMiddlePoint(SketchPoint_3.coordinates(), SketchLine_8.result()) |
| 104 | +Sketch_2.setMiddlePoint(SketchPoint_4.coordinates(), SketchLine_9.result()) |
| 105 | + |
| 106 | +### Create SketchLine |
| 107 | +SketchLine_10 = Sketch_2.addLine(5, 10, 5, 0) |
| 108 | +SketchLine_10.setAuxiliary(True) |
| 109 | +Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchLine_10.startPoint()) |
| 110 | +Sketch_2.setCoincident(SketchPoint_4.coordinates(), SketchLine_10.endPoint()) |
| 111 | + |
| 112 | +### Create SketchLine |
| 113 | +SketchLine_11 = Sketch_2.addLine(10, 6, 10, 4) |
| 114 | + |
| 115 | +### Create SketchProjection |
| 116 | +SketchProjection_6 = Sketch_2.addProjection(model.selection("EDGE", "[Box_1_1/Front][(ExtrusionCut_1_1/Modified_Face&Box_1_1/Top)(ExtrusionCut_1_1/Modified_Face&Box_1_1/Bottom)(Box_1_1/Front)(ExtrusionCut_1_1/Generated_Face&Sketch_1/SketchLine_6)]"), False) |
| 117 | +SketchLine_12 = SketchProjection_6.createdFeature() |
| 118 | +Sketch_2.setCoincident(SketchLine_11.startPoint(), SketchLine_12.result()) |
| 119 | +Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.result()) |
| 120 | + |
| 121 | +### Create SketchLine |
| 122 | +SketchLine_13 = Sketch_2.addLine(10, 4, 5, 5) |
| 123 | +Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_13.startPoint()) |
| 124 | +Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_10.result()) |
| 125 | + |
| 126 | +### Create SketchLine |
| 127 | +SketchLine_14 = Sketch_2.addLine(5, 5, 10, 6) |
| 128 | +Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint()) |
| 129 | +Sketch_2.setCoincident(SketchLine_11.startPoint(), SketchLine_14.endPoint()) |
| 130 | +Sketch_2.setDistance(SketchLine_8.result(), SketchLine_11.startPoint(), 4, True) |
| 131 | +Sketch_2.setDistance(SketchLine_9.result(), SketchLine_13.startPoint(), 4, True) |
| 132 | +Sketch_2.setMiddlePoint(SketchLine_13.endPoint(), SketchLine_10.result()) |
| 133 | +model.do() |
| 134 | + |
| 135 | +### Create ExtrusionCut |
| 136 | +ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_14r-SketchLine_13r-SketchLine_11r")], model.selection(), 0, 10, [model.selection("SOLID", "ExtrusionCut_1_1")]) |
| 137 | + |
| 138 | +model.end() |
| 139 | + |
| 140 | +### |
| 141 | +### SHAPERSTUDY component |
| 142 | +### |
| 143 | + |
| 144 | +model.publishToShaperStudy() |
| 145 | +import SHAPERSTUDY |
| 146 | +ExtrusionCut_2_1, = SHAPERSTUDY.shape(model.featureStringId(ExtrusionCut_2)) |
| 147 | + |
| 148 | +if salome.sg.hasDesktop(): |
| 149 | + salome.sg.updateObjBrowser() |
0 commit comments