|
| 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 SketchAPI import * |
| 19 | + |
| 20 | +from salome.shaper import model |
| 21 | + |
| 22 | +model.begin() |
| 23 | +partSet = model.moduleDocument() |
| 24 | + |
| 25 | +### Create Part |
| 26 | +Part_1 = model.addPart(partSet) |
| 27 | +Part_1_doc = Part_1.document() |
| 28 | + |
| 29 | +### Create Box |
| 30 | +Box_1 = model.addBox(Part_1_doc, 10, 10, 10) |
| 31 | + |
| 32 | +### Create Sketch |
| 33 | +Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Back")) |
| 34 | + |
| 35 | +### Create SketchLine |
| 36 | +SketchLine_1 = Sketch_1.addLine(10, -5, 5, -5) |
| 37 | + |
| 38 | +### Create SketchLine |
| 39 | +SketchLine_2 = Sketch_1.addLine(5, -5, 5, -10) |
| 40 | + |
| 41 | +### Create SketchLine |
| 42 | +SketchLine_3 = Sketch_1.addLine(5, -10, 10, -10) |
| 43 | + |
| 44 | +### Create SketchLine |
| 45 | +SketchLine_4 = Sketch_1.addLine(10, -10, 10, -5) |
| 46 | +Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint()) |
| 47 | +Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint()) |
| 48 | +Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint()) |
| 49 | +Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) |
| 50 | +Sketch_1.setPerpendicular(SketchLine_1.result(), SketchLine_2.result()) |
| 51 | +Sketch_1.setPerpendicular(SketchLine_2.result(), SketchLine_3.result()) |
| 52 | +Sketch_1.setPerpendicular(SketchLine_3.result(), SketchLine_4.result()) |
| 53 | + |
| 54 | +### Create SketchProjection |
| 55 | +SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Top]"), False) |
| 56 | +SketchPoint_1 = SketchProjection_1.createdFeature() |
| 57 | +Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchPoint_1.result()) |
| 58 | +Sketch_1.setHorizontal(SketchLine_1.result()) |
| 59 | + |
| 60 | +### Create SketchProjection |
| 61 | +SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Bottom]"), False) |
| 62 | +SketchLine_5 = SketchProjection_2.createdFeature() |
| 63 | +Sketch_1.setDistance(SketchLine_5.result(), SketchLine_1.endPoint(), 5, True) |
| 64 | + |
| 65 | +### Create SketchProjection |
| 66 | +SketchProjection_3 = Sketch_1.addProjection(model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]"), False) |
| 67 | +SketchLine_6 = SketchProjection_3.createdFeature() |
| 68 | +Sketch_1.setDistance(SketchLine_6.result(), SketchLine_1.endPoint(), 5, True) |
| 69 | +model.do() |
| 70 | + |
| 71 | +### Create ExtrusionCut |
| 72 | +ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 0, 10, [model.selection("SOLID", "Box_1_1")]) |
| 73 | + |
| 74 | +### Create Sketch |
| 75 | +Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Generated_Face&Sketch_1/SketchLine_2")) |
| 76 | + |
| 77 | +### Create SketchLine |
| 78 | +SketchLine_7 = Sketch_2.addLine(5, -5, 6.000000000000002, -10) |
| 79 | + |
| 80 | +### Create SketchProjection |
| 81 | +SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "[ExtrusionCut_1_1/Generated_Face&Sketch_1/SketchLine_2][ExtrusionCut_1_1/Generated_Face&Sketch_1/SketchLine_1]"), False) |
| 82 | +SketchLine_8 = SketchProjection_4.createdFeature() |
| 83 | +Sketch_2.setCoincident(SketchLine_7.startPoint(), SketchLine_8.result()) |
| 84 | + |
| 85 | +### Create SketchProjection |
| 86 | +SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Box_1_1/Top][ExtrusionCut_1_1/Generated_Face&Sketch_1/SketchLine_2]"), False) |
| 87 | +SketchLine_9 = SketchProjection_5.createdFeature() |
| 88 | +Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_9.result()) |
| 89 | + |
| 90 | +### Create SketchLine |
| 91 | +SketchLine_10 = Sketch_2.addLine(6.000000000000002, -10, 4, -10) |
| 92 | +Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_10.startPoint()) |
| 93 | +Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_9.result()) |
| 94 | + |
| 95 | +### Create SketchLine |
| 96 | +SketchLine_11 = Sketch_2.addLine(4, -10, 5, -5) |
| 97 | +Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint()) |
| 98 | +Sketch_2.setCoincident(SketchLine_7.startPoint(), SketchLine_11.endPoint()) |
| 99 | + |
| 100 | +### Create SketchProjection |
| 101 | +SketchProjection_6 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_2"), False) |
| 102 | +SketchLine_12 = SketchProjection_6.createdFeature() |
| 103 | +Sketch_2.setDistance(SketchLine_11.startPoint(), SketchLine_12.result(), 4, True) |
| 104 | + |
| 105 | +### Create SketchProjection |
| 106 | +SketchProjection_7 = Sketch_2.addProjection(model.selection("EDGE", "[ExtrusionCut_1_1/Generated_Face&Sketch_1/SketchLine_2][ExtrusionCut_1_1/Modified_Face&Box_1_1/Front]"), False) |
| 107 | +SketchLine_13 = SketchProjection_7.createdFeature() |
| 108 | +Sketch_2.setDistance(SketchLine_13.result(), SketchLine_7.endPoint(), 4, True) |
| 109 | +Sketch_2.setMiddlePoint(SketchLine_11.endPoint(), SketchLine_8.result()) |
| 110 | +model.do() |
| 111 | + |
| 112 | +### Create ExtrusionCut |
| 113 | +ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_11r-SketchLine_10r-SketchLine_7r")], model.selection(), 0, 5, [model.selection("SOLID", "ExtrusionCut_1_1")]) |
| 114 | + |
| 115 | +### Create Sketch |
| 116 | +Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Box_1_1/Front")) |
| 117 | + |
| 118 | +### Create SketchLine |
| 119 | +SketchLine_14 = Sketch_3.addLine(5, 5, 10, 5) |
| 120 | + |
| 121 | +### Create SketchProjection |
| 122 | +SketchProjection_8 = Sketch_3.addProjection(model.selection("VERTEX", "[ExtrusionCut_2_1/Modified_Face&Sketch_1/SketchLine_1][(ExtrusionCut_2_1/Modified_Face&Sketch_1/SketchLine_1)(ExtrusionCut_1_1/Modified_Face&Box_1_1/Front)(ExtrusionCut_2_1/Generated_Face&Sketch_2/SketchLine_7)][ExtrusionCut_1_1/Modified_Face&Box_1_1/Front]"), False) |
| 123 | +SketchPoint_2 = SketchProjection_8.createdFeature() |
| 124 | +Sketch_3.setCoincident(SketchLine_14.startPoint(), SketchPoint_2.result()) |
| 125 | + |
| 126 | +### Create SketchProjection |
| 127 | +SketchProjection_9 = Sketch_3.addProjection(model.selection("VERTEX", "[ExtrusionCut_2_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_1_1/Modified_Face&Box_1_1/Right][ExtrusionCut_1_1/Modified_Face&Box_1_1/Front]"), False) |
| 128 | +SketchPoint_3 = SketchProjection_9.createdFeature() |
| 129 | +Sketch_3.setCoincident(SketchLine_14.endPoint(), SketchPoint_3.result()) |
| 130 | + |
| 131 | +### Create SketchLine |
| 132 | +SketchLine_15 = Sketch_3.addLine(10, 5, 10, 0) |
| 133 | +Sketch_3.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint()) |
| 134 | + |
| 135 | +### Create SketchProjection |
| 136 | +SketchProjection_10 = Sketch_3.addProjection(model.selection("VERTEX", "[ExtrusionCut_1_1/Modified_Face&Box_1_1/Right][Box_1_1/Bottom][ExtrusionCut_1_1/Modified_Face&Box_1_1/Front]"), False) |
| 137 | +SketchPoint_4 = SketchProjection_10.createdFeature() |
| 138 | +Sketch_3.setCoincident(SketchLine_15.endPoint(), SketchPoint_4.result()) |
| 139 | + |
| 140 | +### Create SketchLine |
| 141 | +SketchLine_16 = Sketch_3.addLine(10, 0, 0, 0) |
| 142 | +Sketch_3.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint()) |
| 143 | + |
| 144 | +### Create SketchProjection |
| 145 | +SketchProjection_11 = Sketch_3.addProjection(model.selection("VERTEX", "[Box_1_1/Bottom][ExtrusionCut_2_1/Modified_Face&Box_1_1/Left][ExtrusionCut_1_1/Modified_Face&Box_1_1/Front]"), False) |
| 146 | +SketchPoint_5 = SketchProjection_11.createdFeature() |
| 147 | +Sketch_3.setCoincident(SketchLine_16.endPoint(), SketchPoint_5.result()) |
| 148 | + |
| 149 | +### Create SketchLine |
| 150 | +SketchLine_17 = Sketch_3.addLine(0, 0, 0, 4) |
| 151 | +Sketch_3.setCoincident(SketchLine_16.endPoint(), SketchLine_17.startPoint()) |
| 152 | + |
| 153 | +### Create SketchProjection |
| 154 | +SketchProjection_12 = Sketch_3.addProjection(model.selection("EDGE", "[ExtrusionCut_2_1/Modified_Face&Box_1_1/Left][ExtrusionCut_1_1/Modified_Face&Box_1_1/Front]"), False) |
| 155 | +SketchLine_18 = SketchProjection_12.createdFeature() |
| 156 | +Sketch_3.setCoincident(SketchLine_17.endPoint(), SketchLine_18.result()) |
| 157 | + |
| 158 | +### Create SketchLine |
| 159 | +SketchLine_19 = Sketch_3.addLine(0, 4, 5, 5) |
| 160 | +Sketch_3.setCoincident(SketchLine_17.endPoint(), SketchLine_19.startPoint()) |
| 161 | +Sketch_3.setCoincident(SketchLine_14.startPoint(), SketchLine_19.endPoint()) |
| 162 | +Sketch_3.setDistance(SketchLine_17.endPoint(), SketchAPI_Point(SketchPoint_5).coordinates(), 4, True) |
| 163 | +model.do() |
| 164 | + |
| 165 | +### Create ExtrusionCut |
| 166 | +ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_19r-SketchLine_17r-SketchLine_16r-SketchLine_15r-SketchLine_14r")], model.selection(), 0, 5, [model.selection("SOLID", "ExtrusionCut_2_1")]) |
| 167 | + |
| 168 | +model.end() |
| 169 | + |
| 170 | +### |
| 171 | +### SHAPERSTUDY component |
| 172 | +### |
| 173 | + |
| 174 | +model.publishToShaperStudy() |
| 175 | +import SHAPERSTUDY |
| 176 | +ExtrusionCut_3_1, = SHAPERSTUDY.shape(model.featureStringId(ExtrusionCut_3)) |
| 177 | + |
| 178 | +if salome.sg.hasDesktop(): |
| 179 | + salome.sg.updateObjBrowser() |
0 commit comments