Salome HOME
updated copyright message
[modules/shaper.git] / src / ConstructionPlugin / Test / TestPoint_IntersectLineAndPlane.py
1 # Copyright (C) 2014-2023  CEA, EDF
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 """
21 Test case for Construction Point feature as intersection of line and plane.
22 """
23
24 from salome.shaper import model
25 from GeomAPI import *
26
27 model.begin()
28 partSet = model.moduleDocument()
29 Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY"))
30 SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "Origin"))
31 SketchCircle_1 = Sketch_1.addCircle(0, 0, 60)
32 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center())
33 model.do()
34 Sketch_2 = model.addSketch(partSet, model.defaultPlane("XOZ"))
35 SketchLine_1 = Sketch_2.addLine(60, 100, 0, 20)
36 SketchArc_1 = Sketch_2.addArc(0, 0, -65.89631323066888, 61.2998850129882, -90, 0, False)
37 model.do()
38
39 # point by sketch face and a line
40 Point_1 = model.addPoint(partSet, model.selection("EDGE", "Sketch_2/SketchLine_1"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"))
41 model.do()
42 # check the point position
43 rightPosition = GeomAPI_Vertex(-15, 0, 0)
44 assert(rightPosition.isEqual(Point_1.results()[0].resultSubShapePair()[0].shape()))
45
46 # point by sketch face and an arc, intersection outside of the face, offset is defined
47 Point_2 = model.addPoint(partSet, model.selection("EDGE", "Sketch_2/SketchArc_1_2"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"), 10, True)
48 # check the point position
49 rightPosition = GeomAPI_Vertex(-89.442719099991606, 0, -10)
50 assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()))
51
52
53 model.end()
54 assert(model.checkPythonDump())