]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Added a unit-test for the issue #17917
authormpv <mpv@opencascade.com>
Thu, 31 Oct 2019 16:14:51 +0000 (19:14 +0300)
committervsv <vsv@opencascade.com>
Wed, 6 Nov 2019 08:27:42 +0000 (11:27 +0300)
src/ConnectorAPI/Test/Test17917.py [new file with mode: 0644]
src/ConnectorAPI/Test/tests.set

diff --git a/src/ConnectorAPI/Test/Test17917.py b/src/ConnectorAPI/Test/Test17917.py
new file mode 100644 (file)
index 0000000..44042d3
--- /dev/null
@@ -0,0 +1,76 @@
+# Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from SketchAPI import *
+from salome.shaper import model
+from ModelAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 2)
+Group_1 = model.addGroup(Part_1_doc, "Faces", [model.selection("FACE", "Box_1_1/Top")])
+model.do()
+Part_2 = model.addPart(partSet)
+Part_2_doc = Part_2.document()
+Cylinder_1 = model.addCylinder(Part_2_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10, 45)
+Group_2 = model.addGroup(Part_2_doc, "Faces", [model.selection("FACE", "Cylinder_1_1/Face_4"), model.selection("FACE", "Cylinder_1_1/Face_2")])
+model.do()
+Placement_1 = model.addPlacement(partSet, [model.selection("COMPOUND", "Part_2/")], model.selection("FACE", "Part_2/Cylinder_1_1/Face_3"), model.selection("FACE", "Part_1/Box_1_1/Top"), False, True)
+model.do()
+
+aSession = ModelAPI_Session.get()
+aSession.setActiveDocument(partSet, False)
+model.do()
+
+model.exportToGEOM(partSet)
+model.end()
+
+# check what is exported to GEOM
+import salome
+from salome.geom import geomBuilder
+
+import os
+import tempfile
+
+salome.salome_init(1)
+aComp = salome.myStudy.FindComponent("GEOM")
+iterator = salome.myStudy.NewChildIterator(aComp)
+aComponents = []
+while iterator.More():
+  aComponents.append(iterator.Value())
+  iterator.Next()
+
+assert len(aComponents) == 2
+
+ok, group_0_1 = aComponents[0].FindSubObject(1)
+assert ok
+assert group_0_1.GetName() == "Group_1"
+
+ok, group_0_2 = aComponents[0].FindSubObject(2)
+assert not ok
+
+
+ok, group_1_1 = aComponents[1].FindSubObject(1)
+assert ok
+assert group_1_1.GetName() == "Group_1"
+
+ok, group_1_2 = aComponents[1].FindSubObject(2)
+assert not ok
index 2c4eac5044f3ed5ead51b0787ca3e964d99de8ba..be23a5a85583f459f3a2b2cac302b9692448f6a5 100644 (file)
@@ -24,4 +24,5 @@ SET(TEST_NAMES
   TestExportToGEOMWholeResult
   TestExportToGEOMWholeFeature
   Test2882
+  Test17917
 )