From 711a187617f507dd582e4c048c3257b981cbfe1f Mon Sep 17 00:00:00 2001 From: mpv Date: Mon, 23 Nov 2015 13:25:50 +0300 Subject: [PATCH] Fix for groups export to GEOM on CompSolids --- src/Model/Model_AttributeSelection.cpp | 5 +++++ src/Model/Model_BodyBuilder.cpp | 7 +++++++ src/Model/Model_ResultCompSolid.cpp | 11 ++++++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/Model/Model_AttributeSelection.cpp b/src/Model/Model_AttributeSelection.cpp index 9d375b2ac..2353e002f 100644 --- a/src/Model/Model_AttributeSelection.cpp +++ b/src/Model/Model_AttributeSelection.cpp @@ -917,6 +917,11 @@ int Model_AttributeSelection::Id() int anID = 0; std::shared_ptr aSelection = value(); std::shared_ptr aContext = context()->shape(); + // support for compsolids: + if (context().get() && ModelAPI_Tools::compSolidOwner(context()).get()) + aContext = ModelAPI_Tools::compSolidOwner(context())->shape(); + + TopoDS_Shape aMainShape = aContext->impl(); const TopoDS_Shape& aSubShape = aSelection->impl(); // searching for the latest main shape diff --git a/src/Model/Model_BodyBuilder.cpp b/src/Model/Model_BodyBuilder.cpp index 45befbcb4..b8ee2d52f 100755 --- a/src/Model/Model_BodyBuilder.cpp +++ b/src/Model/Model_BodyBuilder.cpp @@ -791,8 +791,15 @@ bool Model_BodyBuilder::isLatestEqual(const std::shared_ptr& theS Handle(TNaming_NamedShape) aName; if (aShapeLab.FindAttribute(TNaming_NamedShape::GetID(), aName)) { TopoDS_Shape aLatest = TNaming_Tool::CurrentShape(aName); + if (aLatest.IsNull()) + return false; if (aLatest.IsEqual(aShape)) return true; + // check sub-shapes for comp-solids: + for (TopExp_Explorer anExp(aShape, aLatest.ShapeType()); anExp.More(); anExp.Next()) { + if (aLatest.IsEqual(anExp.Current())) + return true; + } } } } diff --git a/src/Model/Model_ResultCompSolid.cpp b/src/Model/Model_ResultCompSolid.cpp index 4b83d3d59..96cdf32fc 100755 --- a/src/Model/Model_ResultCompSolid.cpp +++ b/src/Model/Model_ResultCompSolid.cpp @@ -191,5 +191,14 @@ void Model_ResultCompSolid::updateSubs(const std::shared_ptr& the bool Model_ResultCompSolid::isLatestEqual(const std::shared_ptr& theShape) { - return myBuilder->isLatestEqual(theShape); + if (myBuilder->isLatestEqual(theShape)) + return true; + // also check that it is asked for sub-elements + std::vector >::const_iterator aSubIter = mySubs.cbegin(); + for(; aSubIter != mySubs.cend(); aSubIter++) { + if (aSubIter->get() && (*aSubIter)->isLatestEqual(theShape)) { + return true; + } + } + return false; } -- 2.39.2