]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Simple fix for 40160 [CEA] No name in SHAPER 40160_NoName 53/head
authorEkaterina Sukhareva <ekaterina.sukhareva@opencascade.com>
Wed, 24 Jan 2024 15:17:07 +0000 (15:17 +0000)
committerEkaterina Sukhareva <ekaterina.sukhareva@opencascade.com>
Mon, 8 Apr 2024 14:34:45 +0000 (15:34 +0100)
src/Model/Model_AttributeSelection.cpp
test.hdfs/Test40160_NoName.hdf [new file with mode: 0644]
test.hdfs/Test40160_NoName.py [new file with mode: 0644]

index af31337620a3936c46e3504934668aa240162c00..8ee38cbc82c92f96ebc1976b745a85d6cea8e41a 100644 (file)
@@ -833,8 +833,11 @@ std::wstring Model_AttributeSelection::namingName(const std::wstring& theDefault
 
   Selector_Selector aSelector(aSelLab, baseDocumentLab());
   std::wstring aResult;
-  if (aCont->shape().get() && aSelector.restore(aCont->shape()->impl<TopoDS_Shape>()))
+  if (aCont->shape().get())
+  {
+    aSelector.restore(aCont->shape()->impl<TopoDS_Shape>());
     aResult = aSelector.name(this);
+  }
   if (aCenterType != NOT_CENTER) {
     aResult += centersMap()[aCenterType];
   }
diff --git a/test.hdfs/Test40160_NoName.hdf b/test.hdfs/Test40160_NoName.hdf
new file mode 100644 (file)
index 0000000..7bdaebd
Binary files /dev/null and b/test.hdfs/Test40160_NoName.hdf differ
diff --git a/test.hdfs/Test40160_NoName.py b/test.hdfs/Test40160_NoName.py
new file mode 100644 (file)
index 0000000..d369013
--- /dev/null
@@ -0,0 +1,49 @@
+# Copyright (C) 2020-2024  CEA, EDF
+#
+# 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 ModelAPI import *
+from GeomDataAPI import *
+from GeomAlgoAPI import *
+from GeomAPI import *
+import sys
+import os
+
+if __name__ == "__main__":
+  session = ModelAPI.ModelAPI_Session.get()
+  aPartSet = session.moduleDocument()
+
+  for aPartIndex in range(aPartSet.size("Parts")):
+    session.startOperation()
+    aPart = ModelAPI.modelAPI_ResultPart(ModelAPI.objectToResult(aPartSet.object("Parts", aPartIndex)))
+    aPart.activate()
+    session.finishOperation()
+     
+    session.startOperation()
+    session.setActiveDocument(aPartSet)
+    session.finishOperation()
+    
+    Part_1_doc = aPart.partDoc()
+    for aFeat in Part_1_doc.allFeatures():
+      if aFeat.isInHistory():
+        if(aFeat.data().name() == "Extrusion_1"):
+          aSelectionList = aFeat.selectionList("base")
+          for index in range(0, aSelectionList.size()):
+            attrSelection = aSelectionList.value(index)
+            shape = attrSelection.value()
+            name = attrSelection.namingName()
+            assert(name)