From 0912fd0ee75add0f8c19071a9a8cc84870212d81 Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Sun, 23 Jun 2019 15:10:48 +0200 Subject: [PATCH] Sketcher: Fix Carbon copy leads to unsolvable sketch ==================================================== fixes #3973 https://forum.freecadweb.org/viewtopic.php?p=316251#p316198 This commit disables an old "axis orientation correction mode", which tried to solve a problem with orientation of the axis. It never worked fine and it should have never been introduced, as everything it intends to do should be done by setting the appropriate placement offset. --- src/Mod/Sketcher/App/SketchObject.cpp | 50 ++++----------------------- 1 file changed, 7 insertions(+), 43 deletions(-) diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index fd284e45c4..c2b69a28c1 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -5231,11 +5231,13 @@ int SketchObject::carbonCopy(App::DocumentObject * pObj, bool construction) int sourceid = 0; for (std::vector< Sketcher::Constraint * >::const_iterator it= scvals.begin(); it != scvals.end(); ++it,nextcid++,sourceid++) { - if ((*it)->Type == Sketcher::Distance || - (*it)->Type == Sketcher::Radius || - (*it)->Type == Sketcher::Diameter || - (*it)->Type == Sketcher::Angle || - (*it)->Type == Sketcher::SnellsLaw) { + if ((*it)->Type == Sketcher::Distance || + (*it)->Type == Sketcher::Radius || + (*it)->Type == Sketcher::Diameter || + (*it)->Type == Sketcher::Angle || + (*it)->Type == Sketcher::SnellsLaw || + (*it)->Type == Sketcher::DistanceX || + (*it)->Type == Sketcher::DistanceY ) { // then we link its value to the parent // (there is a plausible alternative for a slightly different use case to copy the expression of the parent if one is existing) if ((*it)->isDriving) { @@ -5248,45 +5250,7 @@ int SketchObject::carbonCopy(App::DocumentObject * pObj, bool construction) boost::shared_ptr expr(App::Expression::parse(this, spath.getDocumentObjectName().getString() +std::string(1,'.') + spath.toString())); setExpression(Constraints.createPath(nextcid), expr); - - } - - } - else if ((*it)->Type == Sketcher::DistanceX) { - // then we link its value to the parent - // (there is a plausible alternative for a slightly different use case to copy the expression of the parent if one is existing) - if ((*it)->isDriving) { - App::ObjectIdentifier spath = psObj->Constraints.createPath(sourceid); - - if(xinv) { - boost::shared_ptr expr(App::Expression::parse(this, std::string(1,'-') + spath.getDocumentObjectName().getString() +std::string(1,'.') + spath.toString())); - setExpression(Constraints.createPath(nextcid), expr); - } - else { - boost::shared_ptr expr(App::Expression::parse(this, spath.getDocumentObjectName().getString() +std::string(1,'.') + spath.toString())); - - setExpression(Constraints.createPath(nextcid), expr); - } - } - - } - else if ((*it)->Type == Sketcher::DistanceY ) { - // then we link its value to the parent - // (there is a plausible alternative for a slightly different use case to copy the expression of the parent if one is existing) - if ((*it)->isDriving) { - App::ObjectIdentifier spath = psObj->Constraints.createPath(sourceid); - - if(yinv) { - boost::shared_ptr expr(App::Expression::parse(this, std::string(1,'-') + spath.getDocumentObjectName().getString() +std::string(1,'.') + spath.toString())); - setExpression(Constraints.createPath(nextcid), expr); - } - else { - boost::shared_ptr expr(App::Expression::parse(this, spath.getDocumentObjectName().getString() +std::string(1,'.') + spath.toString())); - setExpression(Constraints.createPath(nextcid), expr); - } - } - } }