theFeature->execute();
} else if (aGroup->Get() == ModelAPI_ResultConstruction::group().c_str()) {
theFeature->execute(); // construction shapes are needed for sketch solver
+ if (!theFeature->results().empty()) // to fix #2640 : update sketch, but not naming
+ std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(theFeature->firstResult())
+ ->facesNum(false);
} else if (aGroup->Get() == ModelAPI_ResultGroup::group().c_str()) {
aNewBody = createGroup(theFeature->data(), aResIndex);
} else if (aGroup->Get() == ModelAPI_ResultField::group().c_str()) {
if (!theShape.get() || !theShape->isEqual(myShape)) {
static const Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED);
ModelAPI_EventCreator::get()->sendUpdated(data()->owner(), anEvent);
+ if (theShape.get()) {
+ myFacesUpToDate = false;
+ myFaces.clear();
+ }
}
myShape = theShape;
- if (theShape.get()) {
- myFacesUpToDate = false;
- myFaces.clear();
- }
}
}
myIsInHistory = isInHistory;
}
-int Model_ResultConstruction::facesNum()
+int Model_ResultConstruction::facesNum(const bool theUpdateNaming)
{
if (!myFacesUpToDate) {
std::shared_ptr<GeomAPI_PlanarEdges> aWirePtr =
myFacesUpToDate = true;
// update all the faces and sub-elements in the naming structure
- DocumentPtr anEmptyExt;
- bool aNotExt = false;
- TDF_Label aDataLab = startLabel(anEmptyExt, aNotExt);
- TDF_ChildIterator aSubsIter(aDataLab, Standard_False);
- for(; aSubsIter.More(); aSubsIter.Next()) {
- const TDF_Label aLab = aSubsIter.Value();
- if (aLab.Tag() == 1) // skip the root shape label
- continue;
- Handle(TNaming_NamedShape) aNS;
- if (aLab.FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
- update(aLab.Tag() - 1, anEmptyExt, aNotExt);
+ if (theUpdateNaming) {
+ DocumentPtr anEmptyExt;
+ bool aNotExt = false;
+ TDF_Label aDataLab = startLabel(anEmptyExt, aNotExt);
+ TDF_ChildIterator aSubsIter(aDataLab, Standard_False);
+ for(; aSubsIter.More(); aSubsIter.Next()) {
+ const TDF_Label aLab = aSubsIter.Value();
+ if (aLab.Tag() == 1) // skip the root shape label
+ continue;
+ Handle(TNaming_NamedShape) aNS;
+ if (aLab.FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
+ update(aLab.Tag() - 1, anEmptyExt, aNotExt);
+ }
}
}
}
MODEL_EXPORT virtual void setIsInHistory(const bool myIsInHistory);
/// if the construction result may be used as faces, this method returns not zero number of faces
- MODEL_EXPORT virtual int facesNum();
+ /// \param theUpdateNaming is false of keeping the naming structure untouched (on load)
+ MODEL_EXPORT virtual int facesNum(const bool theUpdateNaming = true);
/// if the construction result may be used as faces, this method returns face by zero based index
MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Face> face(const int theIndex);
virtual void setIsInHistory(const bool isInHistory) = 0;
/// if the construction result may be used as faces, this method returns not zero number of faces
- virtual int facesNum() = 0;
+ /// \param theUpdateNaming is false of keeping the naming structure untouched (on load)
+ virtual int facesNum(const bool theUpdateNaming = true) = 0;
/// if the construction result may be used as faces, this method returns face by zero based index
virtual std::shared_ptr<GeomAPI_Face> face(const int theIndex) = 0;