Salome HOME
114d1bd97658b7b3ef0307c0b8e1f3c31dfe4696
[modules/shaper.git] / src / SketchAPI / Test / TestFreePoints.py
1 # Copyright (C) 2019-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 from SketchAPI import *
21
22 from salome.shaper import model
23
24 model.begin()
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("XOZ"))
29 SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False)
30 SketchLine_1 = SketchProjection_1.createdFeature()
31 SketchCircle_1 = Sketch_1.addCircle(46.22261352148133, 0, 23.58244120674807)
32 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_1.center())
33 model.do()
34 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
35 SketchPoint_1 = Sketch_2.addPoint(-17.08115772475531, -35.96860682980034)
36 SketchLine_2 = Sketch_2.addLine(-21.65537897222015, 0.8259975132940123, 39.97043562830241, -43.0039721165161)
37 SketchPoint_2 = Sketch_2.addPoint(15.99061885657872, -44.35579681082369)
38 SketchConstraintDistance_1 = Sketch_2.setDistance(SketchPoint_2.coordinates(), SketchLine_2.result(), 15, True)
39 SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), True)
40 SketchPoint_3 = SketchProjection_2.createdFeature()
41 SketchIntersectionPoint_1 = Sketch_2.addIntersectionPoint(model.selection("EDGE", "Sketch_1/SketchCircle_1_2"), False)
42 [SketchPoint_4, SketchPoint_5] = SketchIntersectionPoint_1.intersectionPoints()
43 SketchConstraintDistance_2 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_4).coordinates(), SketchLine_2.result(), 25, True)
44 model.do()
45
46 FreePoints1 = Sketch_1.getFreePoints()
47 assert(len(FreePoints1) == 0)
48
49 FreePoints2 = Sketch_2.getFreePoints()
50 assert(len(FreePoints2) == 3)
51
52 model.end()