]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix an error
authorjfa <jfa@opencascade.com>
Tue, 3 Oct 2023 14:25:44 +0000 (15:25 +0100)
committerjfa <jfa@opencascade.com>
Tue, 3 Oct 2023 14:25:44 +0000 (15:25 +0100)
src/SketchPlugin/SketchPlugin_Offset.cpp

index a32d1e835008969c89bc3b9a5735d0c90e287f4a..119a7373b60819071753ac9b17ab97472b3d2a7c 100644 (file)
@@ -81,13 +81,12 @@ void SketchPlugin_Offset::initAttributes()
   data()->addAttribute(REVERSED_ID(), ModelAPI_AttributeBoolean::typeId());  // #3
 
   // SketchPlugin_Constraint::ENTITY_A() stores original entities
+  AttributeRefListPtr entaAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefList>
+    (data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(),
+                          ModelAPI_AttributeRefList::typeId())); // #4
 
   bool badOrder = false;
   if (anEdgesAttr->isInitialized()) { // restoring data from saved study
-    AttributeRefListPtr entaAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefList>
-      (data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(),
-                            ModelAPI_AttributeRefList::typeId())); // #4
-
     badOrder = !entaAttr->isInitialized();
     // we have not found AttributeRefList at 4th position,
     // so, we suppose a study with wrong order of offset attributes
@@ -104,9 +103,10 @@ void SketchPlugin_Offset::initAttributes()
                             ModelAPI_AttributeBoolean::typeId(),
                             4)); // #4
 
-    data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(),
-                         ModelAPI_AttributeRefList::typeId(),
-                         5); // #5
+    entaAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefList>
+      (data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(),
+                            ModelAPI_AttributeRefList::typeId(),
+                            5)); // #5
   }
 
   // store offset entities