From c55c087c730ab3708439e36bc0204f824c10f53c Mon Sep 17 00:00:00 2001 From: mpv Date: Thu, 8 Sep 2016 10:40:06 +0300 Subject: [PATCH] Fix for the issue #1733 : collect all the transformations in part-transformation features. --- src/Model/Model_ResultPart.cpp | 19 +++++++++++++++++++ src/Model/Model_ResultPart.h | 3 +++ 2 files changed, 22 insertions(+) diff --git a/src/Model/Model_ResultPart.cpp b/src/Model/Model_ResultPart.cpp index f1e51b21f..105a9c1a0 100644 --- a/src/Model/Model_ResultPart.cpp +++ b/src/Model/Model_ResultPart.cpp @@ -283,6 +283,15 @@ bool Model_ResultPart::updateInPart(const int theIndex) return false; // something is wrong } +gp_Trsf Model_ResultPart::sumTrsf() { + gp_Trsf aResult; + if (myTrsf) { + aResult = *myTrsf; + aResult = aResult * baseRef()->sumTrsf(); + } + return aResult; +} + std::shared_ptr Model_ResultPart::shapeInPart( const std::string& theName, const std::string& theType, int& theIndex) { @@ -305,6 +314,11 @@ std::shared_ptr Model_ResultPart::shapeInPart( aSelAttr->append(theName, theType); theIndex = aSelAttr->size(); aResult = aSelAttr->value(theIndex - 1)->value(); + if (myTrsf.get() && aResult.get() && !aResult->isNull()) { + gp_Trsf aSumTrsf = sumTrsf(); + TopoDS_Shape anOrigMoved = aResult->impl().Moved(aSumTrsf); + aResult->setImpl(new TopoDS_Shape(anOrigMoved)); + } return aResult; } @@ -317,6 +331,11 @@ std::shared_ptr Model_ResultPart::selectionValue(const int theInd AttributeSelectionListPtr aSelAttr = aDoc->selectionInPartFeature(); aResult = aSelAttr->value(theIndex - 1)->value(); + if (myTrsf.get() && aResult.get() && !aResult->isNull()) { + gp_Trsf aSumTrsf = sumTrsf(); + TopoDS_Shape anOrigMoved = aResult->impl().Moved(aSumTrsf); + aResult->setImpl(new TopoDS_Shape(anOrigMoved)); + } return aResult; } diff --git a/src/Model/Model_ResultPart.h b/src/Model/Model_ResultPart.h index 49adb855a..e42df61e8 100644 --- a/src/Model/Model_ResultPart.h +++ b/src/Model/Model_ResultPart.h @@ -79,6 +79,9 @@ protected: /// makes a result on a temporary feature (an action) Model_ResultPart(); + /// returns sum of transformations of the whole sequence of transformation-parts + gp_Trsf sumTrsf(); + /// Returns true if document is activated (loaded into the memory) virtual bool isActivated(); -- 2.39.2