Salome HOME
48224493dd56e9bafd1dd9301808161d684d4744
[modules/shaper.git] / src / SketchPlugin / Test / TestProjectionBSplinePeriodicError.py
1 # Copyright (C) 2020-2022  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 salome.shaper import model
21
22 model.begin()
23 partSet = model.moduleDocument()
24
25 ### Create Sketch
26 Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY"))
27
28 ### Create SketchBSpline
29 SketchBSpline_1_poles = [(39.56361839352194, -91.51890167437574),
30                          (70.21199762078012, -72.31423451653721),
31                          (42.28382694294977, -41.98350738641304),
32                          (67.28504300461098, -31.5470157767404),
33                          (50.62385917039768, -3.473688794131494),
34                          (86.7958072325187, 15.01252243343181)
35                         ]
36 SketchBSpline_1 = Sketch_1.addSpline(poles = SketchBSpline_1_poles)
37
38 ### Create SketchBSplinePeriodic
39 SketchBSplinePeriodic_1_poles = [(42.08285838974091, 63.92994506772382),
40                                  (45.90231280862586, 109.3628979208621),
41                                  (103.3091534085915, 74.17970450461429),
42                                  (80.27079545144119, 67.78674592116529),
43                                  (119.1440714423075, 30.71538726951938),
44                                  (57.61745686692009, 20.1653082760922)
45                                 ]
46 SketchBSplinePeriodic_1 = Sketch_1.addSpline(poles = SketchBSplinePeriodic_1_poles, periodic = True)
47 model.do()
48
49 ### Create Sketch
50 Sketch_2 = model.addSketch(partSet, model.defaultPlane("YOZ"))
51
52 ### Create SketchProjection
53 SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchBSpline_1"), True)
54 SketchBSpline_2 = SketchProjection_1.createdFeature()
55
56 ### Create SketchProjection
57 SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchBSplinePeriodic_1"), True)
58 model.do()
59 model.end()
60
61 assert(SketchProjection_1.feature().error() == "")
62 assert(SketchProjection_2.feature().error() != "")