From b9540bdcf46cd2ec524383a9101de71715b6ca12 Mon Sep 17 00:00:00 2001 From: mpv Date: Fri, 25 May 2018 11:24:04 +0300 Subject: [PATCH] The problem of plane of sketch update fix. The plane is based on the trihedron plane. Sketch is created on this plane. The distance between planes is changed, but sketch is not. --- src/Model/Model_ResultConstruction.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/Model/Model_ResultConstruction.cpp b/src/Model/Model_ResultConstruction.cpp index 251169908..737a63d25 100644 --- a/src/Model/Model_ResultConstruction.cpp +++ b/src/Model/Model_ResultConstruction.cpp @@ -611,10 +611,30 @@ bool Model_ResultConstruction::update(const int theIndex, } return aRes; } else { + // check is this modified or not + std::shared_ptr aNewShape = shape(); + TopoDS_Shape anOldSh; + Handle(TNaming_NamedShape) aNS; + if (aLab.FindAttribute(TNaming_NamedShape::GetID(), aNS)) { + anOldSh = aNS->Get(); + } + if (aNewShape.get()) { + if (anOldSh.IsNull()) + theModified = true; + else { + std::shared_ptr anOldShape(new GeomAPI_Shape); + anOldShape->setImpl(new TopoDS_Shape(anOldSh)); + theModified = !anOldShape->isEqual(aNewShape); + } + } + else if (!anOldSh.IsNull()) { + theModified = true; + } + // For correct naming selection, put the shape into the naming structure. // It seems sub-shapes are not needed: only this shape is (and can be ) selected. TNaming_Builder aBuilder(aLab); - aBuilder.Generated(shape()->impl()); + aBuilder.Generated(aNewShape->impl()); } return shape() && !shape()->isNull(); } -- 2.39.2