1 ## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
3 ## This library is free software; you can redistribute it and/or
4 ## modify it under the terms of the GNU Lesser General Public
5 ## License as published by the Free Software Foundation; either
6 ## version 2.1 of the License, or (at your option) any later version.
8 ## This library is distributed in the hope that it will be useful,
9 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
10 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 ## Lesser General Public License for more details.
13 ## You should have received a copy of the GNU Lesser General Public
14 ## License along with this library; if not, write to the Free Software
15 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 ## See http:##www.salome-platform.org/ or
18 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 from ModelAPI import *
22 from salome.shaper import model
25 partSet = model.moduleDocument()
26 Part_1 = model.addPart(partSet)
27 Part_1_doc = Part_1.document()
28 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
29 SketchLine_1 = Sketch_1.addLine(-717.0963364993213, -45.06817090071282, -254.8675173043772, -45.06817090071281)
30 SketchLine_1.setAuxiliary(True)
31 SketchLine_2 = Sketch_1.addLine(-254.8675173043772, -45.06817090071281, -254.8675173043772, 193.0685819822336)
32 SketchLine_2.setAuxiliary(True)
33 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
34 SketchLine_3 = Sketch_1.addLine(-254.8675173043772, 193.0685819822336, -102.0809741405142, 193.0685819822336)
35 SketchLine_3.setAuxiliary(True)
36 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
37 SketchLine_4 = Sketch_1.addLine(-102.0809741405142, 193.0685819822336, -102.0809741405142, -180.9380775505473)
38 SketchLine_4.setAuxiliary(True)
39 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
40 SketchLine_5 = Sketch_1.addLine(-102.0809741405142, -180.9380775505473, -717.0963364993213, -180.9380775505473)
41 SketchLine_5.setAuxiliary(True)
42 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
43 SketchLine_6 = Sketch_1.addLine(-717.0963364993213, -180.9380775505473, -717.0963364993213, -45.06817090071282)
44 SketchLine_6.setAuxiliary(True)
45 SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
46 SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_6.endPoint())
47 SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result())
48 SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_1.result())
49 SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_5.result())
50 SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result())
51 SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_2.result())
52 SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_6.result())
53 SketchPoint_1 = Sketch_1.addPoint(-684.5318860244231, -45.06817090071282)
54 SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_1.result())
55 SketchPoint_2 = Sketch_1.addPoint(-599.0502035278153, -45.06817090071282)
56 SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_1.result())
57 SketchPoint_3 = Sketch_1.addPoint(-509.4979647218452, -45.06817090071282)
58 SketchPoint_3.setName("SketchPoint_4")
59 SketchPoint_3.result().setName("SketchPoint_4")
60 SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_1.result())
61 SketchPoint_4 = Sketch_1.addPoint(-429.4436906377204, -45.06817090071282)
62 SketchPoint_4.setName("SketchPoint_5")
63 SketchPoint_4.result().setName("SketchPoint_5")
64 SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_1.result())
65 SketchPoint_5 = Sketch_1.addPoint(-356.1736770691994, -45.06817090071282)
66 SketchPoint_5.setName("SketchPoint_6")
67 SketchPoint_5.result().setName("SketchPoint_6")
68 SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchPoint_5.coordinates(), SketchLine_1.result())
69 SketchPoint_6 = Sketch_1.addPoint(-254.8675173043772, 25.10176390773411)
70 SketchPoint_6.setName("SketchPoint_7")
71 SketchPoint_6.result().setName("SketchPoint_7")
72 SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchLine_2.result())
73 SketchPoint_7 = Sketch_1.addPoint(-254.8675173043772, 103.7991858887381)
74 SketchPoint_7.setName("SketchPoint_8")
75 SketchPoint_7.result().setName("SketchPoint_8")
76 SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchPoint_7.coordinates(), SketchLine_2.result())
77 SketchPoint_8 = Sketch_1.addPoint(-196.0651289009498, 193.0685819822336)
78 SketchPoint_8.setName("SketchPoint_9")
79 SketchPoint_8.result().setName("SketchPoint_9")
80 SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchPoint_8.coordinates(), SketchLine_3.result())
81 SketchPoint_9 = Sketch_1.addPoint(-102.0809741405142, 116.0108548168249)
82 SketchPoint_9.setName("SketchPoint_10")
83 SketchPoint_9.result().setName("SketchPoint_10")
84 SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchPoint_9.coordinates(), SketchLine_4.result())
85 SketchPoint_10 = Sketch_1.addPoint(-102.0809741405142, -118.7245590230665)
86 SketchPoint_10.setName("SketchPoint_11")
87 SketchPoint_10.result().setName("SketchPoint_11")
88 SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchPoint_10.coordinates(), SketchLine_4.result())
89 SketchPoint_11 = Sketch_1.addPoint(-342.6051560379917, -180.9380775505472)
90 SketchPoint_11.setName("SketchPoint_13")
91 SketchPoint_11.result().setName("SketchPoint_13")
92 SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchPoint_11.coordinates(), SketchLine_5.result())
93 SketchPoint_12 = Sketch_1.addPoint(-584.124830393487, -180.9380775505472)
94 SketchPoint_12.setName("SketchPoint_14")
95 SketchPoint_12.result().setName("SketchPoint_14")
96 SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchPoint_12.coordinates(), SketchLine_5.result())
98 Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_6s-SketchLine_5e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_7"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_5s-SketchLine_4e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_11"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_3s-SketchLine_2e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_10"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_8"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_9"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_2s-SketchLine_1e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_4s-SketchLine_3e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_13"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1s-SketchLine_6e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_14"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_2"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_6"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_4"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_5")])
99 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1"), model.selection("VERTEX", "Vertex_1_2"), model.selection("VERTEX", "Vertex_1_3"), model.selection("VERTEX", "Vertex_1_4"), model.selection("VERTEX", "Vertex_1_5"), model.selection("VERTEX", "Vertex_1_6"), model.selection("VERTEX", "Vertex_1_7"), model.selection("VERTEX", "Vertex_1_8"), model.selection("VERTEX", "Vertex_1_9"), model.selection("VERTEX", "Vertex_1_10"), model.selection("VERTEX", "Vertex_1_11"), model.selection("VERTEX", "Vertex_1_12"), model.selection("VERTEX", "Vertex_1_13"), model.selection("VERTEX", "Vertex_1_14"), model.selection("VERTEX", "Vertex_1_15"), model.selection("VERTEX", "Vertex_1_16"), model.selection("VERTEX", "Vertex_1_17"), model.selection("VERTEX", "Vertex_1_18")], model.selection("EDGE", "PartSet/OZ"), 100, 0)
100 Plane_4 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Extrusion_1_12/To_Vertex_1"), model.selection("VERTEX", "Extrusion_1_13/To_Vertex_1"), model.selection("VERTEX", "Extrusion_1_3/To_Vertex_1"))
101 Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
102 SketchLine_7 = Sketch_2.addLine(-717.0963364993213, -45.06817090071282, -717.0963364993213, -180.9380775505473)
103 SketchPoint_13 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_12/To_Vertex_1"))
104 SketchPoint_13.setName("SketchPoint_15")
105 SketchPoint_13.result().setName("SketchPoint_15")
106 SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_7.startPoint(), SketchPoint_13.result())
107 SketchPoint_14 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_1/To_Vertex_1"))
108 SketchPoint_14.setName("SketchPoint_16")
109 SketchPoint_14.result().setName("SketchPoint_16")
110 SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchPoint_14.result())
111 SketchLine_8 = Sketch_2.addLine(-717.0963364993213, -180.9380775505473, -102.0809741405142, -180.9380775505473)
112 SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
113 SketchPoint_15 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_3/To_Vertex_1"))
114 SketchPoint_15.setName("SketchPoint_17")
115 SketchPoint_15.result().setName("SketchPoint_17")
116 SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchPoint_15.result())
117 SketchLine_9 = Sketch_2.addLine(-102.0809741405142, -180.9380775505473, -102.0809741405142, 193.0685819822336)
118 SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
119 SketchPoint_16 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_10/To_Vertex_1"))
120 SketchPoint_16.setName("SketchPoint_18")
121 SketchPoint_16.result().setName("SketchPoint_18")
122 SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchPoint_16.result())
123 SketchLine_10 = Sketch_2.addLine(-102.0809741405142, 193.0685819822336, -254.8675173043772, 193.0685819822336)
124 SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint())
125 SketchPoint_17 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_5/To_Vertex_1"))
126 SketchPoint_17.setName("SketchPoint_19")
127 SketchPoint_17.result().setName("SketchPoint_19")
128 SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchPoint_17.result())
129 SketchLine_11 = Sketch_2.addLine(-254.8675173043772, 193.0685819822336, -254.8675173043772, -45.06817090071281)
130 SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint())
131 SketchPoint_18 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_9/To_Vertex_1"))
132 SketchPoint_18.setName("SketchPoint_20")
133 SketchPoint_18.result().setName("SketchPoint_20")
134 SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchPoint_18.result())
135 SketchLine_12 = Sketch_2.addLine(-254.8675173043772, -45.06817090071281, -717.0963364993213, -45.06817090071282)
136 SketchConstraintCoincidence_29 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint())
137 SketchConstraintCoincidence_30 = Sketch_2.setCoincident(SketchLine_7.startPoint(), SketchLine_12.endPoint())
138 SketchConstraintCoincidence_31 = Sketch_2.setCoincident(SketchPoint_13.coordinates(), SketchLine_12.endPoint())
139 SketchLine_13 = Sketch_2.addLine(-599.2405881202537, -45.06817090071282, -584.124830393487, -180.9380775505472)
140 SketchConstraintCoincidence_32 = Sketch_2.setCoincident(SketchLine_13.startPoint(), SketchLine_12.result())
141 SketchPoint_19 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_13/To_Vertex_1"))
142 SketchPoint_19.setName("SketchPoint_21")
143 SketchPoint_19.result().setName("SketchPoint_21")
144 SketchConstraintCoincidence_33 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchPoint_19.result())
145 SketchLine_14 = Sketch_2.addLine(-356.1736770691994, -45.06817090071282, -342.6051560379917, -180.9380775505472)
146 SketchPoint_20 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_15/To_Vertex_1"))
147 SketchPoint_20.setName("SketchPoint_22")
148 SketchPoint_20.result().setName("SketchPoint_22")
149 SketchConstraintCoincidence_34 = Sketch_2.setCoincident(SketchLine_14.startPoint(), SketchPoint_20.result())
150 SketchPoint_21 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_11/To_Vertex_1"))
151 SketchPoint_21.setName("SketchPoint_23")
152 SketchPoint_21.result().setName("SketchPoint_23")
153 SketchConstraintCoincidence_35 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchPoint_21.result())
154 SketchLine_15 = Sketch_2.addLine(-254.8675173043772, -45.06817090071281, -102.0809741405142, -49.89915168208545)
155 SketchConstraintCoincidence_36 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_15.startPoint())
156 SketchConstraintCoincidence_37 = Sketch_2.setCoincident(SketchPoint_18.coordinates(), SketchLine_15.startPoint())
157 SketchConstraintCoincidence_38 = Sketch_2.setCoincident(SketchLine_12.startPoint(), SketchLine_15.startPoint())
158 SketchConstraintCoincidence_39 = Sketch_2.setCoincident(SketchLine_15.endPoint(), SketchLine_9.result())
160 Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_7f-SketchLine_8f-SketchLine_12f-SketchLine_13r")])
161 Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_8f-SketchLine_12f-SketchLine_13f-SketchLine_14r")])
162 Face_3 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_8f-SketchLine_9f-SketchLine_12f-SketchLine_14f-SketchLine_15r")])
163 Face_4 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_9f-SketchLine_10f-SketchLine_11f-SketchLine_15f")])
164 Partition_1 = model.addPartition(Part_1_doc, [model.selection("EDGE", "Extrusion_1_1"), model.selection("EDGE", "Extrusion_1_2"), model.selection("EDGE", "Extrusion_1_3"), model.selection("EDGE", "Extrusion_1_4"), model.selection("EDGE", "Extrusion_1_5"), model.selection("EDGE", "Extrusion_1_6"), model.selection("EDGE", "Extrusion_1_7"), model.selection("EDGE", "Extrusion_1_8"), model.selection("EDGE", "Extrusion_1_9"), model.selection("EDGE", "Extrusion_1_10"), model.selection("EDGE", "Extrusion_1_11"), model.selection("EDGE", "Extrusion_1_12"), model.selection("EDGE", "Extrusion_1_13"), model.selection("EDGE", "Extrusion_1_14"), model.selection("EDGE", "Extrusion_1_15"), model.selection("EDGE", "Extrusion_1_16"), model.selection("EDGE", "Extrusion_1_17"), model.selection("EDGE", "Extrusion_1_18"), model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_4_1")])
166 PartitionFeature = Partition_1.feature()
167 assert(len(PartitionFeature.results()) == 1)
168 PartitionResult = modelAPI_ResultBody(PartitionFeature.firstResult())
169 assert(PartitionResult.numberOfSubs() == 22)
171 assert(model.checkPythonDump())