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