From: azv Date: Tue, 29 Dec 2015 13:57:39 +0000 (+0300) Subject: Update processing coincidence between origin and a line's attribute (issue #1181) X-Git-Tag: V_2.1.1~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d41ac12929f019bc1cd679de4610592f85dacf3d;p=modules%2Fshaper.git Update processing coincidence between origin and a line's attribute (issue #1181) --- diff --git a/src/SketchSolver/SketchSolver_Builder.cpp b/src/SketchSolver/SketchSolver_Builder.cpp index c01e8817a..ff3413649 100644 --- a/src/SketchSolver/SketchSolver_Builder.cpp +++ b/src/SketchSolver/SketchSolver_Builder.cpp @@ -119,6 +119,8 @@ std::shared_ptr SketchSolver_Builder::point(EntityWrapperPtr theE { if (theEntity->type() != ENTITY_POINT) return std::shared_ptr(); + if (theEntity->subEntities().size() == 1) // SketchPlugin_Point wrapper + return point(theEntity->subEntities().front()); double aXY[2]; std::list aParams = theEntity->parameters(); diff --git a/src/SketchSolver/SketchSolver_Storage.cpp b/src/SketchSolver/SketchSolver_Storage.cpp index e54aec7e4..e606f44c1 100644 --- a/src/SketchSolver/SketchSolver_Storage.cpp +++ b/src/SketchSolver/SketchSolver_Storage.cpp @@ -153,6 +153,11 @@ bool SketchSolver_Storage::update(FeaturePtr theFeature, const GroupID& theGroup // Secondly, convert feature BuilderPtr aBuilder = SketchSolver_Manager::instance()->builder(); GroupID aGroup = theGroup != GID_UNKNOWN ? theGroup : myGroupID; + // Check external feature + std::shared_ptr aSketchFeature = + std::dynamic_pointer_cast(theFeature); + if (aSketchFeature && aSketchFeature->isExternal()) + aGroup = GID_OUTOFGROUP; aRelated = aBuilder->createFeature(theFeature, aSubs, aGroup); if (!aRelated) return false; @@ -194,6 +199,11 @@ bool SketchSolver_Storage::update(AttributePtr theAttribute, const GroupID& theG } BuilderPtr aBuilder = SketchSolver_Manager::instance()->builder(); GroupID aGroup = theGroup != GID_UNKNOWN ? theGroup : myGroupID; + // Check attribute of external features + std::shared_ptr aSketchFeature = + std::dynamic_pointer_cast(theAttribute->owner()); + if (aSketchFeature && aSketchFeature->isExternal()) + aGroup = GID_OUTOFGROUP; aRelated = aBuilder->createAttribute(anAttribute, aGroup); if (!aRelated) return false; diff --git a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Builder.cpp b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Builder.cpp index 68ce5aaf3..704b4b0d5 100644 --- a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Builder.cpp +++ b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Builder.cpp @@ -308,13 +308,16 @@ EntityWrapperPtr SolveSpaceSolver_Builder::createFeature( AttributePtr aPoint = theFeature->attribute(SketchPlugin_Point::COORD_ID()); if (!aPoint->isInitialized()) return aDummy; - EntityWrapperPtr aSub = createAttribute(aPoint, theGroupID, theSketchID); + EntityWrapperPtr aSub = theAttributes.empty() ? createAttribute(aPoint, theGroupID, theSketchID) : + theAttributes.front(); if (!aSub) return aDummy; const Slvs_Entity& aSubEnt = std::dynamic_pointer_cast(aSub)->entity(); - return EntityWrapperPtr(new SolveSpaceSolver_EntityWrapper(theFeature, aPoint, aSubEnt)); + EntityWrapperPtr aResult(new SolveSpaceSolver_EntityWrapper(theFeature, aPoint, aSubEnt)); + aResult->setSubEntities(theAttributes); + return aResult; } // wrong entity diff --git a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Storage.cpp b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Storage.cpp index 7a185c8af..e065fd245 100644 --- a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Storage.cpp +++ b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Storage.cpp @@ -274,6 +274,13 @@ void SolveSpaceSolver_Storage::addCoincidentPoints( { if (theMaster->type() != ENTITY_POINT || theSlave->type() != ENTITY_POINT) return; + if (!theMaster->subEntities().empty() || !theSlave->subEntities().empty()) { + EntityWrapperPtr aSubMaster = theMaster->subEntities().empty() ? + theMaster : theMaster->subEntities().front(); + EntityWrapperPtr aSubSlave = theSlave->subEntities().empty() ? + theSlave : theSlave->subEntities().front(); + return addCoincidentPoints(aSubMaster, aSubSlave); + } // Search available coincidence CoincidentPointsMap::iterator aMasterFound = myCoincidentPoints.find(theMaster);