Salome HOME
Copyright update 2022
[modules/shaper.git] / src / SketchAPI / SketchAPI_Offset.cpp
index 6d4f24e4e3c1da41f159a479131a78cd9b9c1fa2..d23d153ffaa97e94cf4bb4eda0cc9111888537b6 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2022  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
@@ -34,15 +34,13 @@ SketchAPI_Offset::SketchAPI_Offset (const std::shared_ptr<ModelAPI_Feature> & th
 SketchAPI_Offset::SketchAPI_Offset (const std::shared_ptr<ModelAPI_Feature> & theFeature,
                                     const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
                                     const ModelHighAPI_Double & theOffsetValue,
-                                    bool theIsReversed,
-                                    bool theIsAuxiliary)
+                                    bool theIsReversed)
   : ModelHighAPI_Interface(theFeature)
 {
   if (initialize()) {
     fillAttribute(theObjects, edgesList());
     fillAttribute(theOffsetValue, value());
     fillAttribute(theIsReversed, reversed());
-    fillAttribute(theIsAuxiliary, auxiliary());
 
     execute();
   }
@@ -54,7 +52,7 @@ SketchAPI_Offset::~SketchAPI_Offset()
 
 std::list<std::shared_ptr<SketchAPI_SketchEntity> > SketchAPI_Offset::offset() const
 {
-  std::list<ObjectPtr> aList = createdList()->list();
+  std::list<ObjectPtr> aList = feature()->reflist(SketchPlugin_Constraint::ENTITY_B())->list();
   std::list<FeaturePtr> anIntermediate;
   std::list<ObjectPtr>::const_iterator anIt = aList.begin();
   for (; anIt != aList.end(); ++anIt) {
@@ -74,7 +72,6 @@ void SketchAPI_Offset::dump (ModelHighAPI_Dumper& theDumper) const
   AttributeRefListPtr aOffsetObjects = edgesList();
   AttributeDoublePtr aValue = value();
   AttributeBooleanPtr aReversed = reversed();
-  AttributeBooleanPtr anAux = auxiliary();
 
   // Check all attributes are already dumped. If not, store the feature as postponed.
   if (!theDumper.isDumped(aOffsetObjects)) {
@@ -83,7 +80,7 @@ void SketchAPI_Offset::dump (ModelHighAPI_Dumper& theDumper) const
   }
 
   theDumper << aBase << " = " << aSketchName << ".addOffset(" << aOffsetObjects << ", "
-            << aValue << ", " << aReversed << ", " << anAux << ")" << std::endl;
+            << aValue << ", " << aReversed << ")" << std::endl;
 
   // Dump variables for a list of created features
   theDumper << "[";
@@ -97,11 +94,10 @@ void SketchAPI_Offset::dump (ModelHighAPI_Dumper& theDumper) const
   theDumper << "] = " << theDumper.name(aBase) << ".offset()" << std::endl;
 
   // Set necessary "auxiliary" flag for created features
-  // (flag is set if it differs to anAux)
   for (anIt = aList.begin(); anIt != aList.end(); ++anIt) {
     FeaturePtr aFeature = (*anIt)->feature();
     bool aFeatAux = aFeature->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->value();
-    if (aFeatAux != anAux->value())
+    if (aFeatAux)
       theDumper << theDumper.name((*anIt)->feature(), false)
                 << ".setAuxiliary(" << aFeatAux << ")" <<std::endl;
   }