From: mpv Date: Fri, 7 Dec 2018 11:37:24 +0000 (+0300) Subject: Fix for the Box With Fillet case from the "CEA Parametric" document. X-Git-Tag: End2018~106 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=833f9ff0035309f13fe854e9dbc2413c1951b07a;p=modules%2Fshaper.git Fix for the Box With Fillet case from the "CEA Parametric" document. --- diff --git a/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp b/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp index 44dbc0875..0dd9a851c 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp +++ b/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -219,8 +220,30 @@ void ConstructionPlugin_Axis::createAxisByLine() anEdge = aLineShape->edge(); } else if (aLineShape->isCompound()) { - GeomAPI_ShapeIterator anIt(aLineShape); - anEdge = anIt.current()->edge(); + // create an edge which covers all edges from compounds (they are on the same line) + GeomPointPtr aFirst, aLast; + GeomXYZPtr aLineVec; + for(GeomAPI_ShapeIterator anIt(aLineShape); anIt.more(); anIt.next()) { + GeomEdgePtr aSub = anIt.current()->edge(); + if (aSub.get() && aSub->isLine()) { + if (!aLineVec.get()) { + aFirst = aSub->firstPoint(); + aLast = aSub->lastPoint(); + } else { // set aFirst and aLast by extreme points + GeomXYZPtr aFirstVec = aSub->firstPoint()->xyz()->decreased(aFirst->xyz()); + bool aSameDirection = + aSub->lastPoint()->xyz()->decreased(aSub->firstPoint()->xyz())->dot(aLineVec) > 0; + if (aLineVec->dot(aFirstVec) < -1.e-7) { // first point is changed + aFirst = aSameDirection ? aSub->firstPoint() : aSub->lastPoint(); + } else { // last point is changed + aLast = aSameDirection ? aSub->lastPoint() : aSub->firstPoint(); + } + } + aLineVec = aLast->xyz()->decreased(aFirst->xyz()); + } + } + if (aLineVec.get()) + anEdge = GeomAlgoAPI_EdgeBuilder::line(aFirst, aLast); } ResultConstructionPtr aConstr = document()->createConstruction(data()); diff --git a/src/GeomAPI/GeomAPI_Edge.h b/src/GeomAPI/GeomAPI_Edge.h index a375b100e..e2851f71b 100644 --- a/src/GeomAPI/GeomAPI_Edge.h +++ b/src/GeomAPI/GeomAPI_Edge.h @@ -123,7 +123,7 @@ public: virtual std::shared_ptr middlePoint() const; }; -//! Pointer on attribute object +//! Pointer on object typedef std::shared_ptr GeomEdgePtr; #endif diff --git a/src/GeomAPI/GeomAPI_XYZ.h b/src/GeomAPI/GeomAPI_XYZ.h index 020d819c1..bcedbf74d 100644 --- a/src/GeomAPI/GeomAPI_XYZ.h +++ b/src/GeomAPI/GeomAPI_XYZ.h @@ -81,5 +81,8 @@ class GeomAPI_XYZ : public GeomAPI_Interface GEOMAPI_EXPORT double squareModulus() const; }; +//! Pointer on object +typedef std::shared_ptr GeomXYZPtr; + #endif diff --git a/src/Model/Model_AttributeSelection.cpp b/src/Model/Model_AttributeSelection.cpp index 5b382b221..1db965d23 100644 --- a/src/Model/Model_AttributeSelection.cpp +++ b/src/Model/Model_AttributeSelection.cpp @@ -448,7 +448,7 @@ void Model_AttributeSelection::setID(const std::string theID) ModelAPI_AttributeSelection::setID(theID); FeaturePtr aFeature = std::dynamic_pointer_cast(owner()); if (myParent) { - myIsGeometricalSelection = myParent->isGeometricalSelection(); + myIsGeometricalSelection = true;//myParent->isGeometricalSelection(); } else { myIsGeometricalSelection = ModelAPI_Session::get()->validators()->isGeometricalSelection(aFeature->getKind(), id()); @@ -591,7 +591,7 @@ bool Model_AttributeSelection::update() if (anOldShape.IsNull() || aNewShape.IsNull() || !anOldShape.IsEqual(aNewShape)) { // shape type should not be changed: if shape becomes compound of such shapes, then split - if (myParent && !anOldShape.IsNull() && !aNewShape.IsNull() && + if (!myIsGeometricalSelection && myParent && !anOldShape.IsNull() && !aNewShape.IsNull() && anOldShape.ShapeType() != aNewShape.ShapeType() && (aNewShape.ShapeType() == TopAbs_COMPOUND || aNewShape.ShapeType() == TopAbs_COMPSOLID)) { diff --git a/src/ModelAPI/CMakeLists.txt b/src/ModelAPI/CMakeLists.txt index d833a9670..f5d95d663 100644 --- a/src/ModelAPI/CMakeLists.txt +++ b/src/ModelAPI/CMakeLists.txt @@ -229,5 +229,6 @@ ADD_UNIT_TESTS(TestConstants.py TestGeomNamingRevolution.py TestGeomNamingEdgeByFilter.py TestGeomNamingSketchPlane.py + TestGeomNamingBoxWithFillet.py TestContainerSelector.py ) diff --git a/src/ModelAPI/Test/Test1562.py b/src/ModelAPI/Test/Test1562.py index 234172ba2..b49bcf0d0 100644 --- a/src/ModelAPI/Test/Test1562.py +++ b/src/ModelAPI/Test/Test1562.py @@ -67,11 +67,16 @@ model.do() # on increase of parameter selected part of extrusion is increased and selected face is removed (U becomes L) # so, check that selection is still correct and cut from not existing part produces correct shape anyway lenParam.setValue(100) -model.end() +model.do() # check the result validity from ModelAPI import * aFactory = ModelAPI_Session.get().validators() assert(aFactory.validate(ExtrusionCut_2.feature())) +# set the value back to avoid changed the name text in selection of "to_object" in check python dump +lenParam.setValue(45) + +model.end() + assert(model.checkPythonDump()) diff --git a/src/ModelAPI/Test/TestGeomNamingBoxWithFillet.py b/src/ModelAPI/Test/TestGeomNamingBoxWithFillet.py new file mode 100644 index 000000000..515732d8e --- /dev/null +++ b/src/ModelAPI/Test/TestGeomNamingBoxWithFillet.py @@ -0,0 +1,91 @@ +## Copyright (C) 2014-2017 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 +## + +# -*- coding: utf-8 -*- + +from SketchAPI import * + +from salome.shaper import model + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +param_p = model.addParameter(Part_1_doc, "p", "5") +Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchLine_1 = Sketch_1.addLine(0, 0, 0, 30.0000000000845) +SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False) +SketchPoint_1 = SketchProjection_1.createdFeature() +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchPoint_1.result()) +SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False) +SketchLine_2 = SketchProjection_2.createdFeature() +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.result()) +SketchLine_3 = Sketch_1.addLine(0, 30.0000000000845, 30.00000000002328, 30.00000000002326) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint()) +SketchLine_4 = Sketch_1.addLine(30.00000000002328, 30.00000000002326, 29.99999999996195, 0) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchProjection_3 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchLine_5 = SketchProjection_3.createdFeature() +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.result()) +SketchLine_6 = Sketch_1.addLine(29.99999999996195, 0, 0, 0) +SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_6.startPoint()) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_6.endPoint()) +SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), 30) +SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_4.result(), 30) +SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_4.result(), SketchLine_3.result()) +SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_4.result(), SketchLine_1.result()) +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_4r-SketchLine_3r-SketchLine_1r")], model.selection(), 30, 0) +Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_4r-SketchLine_3r-SketchLine_1r")) +SketchLine_7 = Sketch_2.addLine(20, 7, 10, 7) +SketchLine_8 = Sketch_2.addLine(10, 7, 10, 0) +SketchLine_9 = Sketch_2.addLine(10, 0, 20, 0) +SketchLine_10 = Sketch_2.addLine(20, 0, 20, 7) +SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint()) +SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint()) +SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_7.result()) +SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_8.result()) +SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_9.result()) +SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_10.result()) +SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_6"), False) +SketchLine_11 = SketchProjection_4.createdFeature() +SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_11.result()) +SketchConstraintDistance_1 = Sketch_2.setDistance(SketchAPI_Line(SketchLine_11).endPoint(), SketchLine_8.endPoint(), 10, True) +SketchConstraintLength_3 = Sketch_2.setLength(SketchLine_9.result(), 10) +SketchConstraintLength_4 = Sketch_2.setLength(SketchLine_8.result(), 7) +model.do() +ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_7r-SketchLine_8f-SketchLine_9f-SketchLine_10f_wire")], model.selection(), "p", 0, [model.selection("SOLID", "Extrusion_1_1")]) +Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]")], 3) +model.do() +# increase the extrusion-cut heigh to make face of a box divided into two +param_p.setValue(30); +from ModelAPI import * +aFactory = ModelAPI_Session.get().validators() +assert(aFactory.validate(Fillet_1.feature())) +model.do() +# set the value back and check again +param_p.setValue(5); +aFactory = ModelAPI_Session.get().validators() +assert(aFactory.validate(Fillet_1.feature())) +model.end() + +assert(model.checkPythonDump()) diff --git a/src/ModelHighAPI/ModelHighAPI_Dumper.cpp b/src/ModelHighAPI/ModelHighAPI_Dumper.cpp index 62e3327e2..ca344ce98 100644 --- a/src/ModelHighAPI/ModelHighAPI_Dumper.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Dumper.cpp @@ -1068,7 +1068,9 @@ ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<( isDumpByGeom = aSelectedFeature && aSelectedFeature->isInHistory(); } - if (theAttrSelect->isGeometricalSelection() && aShape->shapeType() == GeomAPI_Shape::COMPOUND) { + if (theAttrSelect->isGeometricalSelection() && aShape->shapeType() == GeomAPI_Shape::COMPOUND + && theAttrSelect->context().get() && !aShape->isEqual(theAttrSelect->context()->shape()) + && theAttrSelect->context()->groupName() != ModelAPI_ResultPart::group()) { GeomAPI_ShapeIterator anIt(aShape); aShape = anIt.current(); } diff --git a/src/Selector/Selector_Algo.cpp b/src/Selector/Selector_Algo.cpp index 9a387d1f0..ee31d00bd 100644 --- a/src/Selector/Selector_Algo.cpp +++ b/src/Selector/Selector_Algo.cpp @@ -31,16 +31,21 @@ #include #include #include +#include #include #include #include #include #include #include +#include #include #include #include #include +#include +#include +#include /// type of the selection, integer keeps the Selector_Type value @@ -375,7 +380,7 @@ Selector_Algo* Selector_Algo::restoreByLab(TDF_Label theLab, TDF_Label theBaseDo } Selector_Algo* Selector_Algo::restoreByName(TDF_Label theLab, TDF_Label theBaseDocLab, - std::string theName, const TopAbs_ShapeEnum theShapeType, + std::string theName, const TopAbs_ShapeEnum theShapeType, const bool theGeomNaming, Selector_NameGenerator* theNameGenerator, TDF_Label& theContextLab) { Selector_Algo* aResult = NULL; @@ -406,6 +411,7 @@ Selector_Algo* Selector_Algo::restoreByName(TDF_Label theLab, TDF_Label theBaseD if (aResult) { aResult->myLab = theLab; aResult->myBaseDocumentLab = theBaseDocLab; + aResult->myGeometricalNaming = theGeomNaming; theContextLab = aResult->restoreByName(theName, theShapeType, theNameGenerator); if (theContextLab.IsNull()) { delete aResult; @@ -422,3 +428,68 @@ void Selector_Algo::storeType(const Selector_Type theType) if (myGeometricalNaming) TDataStd_UAttribute::Set(myLab, kGEOMETRICAL_NAMING); } + +/// Returns true if theSub is in theContext shape +static bool isInContext(const TopoDS_Shape& theContext, const TopoDS_Shape& theSub) { + for(TopExp_Explorer anExp(theContext, theSub.ShapeType()); anExp.More(); anExp.Next()) { + if (anExp.Current().IsSame(theSub)) + return true; + } + return false; +} + +bool Selector_Algo::findNewVersion(const TopoDS_Shape& theContext, TopoDS_Shape& theResult) const +{ + if (theResult.IsNull()) + return false; + if (!TNaming_Tool::HasLabel(myLab, theResult)) { + if (theResult.ShapeType() == TopAbs_COMPOUND) { // do it for all elements of compound + BRep_Builder aBuilder; + TopoDS_Compound aResultingCompound; + aBuilder.MakeCompound(aResultingCompound); + bool aWasChanged = false; + for (TopoDS_Iterator anIter(theResult); anIter.More(); anIter.Next()) { + TopoDS_Shape aSub = anIter.Value(); + if (findNewVersion(theContext, aSub)) + aWasChanged = true; + aBuilder.Add(aResultingCompound, aSub); + } + if (aWasChanged) + theResult = aResultingCompound; + return aWasChanged; + } + } else { + // check theResult is in theContext + if (isInContext(theContext, theResult)) + return false; + // searching the next modifications of the result shape in document + TopTools_MapOfShape aResultShapes; + for(TNaming_NewShapeIterator aBaseIter(theResult, myLab); aBaseIter.More(); aBaseIter.Next()) + { + TNaming_Evolution anEvolution = aBaseIter.NamedShape()->Evolution(); + if (anEvolution == TNaming_GENERATED || anEvolution == TNaming_MODIFY) { + TopoDS_Shape aNextModification = aBaseIter.Shape(); + if (aNextModification.IsNull()) + continue; + if (isInContext(theContext, aNextModification)) + aResultShapes.Add(aNextModification); + else if (findNewVersion(theContext, aNextModification)) + aResultShapes.Add(aNextModification); + } + } + if (aResultShapes.IsEmpty()) + return false; + if (aResultShapes.Size() == 1) { + theResult = TopTools_MapIteratorOfMapOfShape(aResultShapes).Value(); + } else { // make a compound of all results + BRep_Builder aBuilder; + TopoDS_Compound aResultingCompound; + aBuilder.MakeCompound(aResultingCompound); + for(TopTools_MapIteratorOfMapOfShape anIter(aResultShapes); anIter.More(); anIter.Next()) + aBuilder.Add(aResultingCompound, anIter.Value()); + theResult = aResultingCompound; + } + return true; + } + return false; +} diff --git a/src/Selector/Selector_Algo.h b/src/Selector/Selector_Algo.h index 97eb30a49..1492c4658 100644 --- a/src/Selector/Selector_Algo.h +++ b/src/Selector/Selector_Algo.h @@ -99,8 +99,8 @@ public: /// Returns not empty label of the context. SELECTOR_EXPORT static Selector_Algo* restoreByName( TDF_Label theLab, TDF_Label theBaseDocLab, std::string theName, - const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator, - TDF_Label& theContextLab); + const TopAbs_ShapeEnum theShapeType, const bool theGeomNaming, + Selector_NameGenerator* theNameGenerator, TDF_Label& theContextLab); /// Returns true if the given shapes are based on the same geometry static bool sameGeometry(const TopoDS_Shape theShape1, const TopoDS_Shape theShape2); @@ -163,6 +163,10 @@ protected: } /// Stores the type of an algorithm in the data tree (in myLab) void storeType(const Selector_Type theType); + + /// Searches the newer version of the shape in the document if the base shape does not + /// belong to context. Returns it in theResult (if any). Returns true is theResult is changed. + bool findNewVersion(const TopoDS_Shape& theContext, TopoDS_Shape& theResult) const; }; #endif diff --git a/src/Selector/Selector_Container.cpp b/src/Selector/Selector_Container.cpp index e36d747d2..6ef129ae5 100644 --- a/src/Selector/Selector_Container.cpp +++ b/src/Selector/Selector_Container.cpp @@ -109,8 +109,8 @@ TDF_Label Selector_Container::restoreByName(std::string theName, } TDF_Label aSubContext; Selector_Algo* aSubSel = - Selector_Algo::restoreByName( - newSubLabel(), baseDocument(), aSubStr, aSubShapeType, theNameGenerator, aSubContext); + Selector_Algo::restoreByName(newSubLabel(), baseDocument(), aSubStr, aSubShapeType, + geometricalNaming(), theNameGenerator, aSubContext); if (!append(aSubSel)) return TDF_Label(); diff --git a/src/Selector/Selector_FilterByNeighbors.cpp b/src/Selector/Selector_FilterByNeighbors.cpp index 2d5488e15..09e0ab314 100644 --- a/src/Selector/Selector_FilterByNeighbors.cpp +++ b/src/Selector/Selector_FilterByNeighbors.cpp @@ -284,8 +284,8 @@ TDF_Label Selector_FilterByNeighbors::restoreByName(std::string theName, std::string aSubStr = theName.substr(aStart + 1, anEndPos - aStart - 1); TDF_Label aSubContext; Selector_Algo* aSubSel = - Selector_Algo::restoreByName( - newSubLabel(), baseDocument(), aSubStr, myShapeType, theNameGenerator, aSubContext); + Selector_Algo::restoreByName(newSubLabel(), baseDocument(), aSubStr, myShapeType, + geometricalNaming(), theNameGenerator, aSubContext); if (!append(aSubSel)) return TDF_Label(); diff --git a/src/Selector/Selector_Intersect.cpp b/src/Selector/Selector_Intersect.cpp index 2d0750b37..5d9ab36b4 100644 --- a/src/Selector/Selector_Intersect.cpp +++ b/src/Selector/Selector_Intersect.cpp @@ -201,11 +201,6 @@ TDF_Label Selector_Intersect::restoreByName(std::string theName, char aShapeChar = theName[anEndPos + 1]; if (theName[anEndPos + 1] != '[') { switch(aShapeChar) { - case 'c': aSubShapeType = TopAbs_COMPOUND; break; - case 'o': aSubShapeType = TopAbs_COMPSOLID; break; - case 's': aSubShapeType = TopAbs_SOLID; break; - case 'h': aSubShapeType = TopAbs_SHELL; break; - case 'w': aSubShapeType = TopAbs_WIRE; break; case 'e': aSubShapeType = TopAbs_EDGE; break; case 'v': aSubShapeType = TopAbs_VERTEX; break; default:; @@ -214,8 +209,8 @@ TDF_Label Selector_Intersect::restoreByName(std::string theName, } TDF_Label aSubContext; Selector_Algo* aSubSel = - Selector_Algo::restoreByName( - newSubLabel(), baseDocument(), aSubStr, aSubShapeType, theNameGenerator, aSubContext); + Selector_Algo::restoreByName(newSubLabel(), baseDocument(), aSubStr, aSubShapeType, + geometricalNaming(), theNameGenerator, aSubContext); if (!append(aSubSel)) return TDF_Label(); @@ -297,11 +292,6 @@ std::string Selector_Intersect::name(Selector_NameGenerator* theNameGenerator) TopAbs_ShapeEnum aSubType = aSubVal.ShapeType(); if (aSubType != TopAbs_FACE) { // in case the sub shape type must be stored switch(aSubType) { - case TopAbs_COMPOUND: aResult += "c"; break; - case TopAbs_COMPSOLID: aResult += "o"; break; - case TopAbs_SOLID: aResult += "s"; break; - case TopAbs_SHELL: aResult += "h"; break; - case TopAbs_WIRE: aResult += "w"; break; case TopAbs_EDGE: aResult += "e"; break; case TopAbs_VERTEX: aResult += "v"; break; default:; diff --git a/src/Selector/Selector_Modify.cpp b/src/Selector/Selector_Modify.cpp index 5ac20366a..d7d5d47f4 100644 --- a/src/Selector/Selector_Modify.cpp +++ b/src/Selector/Selector_Modify.cpp @@ -280,9 +280,11 @@ bool Selector_Modify::solve(const TopoDS_Shape& theContext) findModificationResult(aFinalsCommon); if (aFinalsCommon.Extent() == 1) { // result is valid: found only one shape aResult = aFinalsCommon.First(); + findNewVersion(theContext, aResult); } else if (aFinalsCommon.Extent() > 1 && myWeakIndex > 0) { Selector_NExplode aNExp(aFinalsCommon); aResult = aNExp.shape(myWeakIndex); + findNewVersion(theContext, aResult); } else if (aFinalsCommon.Extent() > 1 && geometricalNaming()) {// if same geometry - compound TopoDS_ListOfShape::Iterator aCommonIter(aFinalsCommon); TopoDS_Shape aFirst = aCommonIter.Value(); @@ -295,7 +297,9 @@ bool Selector_Modify::solve(const TopoDS_Shape& theContext) TopoDS_Compound aCompound; aBuilder.MakeCompound(aCompound); for(aCommonIter.Initialize(aFinalsCommon); aCommonIter.More(); aCommonIter.Next()) { - aBuilder.Add(aCompound, aCommonIter.Value()); + TopoDS_Shape aSub = aCommonIter.Value(); + findNewVersion(theContext, aSub); + aBuilder.Add(aCompound, aSub); } aResult = aCompound; } diff --git a/src/Selector/Selector_Primitive.cpp b/src/Selector/Selector_Primitive.cpp index 15c617da0..a2d141066 100644 --- a/src/Selector/Selector_Primitive.cpp +++ b/src/Selector/Selector_Primitive.cpp @@ -63,7 +63,11 @@ bool Selector_Primitive::solve(const TopoDS_Shape& theContext) { Handle(TNaming_NamedShape) aNS; if (myFinal.FindAttribute(TNaming_NamedShape::GetID(), aNS)) { - Selector_Algo::store(aNS->Get()); + TopoDS_Shape aResult = aNS->Get(); + // if shape was modified and not exists in the context anymore, check evolution of this shape + // issue 2254 and similar (document CEA parametric first issue description) + findNewVersion(theContext, aResult); + Selector_Algo::store(aResult); return true; } return false; diff --git a/src/Selector/Selector_Selector.cpp b/src/Selector/Selector_Selector.cpp index 260d8da9d..548cd0cc6 100644 --- a/src/Selector/Selector_Selector.cpp +++ b/src/Selector/Selector_Selector.cpp @@ -83,11 +83,9 @@ TDF_Label Selector_Selector::restoreByName( Selector_NameGenerator* theNameGenerator, const bool theGeometricalNaming) { TDF_Label aResult; - myAlgo = Selector_Algo::restoreByName( - myLab, myBaseDocumentLab, theName, theShapeType, theNameGenerator, aResult); + myAlgo = Selector_Algo::restoreByName(myLab, myBaseDocumentLab, theName, theShapeType, + theGeometricalNaming, theNameGenerator, aResult); if (myAlgo) { - if (theGeometricalNaming) - myAlgo->setGeometricalNaming(); return aResult; } return TDF_Label();