Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sketcher diagnose autoconstraint improvements #1554

@@ -454,6 +454,16 @@ bool GeomCurve::closestParameter(const Base::Vector3d& point, double &u) const
return true;
}
}
catch (StdFail_NotDone e) { // projection does not exist on trimmer curve, let's try basis curve
closestParameterToBasicCurve(point,u);

if(abs(u-c->FirstParameter()) < abs(u-c->LastParameter()))
u = c->FirstParameter();
else
u = c->LastParameter();

return true;
}
catch (Standard_Failure& e) {

throw Base::RuntimeError(e.GetMessageString());
@@ -0,0 +1,62 @@
/***************************************************************************
* Copyright (c) 2018 Abdullah Tahiri <abdullah.tahiri.yo@gmail.com> *
* Copyright (c) 2013 Werner Mayer <wmayer[at]users.sourceforge.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/


#ifndef SKETCHER_ANALYSE_H
#define SKETCHER_ANALYSE_H

#include <vector>
#include <Mod/Sketcher/App/Constraint.h>

namespace Sketcher {

struct ConstraintIds {
Base::Vector3d v;
int First;
int Second;
Sketcher::PointPos FirstPos;
Sketcher::PointPos SecondPos;
Sketcher::ConstraintType Type;
};

struct Constraint_Equal : public std::unary_function<const struct Sketcher::ConstraintIds&, bool>
{
struct Sketcher::ConstraintIds c;
Constraint_Equal(const ConstraintIds& c) : c(c)
{
}
bool operator()(const ConstraintIds& x) const
{
if (c.First == x.First && c.FirstPos == x.FirstPos &&
c.Second == x.Second && c.SecondPos == x.SecondPos)
return true;
if (c.Second == x.First && c.SecondPos == x.FirstPos &&
c.First == x.Second && c.FirstPos == x.SecondPos)
return true;
return false;
}
};

} //namespace Sketcher

#endif // SKETCHER_ANALYSE_H
@@ -52,6 +52,9 @@ SET(Features_SRCS
SketchObjectSF.h
SketchObject.cpp
SketchObject.h
SketchAnalysis.h
SketchAnalysis.cpp
Analyse.h
)
SOURCE_GROUP("Features" FILES ${Features_SRCS})

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.