Salome HOME
updated copyright message
[modules/shaper.git] / src / FeaturesPlugin / Test / TestMultiTranslation_ErrorMsg.py
1 # Copyright (C) 2018-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
21 from ModelAPI import *
22 aSession = ModelAPI_Session.get()
23 aDocument = aSession.moduleDocument()
24
25 # Create a part
26 aSession.startOperation()
27 aPartFeature = aDocument.addFeature("Part")
28 aSession.finishOperation()
29 aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
30 aPart = aPartResult.partDoc()
31
32 # Create auxiliary box
33 aSession.startOperation()
34 aBox = aPart.addFeature("Box")
35 aBox.string("CreationMethod").setValue("BoxByDimensions")
36 aBox.real("dx").setValue(50)
37 aBox.real("dy").setValue(50)
38 aBox.real("dz").setValue(50)
39 aSession.finishOperation()
40
41 # Create auxiliary compound
42 aSession.startOperation()
43 aCompound = aPart.addFeature("Compound")
44 aCompound.selectionList("base_objects").append("Box_1_1", "SOLID")
45 aSession.finishOperation()
46
47
48 aSession.startOperation()
49 aLinearCopy1 = aPart.addFeature("LinearCopy")
50 aLinearCopy1.execute()
51 assert(aLinearCopy1.error() != "")
52 aSession.finishOperation()
53
54 aSession.startOperation()
55 aLinearCopy1.selectionList("main_objects").append("Compound_1_1", "COMPOUND")
56 aLinearCopy1.execute()
57 assert(aLinearCopy1.error() != "")
58 aSession.finishOperation()
59
60 aSession.startOperation()
61 aLinearCopy1.selection("axis_first_dir").selectSubShape("COMPOUND", "Compound_1_1")
62 aLinearCopy1.execute()
63 assert(aLinearCopy1.error() != "")
64 aSession.finishOperation()
65
66 aSession.startOperation()
67 aLinearCopy1.selection("axis_first_dir").selectSubShape("EDGE", "PartSet/OX")
68 aLinearCopy1.integer("nb_first_dir").setValue(2)
69 aLinearCopy1.execute()
70 assert(aLinearCopy1.error() != "")
71 aSession.finishOperation()
72
73
74 aSession.startOperation()
75 aLinearCopy2 = aPart.addFeature("LinearCopy")
76 aLinearCopy2.string("use_second_dir").setValue("true")
77 aLinearCopy2.execute()
78 assert(aLinearCopy2.error() != "")
79 aSession.finishOperation()
80
81 aSession.startOperation()
82 aLinearCopy2.selectionList("main_objects").append("Compound_1_1", "COMPOUND")
83 aLinearCopy2.execute()
84 assert(aLinearCopy2.error() != "")
85 aSession.finishOperation()
86
87 aSession.startOperation()
88 aLinearCopy2.selection("axis_first_dir").selectSubShape("COMPOUND", "Compound_1_1")
89 aLinearCopy2.execute()
90 assert(aLinearCopy2.error() != "")
91 aSession.finishOperation()
92
93 aSession.startOperation()
94 aLinearCopy2.selection("axis_first_dir").selectSubShape("EDGE", "PartSet/OX")
95 aLinearCopy2.selection("axis_second_dir").selectSubShape("COMPOUND", "Compound_1_1")
96 aLinearCopy2.execute()
97 assert(aLinearCopy2.error() != "")
98 aSession.finishOperation()
99
100 aSession.startOperation()
101 aLinearCopy2.selection("axis_second_dir").selectSubShape("EDGE", "PartSet/OY")
102 aLinearCopy2.integer("nb_first_dir").setValue(0)
103 aLinearCopy2.integer("nb_second_dir").setValue(0)
104 aLinearCopy2.execute()
105 assert(aLinearCopy2.error() != "")
106 aSession.finishOperation()
107
108 aSession.startOperation()
109 aLinearCopy2.integer("nb_first_dir").setValue(2)
110 aLinearCopy2.integer("nb_second_dir").setValue(2)
111 aLinearCopy2.execute()
112 assert(aLinearCopy2.error() != "")
113 aSession.finishOperation()