From: mpv Date: Fri, 2 Sep 2016 13:33:28 +0000 (+0300) Subject: Fix for the issue #1715 X-Git-Tag: V_2.5.0~72 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ddbaa855381831512ec0d49b34229e82e97a6449;p=modules%2Fshaper.git Fix for the issue #1715 --- diff --git a/src/Model/Model_ResultPart.cpp b/src/Model/Model_ResultPart.cpp index c6d27798b..a396e0dd0 100644 --- a/src/Model/Model_ResultPart.cpp +++ b/src/Model/Model_ResultPart.cpp @@ -150,39 +150,41 @@ bool Model_ResultPart::setDisabled(std::shared_ptr theThis, std::shared_ptr Model_ResultPart::shape() { std::shared_ptr aResult(new GeomAPI_Shape); - if (myTrsf.get()) { // get shape of the base result and apply the transformation - ResultPtr anOrigResult = baseRef(); - std::shared_ptr anOrigShape = anOrigResult->shape(); - if (anOrigShape.get()) { - TopoDS_Shape aShape = anOrigShape->impl(); - if (!aShape.IsNull()) { - aShape.Move(*(myTrsf.get())); - aResult->setImpl(new TopoDS_Shape(aShape)); - } - } - return aResult; - } if (myShape.IsNull()) { // shape is not produced yet, create it - DocumentPtr aDoc = Model_ResultPart::partDoc(); - if (aDoc.get() && aDoc->isOpened()) { - const std::string& aBodyGroup = ModelAPI_ResultBody::group(); - TopoDS_Compound aResultComp; - BRep_Builder aBuilder; - aBuilder.MakeCompound(aResultComp); - int aNumSubs = 0; - for(int a = aDoc->size(aBodyGroup) - 1; a >= 0; a--) { - ResultPtr aBody = std::dynamic_pointer_cast(aDoc->object(aBodyGroup, a)); - // "object" method filters out disabled and concealed anyway, so don't check - if (aBody.get() && aBody->shape().get()) { - TopoDS_Shape aShape = *(aBody->shape()->implPtr()); - if (!aShape.IsNull()) { - aBuilder.Add(aResultComp, aShape); - aNumSubs++; - } + if (myTrsf.get()) { // get shape of the base result and apply the transformation + ResultPtr anOrigResult = baseRef(); + std::shared_ptr anOrigShape = anOrigResult->shape(); + if (anOrigShape.get()) { + TopoDS_Shape aShape = anOrigShape->impl(); + if (!aShape.IsNull()) { + aShape.Move(*(myTrsf.get())); + myShape = aShape; + aResult->setImpl(new TopoDS_Shape(aShape)); } } - if (aNumSubs) { - myShape = aResultComp; + return aResult; + } else { + DocumentPtr aDoc = Model_ResultPart::partDoc(); + if (aDoc.get() && aDoc->isOpened()) { + const std::string& aBodyGroup = ModelAPI_ResultBody::group(); + TopoDS_Compound aResultComp; + BRep_Builder aBuilder; + aBuilder.MakeCompound(aResultComp); + int aNumSubs = 0; + for(int a = aDoc->size(aBodyGroup) - 1; a >= 0; a--) { + ResultPtr aBody = std::dynamic_pointer_cast(aDoc->object(aBodyGroup, a)); + // "object" method filters out disabled and concealed anyway, so don't check + if (aBody.get() && aBody->shape().get()) { + TopoDS_Shape aShape = *(aBody->shape()->implPtr()); + if (!aShape.IsNull()) { + aBuilder.Add(aResultComp, aShape); + aNumSubs++; + } + } + } + if (aNumSubs) { + myShape = aResultComp; + } } } }