Salome HOME
4adf7a8e7969996cbd74f51a180d4ad1b2bb5cd8
[modules/shaper.git] / src / BuildPlugin / Test / Test3125.py
1 # Copyright (C) 2014-2023  CEA/DEN, EDF R&D
2 #
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.
7 #
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.
12 #
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
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 # Checking of adding a partset-sketcher edges into the wire by the "Add contour" action
21 from salome.shaper import model
22
23 model.begin()
24 partSet = model.moduleDocument()
25 Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOZ"))
26 SketchLine_1 = Sketch_1.addLine(-24.8768472906404, 33.33497536945814, 36.81773399014779, 23.38423645320196)
27 SketchLine_2 = Sketch_1.addLine(36.81773399014779, 23.38423645320196, 11.31896551724138, -27.61330049261085)
28 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
29 SketchLine_3 = Sketch_1.addLine(11.31896551724138, -27.61330049261085, -24.8768472906404, 33.33497536945814)
30 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
31 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint())
32 model.do()
33 Part_1 = model.addPart(partSet)
34 Part_1_doc = Part_1.document()
35 Wire_1_objects = [model.selection("EDGE", "PartSet/Sketch_1/SketchLine_3")]
36 Wire_1 = model.addWire(Part_1_doc, Wire_1_objects, False)
37 Wire_1.feature().customAction("add_contour")
38 model.end()
39
40 from ModelAPI import *
41 from GeomAPI import *
42
43 aFactory = ModelAPI_Session.get().validators()
44 assert(aFactory.validate(Wire_1.feature()))
45
46 model.testNbResults(Wire_1, 1)
47 model.testNbSubShapes(Wire_1, GeomAPI_Shape.EDGE, [3])
48 model.testNbSubShapes(Wire_1, GeomAPI_Shape.VERTEX, [6])