Skip to content

Commit

Permalink
Sketcher: Fix Carbon copy leads to unsolvable sketch
Browse files Browse the repository at this point in the history
====================================================

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.
  • Loading branch information
abdullahtahiriyo authored and wwmayer committed Jun 28, 2019
1 parent 2f0c3a7 commit 0572853
Showing 1 changed file with 7 additions and 43 deletions.
50 changes: 7 additions & 43 deletions src/Mod/Sketcher/App/SketchObject.cpp
Expand Up @@ -5174,11 +5174,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) {
Expand All @@ -5191,45 +5193,7 @@ int SketchObject::carbonCopy(App::DocumentObject * pObj, bool construction)

boost::shared_ptr<App::Expression> 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<App::Expression> 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<App::Expression> 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<App::Expression> 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<App::Expression> expr(App::Expression::parse(this, spath.getDocumentObjectName().getString() +std::string(1,'.') + spath.toString()));
setExpression(Constraints.createPath(nextcid), expr);
}
}

}
}

Expand Down

0 comments on commit 0572853

Please sign in to comment.