Sketcher: Convert PointPos into an enum CLASS
This commit is contained in:
@@ -49,11 +49,11 @@ Constraint::Constraint()
|
||||
AlignmentType(Undef),
|
||||
Name(""),
|
||||
First(GeoEnum::GeoUndef),
|
||||
FirstPos(none),
|
||||
FirstPos(PointPos::none),
|
||||
Second(GeoEnum::GeoUndef),
|
||||
SecondPos(none),
|
||||
SecondPos(PointPos::none),
|
||||
Third(GeoEnum::GeoUndef),
|
||||
ThirdPos(none),
|
||||
ThirdPos(PointPos::none),
|
||||
LabelDistance(10.f),
|
||||
LabelPosition(0.f),
|
||||
isDriving(true),
|
||||
|
||||
@@ -50,11 +50,11 @@ int ConstraintPy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
||||
|
||||
char *ConstraintType;
|
||||
int FirstIndex = GeoEnum::GeoUndef;
|
||||
int FirstPos = none;
|
||||
int FirstPos = static_cast<int>(PointPos::none);
|
||||
int SecondIndex= GeoEnum::GeoUndef;
|
||||
int SecondPos = none;
|
||||
int SecondPos = static_cast<int>(PointPos::none);
|
||||
int ThirdIndex = GeoEnum::GeoUndef;
|
||||
int ThirdPos = none;
|
||||
int ThirdPos = static_cast<int>(PointPos::none);
|
||||
double Value = 0;
|
||||
int intArg1, intArg2, intArg3, intArg4, intArg5;
|
||||
// Note: In Python 2.x PyArg_ParseTuple prints a warning if a float is given but an integer is expected.
|
||||
@@ -295,9 +295,9 @@ int ConstraintPy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
||||
this->getConstraintPtr()->Type = Tangent;
|
||||
//valid = true;//non-standard assignment
|
||||
this->getConstraintPtr()->First = intArg1;
|
||||
this->getConstraintPtr()->FirstPos = Sketcher::none;
|
||||
this->getConstraintPtr()->FirstPos = Sketcher::PointPos::none;
|
||||
this->getConstraintPtr()->Second = intArg2;
|
||||
this->getConstraintPtr()->SecondPos = Sketcher::none;
|
||||
this->getConstraintPtr()->SecondPos = Sketcher::PointPos::none;
|
||||
this->getConstraintPtr()->Third = intArg3;
|
||||
this->getConstraintPtr()->ThirdPos = (Sketcher::PointPos) intArg4;
|
||||
return 0;
|
||||
@@ -306,9 +306,9 @@ int ConstraintPy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
||||
this->getConstraintPtr()->Type = Perpendicular;
|
||||
//valid = true;//non-standard assignment
|
||||
this->getConstraintPtr()->First = intArg1;
|
||||
this->getConstraintPtr()->FirstPos = Sketcher::none;
|
||||
this->getConstraintPtr()->FirstPos = Sketcher::PointPos::none;
|
||||
this->getConstraintPtr()->Second = intArg2;
|
||||
this->getConstraintPtr()->SecondPos = Sketcher::none;
|
||||
this->getConstraintPtr()->SecondPos = Sketcher::PointPos::none;
|
||||
this->getConstraintPtr()->Third = intArg3;
|
||||
this->getConstraintPtr()->ThirdPos = (Sketcher::PointPos) intArg4;
|
||||
return 0;
|
||||
@@ -406,9 +406,9 @@ int ConstraintPy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
||||
this->getConstraintPtr()->Type = Angle;
|
||||
//valid = true;//non-standard assignment
|
||||
this->getConstraintPtr()->First = intArg1;
|
||||
this->getConstraintPtr()->FirstPos = Sketcher::none;
|
||||
this->getConstraintPtr()->FirstPos = Sketcher::PointPos::none;
|
||||
this->getConstraintPtr()->Second = intArg2; //let's goof up all the terminology =)
|
||||
this->getConstraintPtr()->SecondPos = Sketcher::none;
|
||||
this->getConstraintPtr()->SecondPos = Sketcher::PointPos::none;
|
||||
this->getConstraintPtr()->Third = intArg3;
|
||||
this->getConstraintPtr()->ThirdPos = (Sketcher::PointPos) intArg4;
|
||||
this->getConstraintPtr()->setValue(Value);
|
||||
@@ -450,7 +450,7 @@ int ConstraintPy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
||||
this->getConstraintPtr()->Second = SecondIndex;
|
||||
this->getConstraintPtr()->SecondPos = (Sketcher::PointPos) SecondPos;
|
||||
this->getConstraintPtr()->Third = ThirdIndex;
|
||||
this->getConstraintPtr()->ThirdPos = none;
|
||||
this->getConstraintPtr()->ThirdPos = Sketcher::PointPos::none;
|
||||
this->getConstraintPtr()->setValue(Value);
|
||||
return 0;
|
||||
}
|
||||
@@ -570,7 +570,7 @@ void ConstraintPy::setFirstPos(Py::Long arg)
|
||||
{
|
||||
int pos = arg;
|
||||
|
||||
if(pos>=Sketcher::none && pos<=Sketcher::mid) {
|
||||
if(pos>=static_cast<int>(Sketcher::PointPos::none) && pos<=static_cast<int>(Sketcher::PointPos::mid)) {
|
||||
this->getConstraintPtr()->FirstPos = (Sketcher::PointPos)pos;
|
||||
}
|
||||
else {
|
||||
@@ -600,7 +600,7 @@ void ConstraintPy::setSecondPos(Py::Long arg)
|
||||
{
|
||||
int pos = arg;
|
||||
|
||||
if(pos>=Sketcher::none && pos<=Sketcher::mid) {
|
||||
if(pos>=static_cast<int>(Sketcher::PointPos::none) && pos<=static_cast<int>(Sketcher::PointPos::mid)) {
|
||||
this->getConstraintPtr()->SecondPos = (Sketcher::PointPos)pos;
|
||||
}
|
||||
else {
|
||||
@@ -630,7 +630,7 @@ void ConstraintPy::setThirdPos(Py::Long arg)
|
||||
{
|
||||
int pos = arg;
|
||||
|
||||
if(pos>=Sketcher::none && pos<=Sketcher::mid) {
|
||||
if(pos>=static_cast<int>(Sketcher::PointPos::none) && pos<=static_cast<int>(Sketcher::PointPos::mid)) {
|
||||
this->getConstraintPtr()->ThirdPos = (Sketcher::PointPos)pos;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -76,7 +76,7 @@ struct SketcherExport GeoEnum
|
||||
* complex geometries like parabola focus or b-spline knots use InternalAlignment constraints
|
||||
* in addition to PointPos.
|
||||
*/
|
||||
enum PointPos : int {
|
||||
enum class PointPos : int {
|
||||
none = 0, // Edge of a geometry
|
||||
start = 1, // Starting point of a geometry
|
||||
end = 2, // End point of a geometry
|
||||
|
||||
@@ -125,59 +125,59 @@ Base::Vector3d GeoListModel<T>::getPoint(const Part::Geometry * geo, Sketcher::P
|
||||
|
||||
if (geo->getTypeId() == Part::GeomPoint::getClassTypeId()) {
|
||||
const Part::GeomPoint *p = static_cast<const Part::GeomPoint*>(geo);
|
||||
if (pos == start || pos == mid || pos == end)
|
||||
if (pos == PointPos::start || pos == PointPos::mid || pos == PointPos::end)
|
||||
return p->getPoint();
|
||||
} else if (geo->getTypeId() == Part::GeomLineSegment::getClassTypeId()) {
|
||||
const Part::GeomLineSegment *lineSeg = static_cast<const Part::GeomLineSegment*>(geo);
|
||||
if (pos == start)
|
||||
if (pos == PointPos::start)
|
||||
return lineSeg->getStartPoint();
|
||||
else if (pos == end)
|
||||
else if (pos == PointPos::end)
|
||||
return lineSeg->getEndPoint();
|
||||
} else if (geo->getTypeId() == Part::GeomCircle::getClassTypeId()) {
|
||||
const Part::GeomCircle *circle = static_cast<const Part::GeomCircle*>(geo);
|
||||
if (pos == mid)
|
||||
if (pos == PointPos::mid)
|
||||
return circle->getCenter();
|
||||
} else if (geo->getTypeId() == Part::GeomEllipse::getClassTypeId()) {
|
||||
const Part::GeomEllipse *ellipse = static_cast<const Part::GeomEllipse*>(geo);
|
||||
if (pos == mid)
|
||||
if (pos == PointPos::mid)
|
||||
return ellipse->getCenter();
|
||||
} else if (geo->getTypeId() == Part::GeomArcOfCircle::getClassTypeId()) {
|
||||
const Part::GeomArcOfCircle *aoc = static_cast<const Part::GeomArcOfCircle*>(geo);
|
||||
if (pos == start)
|
||||
if (pos == PointPos::start)
|
||||
return aoc->getStartPoint(/*emulateCCW=*/true);
|
||||
else if (pos == end)
|
||||
else if (pos == PointPos::end)
|
||||
return aoc->getEndPoint(/*emulateCCW=*/true);
|
||||
else if (pos == mid)
|
||||
else if (pos == PointPos::mid)
|
||||
return aoc->getCenter();
|
||||
} else if (geo->getTypeId() == Part::GeomArcOfEllipse::getClassTypeId()) {
|
||||
const Part::GeomArcOfEllipse *aoc = static_cast<const Part::GeomArcOfEllipse*>(geo);
|
||||
if (pos == start)
|
||||
if (pos == PointPos::start)
|
||||
return aoc->getStartPoint(/*emulateCCW=*/true);
|
||||
else if (pos == end)
|
||||
else if (pos == PointPos::end)
|
||||
return aoc->getEndPoint(/*emulateCCW=*/true);
|
||||
else if (pos == mid)
|
||||
else if (pos == PointPos::mid)
|
||||
return aoc->getCenter();
|
||||
} else if (geo->getTypeId() == Part::GeomArcOfHyperbola::getClassTypeId()) {
|
||||
const Part::GeomArcOfHyperbola *aoh = static_cast<const Part::GeomArcOfHyperbola*>(geo);
|
||||
if (pos == start)
|
||||
if (pos == PointPos::start)
|
||||
return aoh->getStartPoint();
|
||||
else if (pos == end)
|
||||
else if (pos == PointPos::end)
|
||||
return aoh->getEndPoint();
|
||||
else if (pos == mid)
|
||||
else if (pos == PointPos::mid)
|
||||
return aoh->getCenter();
|
||||
} else if (geo->getTypeId() == Part::GeomArcOfParabola::getClassTypeId()) {
|
||||
const Part::GeomArcOfParabola *aop = static_cast<const Part::GeomArcOfParabola*>(geo);
|
||||
if (pos == start)
|
||||
if (pos == PointPos::start)
|
||||
return aop->getStartPoint();
|
||||
else if (pos == end)
|
||||
else if (pos == PointPos::end)
|
||||
return aop->getEndPoint();
|
||||
else if (pos == mid)
|
||||
else if (pos == PointPos::mid)
|
||||
return aop->getCenter();
|
||||
} else if (geo->getTypeId() == Part::GeomBSplineCurve::getClassTypeId()) {
|
||||
const Part::GeomBSplineCurve *bsp = static_cast<const Part::GeomBSplineCurve*>(geo);
|
||||
if (pos == start)
|
||||
if (pos == PointPos::start)
|
||||
return bsp->getStartPoint();
|
||||
else if (pos == end)
|
||||
else if (pos == PointPos::end)
|
||||
return bsp->getEndPoint();
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace Part {
|
||||
}
|
||||
|
||||
namespace Sketcher {
|
||||
enum PointPos : int;
|
||||
enum class PointPos : int;
|
||||
|
||||
class GeometryFacade;
|
||||
}
|
||||
|
||||
+147
-147
@@ -456,16 +456,16 @@ void Sketch::calculateDependentParametersElements(void)
|
||||
Geoms[element->second.first].geo->getExtension(Sketcher::SolverGeometryExtension::getClassTypeId()).lock());
|
||||
|
||||
switch(element->second.second) {
|
||||
case none:
|
||||
case PointPos::none:
|
||||
solvext->setEdge(SolverGeometryExtension::Dependent);
|
||||
break;
|
||||
case start:
|
||||
case PointPos::start:
|
||||
solvext->setStart(SolverGeometryExtension::Dependent);
|
||||
break;
|
||||
case end:
|
||||
case PointPos::end:
|
||||
solvext->setEnd(SolverGeometryExtension::Dependent);
|
||||
break;
|
||||
case mid:
|
||||
case PointPos::mid:
|
||||
solvext->setMid(SolverGeometryExtension::Dependent);
|
||||
break;
|
||||
}
|
||||
@@ -687,8 +687,8 @@ int Sketch::addPoint(const Part::GeomPoint &point, bool fixed)
|
||||
Geoms.push_back(def);
|
||||
|
||||
if(!fixed) {
|
||||
param2geoelement.emplace( std::piecewise_construct, std::forward_as_tuple(p1.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::start));
|
||||
param2geoelement.emplace( std::piecewise_construct, std::forward_as_tuple(p1.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::start));
|
||||
param2geoelement.emplace( std::piecewise_construct, std::forward_as_tuple(p1.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::start));
|
||||
param2geoelement.emplace( std::piecewise_construct, std::forward_as_tuple(p1.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::start));
|
||||
}
|
||||
|
||||
// return the position of the newly added geometry
|
||||
@@ -746,10 +746,10 @@ int Sketch::addLineSegment(const Part::GeomLineSegment &lineSegment, bool fixed)
|
||||
Geoms.push_back(def);
|
||||
|
||||
if(!fixed) {
|
||||
param2geoelement.emplace( std::piecewise_construct, std::forward_as_tuple(p1.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::start));
|
||||
param2geoelement.emplace( std::piecewise_construct, std::forward_as_tuple(p1.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::start));
|
||||
param2geoelement.emplace( std::piecewise_construct, std::forward_as_tuple(p2.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::end));
|
||||
param2geoelement.emplace( std::piecewise_construct, std::forward_as_tuple(p2.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::end));
|
||||
param2geoelement.emplace( std::piecewise_construct, std::forward_as_tuple(p1.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::start));
|
||||
param2geoelement.emplace( std::piecewise_construct, std::forward_as_tuple(p1.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::start));
|
||||
param2geoelement.emplace( std::piecewise_construct, std::forward_as_tuple(p2.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::end));
|
||||
param2geoelement.emplace( std::piecewise_construct, std::forward_as_tuple(p2.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::end));
|
||||
}
|
||||
|
||||
// return the position of the newly added geometry
|
||||
@@ -824,15 +824,15 @@ int Sketch::addArc(const Part::GeomArcOfCircle &circleSegment, bool fixed)
|
||||
GCSsys.addConstraintArcRules(a);
|
||||
|
||||
if(!fixed) {
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::start));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::start));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::end));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::end));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p3.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::mid));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p3.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::mid));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(r), std::forward_as_tuple(Geoms.size()-1, Sketcher::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(a1), std::forward_as_tuple(Geoms.size()-1, Sketcher::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(a2), std::forward_as_tuple(Geoms.size()-1, Sketcher::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::start));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::start));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::end));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::end));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p3.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::mid));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p3.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::mid));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(r), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(a1), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(a2), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none));
|
||||
}
|
||||
|
||||
// return the position of the newly added geometry
|
||||
@@ -924,17 +924,17 @@ int Sketch::addArcOfEllipse(const Part::GeomArcOfEllipse &ellipseSegment, bool f
|
||||
GCSsys.addConstraintArcOfEllipseRules(a);
|
||||
|
||||
if(!fixed) {
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::start));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::start));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::end));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::end));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p3.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::mid));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p3.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::mid));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(f1X), std::forward_as_tuple(Geoms.size()-1, Sketcher::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(f1Y), std::forward_as_tuple(Geoms.size()-1, Sketcher::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(rmin), std::forward_as_tuple(Geoms.size()-1, Sketcher::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(a1), std::forward_as_tuple(Geoms.size()-1, Sketcher::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(a2), std::forward_as_tuple(Geoms.size()-1, Sketcher::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::start));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::start));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::end));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::end));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p3.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::mid));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p3.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::mid));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(f1X), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(f1Y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(rmin), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(a1), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(a2), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none));
|
||||
}
|
||||
|
||||
// return the position of the newly added geometry
|
||||
@@ -1024,17 +1024,17 @@ int Sketch::addArcOfHyperbola(const Part::GeomArcOfHyperbola &hyperbolaSegment,
|
||||
GCSsys.addConstraintArcOfHyperbolaRules(a);
|
||||
|
||||
if(!fixed) {
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::start));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::start));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::end));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::end));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p3.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::mid));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p3.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::mid));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(f1X), std::forward_as_tuple(Geoms.size()-1, Sketcher::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(f1Y), std::forward_as_tuple(Geoms.size()-1, Sketcher::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(rmin), std::forward_as_tuple(Geoms.size()-1, Sketcher::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(a1), std::forward_as_tuple(Geoms.size()-1, Sketcher::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(a2), std::forward_as_tuple(Geoms.size()-1, Sketcher::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::start));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::start));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::end));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::end));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p3.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::mid));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p3.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::mid));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(f1X), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(f1Y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(rmin), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(a1), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(a2), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none));
|
||||
}
|
||||
|
||||
|
||||
@@ -1115,16 +1115,16 @@ int Sketch::addArcOfParabola(const Part::GeomArcOfParabola ¶bolaSegment, boo
|
||||
GCSsys.addConstraintArcOfParabolaRules(a);
|
||||
|
||||
if(!fixed) {
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::start));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::start));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::end));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::end));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p3.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::mid));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p3.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::mid));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p4.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p4.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(a1), std::forward_as_tuple(Geoms.size()-1, Sketcher::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(a2), std::forward_as_tuple(Geoms.size()-1, Sketcher::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::start));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::start));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::end));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::end));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p3.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::mid));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p3.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::mid));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p4.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p4.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(a1), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(a2), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none));
|
||||
}
|
||||
|
||||
// return the position of the newly added geometry
|
||||
@@ -1191,8 +1191,8 @@ int Sketch::addBSpline(const Part::GeomBSplineCurve &bspline, bool fixed)
|
||||
spoles.push_back(p);
|
||||
|
||||
if(!fixed) {
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p.x), std::forward_as_tuple(Geoms.size(), Sketcher::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p.y), std::forward_as_tuple(Geoms.size(), Sketcher::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p.x), std::forward_as_tuple(Geoms.size(), Sketcher::PointPos::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p.y), std::forward_as_tuple(Geoms.size(), Sketcher::PointPos::none));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1204,7 +1204,7 @@ int Sketch::addBSpline(const Part::GeomBSplineCurve &bspline, bool fixed)
|
||||
sweights.push_back(params[params.size()-1]);
|
||||
|
||||
if(!fixed) {
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(r), std::forward_as_tuple(Geoms.size(), Sketcher::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(r), std::forward_as_tuple(Geoms.size(), Sketcher::PointPos::none));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1286,10 +1286,10 @@ int Sketch::addBSpline(const Part::GeomBSplineCurve &bspline, bool fixed)
|
||||
|
||||
if(!fixed) {
|
||||
// Note: Poles and weight parameters are emplaced above
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::start));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::start));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::end));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::end));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::start));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::start));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::end));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p2.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::end));
|
||||
}
|
||||
|
||||
// return the position of the newly added geometry
|
||||
@@ -1336,9 +1336,9 @@ int Sketch::addCircle(const Part::GeomCircle &cir, bool fixed)
|
||||
Geoms.push_back(def);
|
||||
|
||||
if(!fixed) {
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::mid));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::mid));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(r), std::forward_as_tuple(Geoms.size()-1, Sketcher::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::mid));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(p1.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::mid));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(r), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none));
|
||||
}
|
||||
|
||||
// return the position of the newly added geometry
|
||||
@@ -1400,11 +1400,11 @@ int Sketch::addEllipse(const Part::GeomEllipse &elip, bool fixed)
|
||||
Geoms.push_back(def);
|
||||
|
||||
if(!fixed) {
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(c.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::mid));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(c.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::mid));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(f1X), std::forward_as_tuple(Geoms.size()-1, Sketcher::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(f1Y), std::forward_as_tuple(Geoms.size()-1, Sketcher::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(rmin), std::forward_as_tuple(Geoms.size()-1, Sketcher::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(c.x), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::mid));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(c.y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::mid));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(f1X), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(f1Y), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none));
|
||||
param2geoelement.emplace(std::piecewise_construct, std::forward_as_tuple(rmin), std::forward_as_tuple(Geoms.size()-1, Sketcher::PointPos::none));
|
||||
}
|
||||
|
||||
// return the position of the newly added geometry
|
||||
@@ -1535,7 +1535,7 @@ int Sketch::addConstraint(const Constraint *constraint)
|
||||
|
||||
switch (constraint->Type) {
|
||||
case DistanceX:
|
||||
if (constraint->FirstPos == none){ // horizontal length of a line
|
||||
if (constraint->FirstPos == PointPos::none){ // horizontal length of a line
|
||||
c.value = new double(constraint->getValue());
|
||||
if(c.driving)
|
||||
FixParameters.push_back(c.value);
|
||||
@@ -1557,7 +1557,7 @@ int Sketch::addConstraint(const Constraint *constraint)
|
||||
|
||||
rtn = addCoordinateXConstraint(constraint->First,constraint->FirstPos,c.value,c.driving);
|
||||
}
|
||||
else if (constraint->SecondPos != none) {// point to point horizontal distance
|
||||
else if (constraint->SecondPos != PointPos::none) {// point to point horizontal distance
|
||||
c.value = new double(constraint->getValue());
|
||||
if(c.driving)
|
||||
FixParameters.push_back(c.value);
|
||||
@@ -1571,7 +1571,7 @@ int Sketch::addConstraint(const Constraint *constraint)
|
||||
}
|
||||
break;
|
||||
case DistanceY:
|
||||
if (constraint->FirstPos == none){ // vertical length of a line
|
||||
if (constraint->FirstPos == PointPos::none){ // vertical length of a line
|
||||
c.value = new double(constraint->getValue());
|
||||
if(c.driving)
|
||||
FixParameters.push_back(c.value);
|
||||
@@ -1593,7 +1593,7 @@ int Sketch::addConstraint(const Constraint *constraint)
|
||||
|
||||
rtn = addCoordinateYConstraint(constraint->First,constraint->FirstPos,c.value,c.driving);
|
||||
}
|
||||
else if (constraint->SecondPos != none){ // point to point vertical distance
|
||||
else if (constraint->SecondPos != PointPos::none){ // point to point vertical distance
|
||||
c.value = new double(constraint->getValue());
|
||||
if(c.driving)
|
||||
FixParameters.push_back(c.value);
|
||||
@@ -1630,8 +1630,8 @@ int Sketch::addConstraint(const Constraint *constraint)
|
||||
rtn = addParallelConstraint(constraint->First,constraint->Second);
|
||||
break;
|
||||
case Perpendicular:
|
||||
if (constraint->FirstPos == none &&
|
||||
constraint->SecondPos == none &&
|
||||
if (constraint->FirstPos == PointPos::none &&
|
||||
constraint->SecondPos == PointPos::none &&
|
||||
constraint->Third == GeoEnum::GeoUndef){
|
||||
//simple perpendicularity
|
||||
rtn = addPerpendicularConstraint(constraint->First,constraint->Second);
|
||||
@@ -1653,8 +1653,8 @@ int Sketch::addConstraint(const Constraint *constraint)
|
||||
}
|
||||
break;
|
||||
case Tangent:
|
||||
if (constraint->FirstPos == none &&
|
||||
constraint->SecondPos == none &&
|
||||
if (constraint->FirstPos == PointPos::none &&
|
||||
constraint->SecondPos == PointPos::none &&
|
||||
constraint->Third == GeoEnum::GeoUndef){
|
||||
//simple tangency
|
||||
rtn = addTangentConstraint(constraint->First,constraint->Second);
|
||||
@@ -1676,7 +1676,7 @@ int Sketch::addConstraint(const Constraint *constraint)
|
||||
}
|
||||
break;
|
||||
case Distance:
|
||||
if (constraint->SecondPos != none){ // point to point distance
|
||||
if (constraint->SecondPos != PointPos::none){ // point to point distance
|
||||
c.value = new double(constraint->getValue());
|
||||
if(c.driving)
|
||||
FixParameters.push_back(c.value);
|
||||
@@ -1689,7 +1689,7 @@ int Sketch::addConstraint(const Constraint *constraint)
|
||||
c.value,c.driving);
|
||||
}
|
||||
else if (constraint->Second != GeoEnum::GeoUndef) {
|
||||
if (constraint->FirstPos != none) { // point to line distance
|
||||
if (constraint->FirstPos != PointPos::none) { // point to line distance
|
||||
c.value = new double(constraint->getValue());
|
||||
if(c.driving)
|
||||
FixParameters.push_back(c.value);
|
||||
@@ -1728,7 +1728,7 @@ int Sketch::addConstraint(const Constraint *constraint)
|
||||
constraint->Second, constraint->SecondPos,
|
||||
constraint->Third, constraint->ThirdPos,
|
||||
c.value, constraint->Type,c.driving);
|
||||
} else if (constraint->SecondPos != none){ // angle between two lines (with explicit start points)
|
||||
} else if (constraint->SecondPos != PointPos::none){ // angle between two lines (with explicit start points)
|
||||
c.value = new double(constraint->getValue());
|
||||
if(c.driving)
|
||||
FixParameters.push_back(c.value);
|
||||
@@ -1806,7 +1806,7 @@ int Sketch::addConstraint(const Constraint *constraint)
|
||||
rtn = addEqualConstraint(constraint->First,constraint->Second);
|
||||
break;
|
||||
case Symmetric:
|
||||
if (constraint->ThirdPos != none)
|
||||
if (constraint->ThirdPos != PointPos::none)
|
||||
rtn = addSymmetricConstraint(constraint->First,constraint->FirstPos,
|
||||
constraint->Second,constraint->SecondPos,
|
||||
constraint->Third,constraint->ThirdPos);
|
||||
@@ -2376,8 +2376,8 @@ int Sketch::addAngleAtPointConstraint(
|
||||
}
|
||||
|
||||
bool avp = geoId3!=GeoEnum::GeoUndef; //is angle-via-point?
|
||||
bool e2c = pos2 == none && pos1 != none;//is endpoint-to-curve?
|
||||
bool e2e = pos2 != none && pos1 != none;//is endpoint-to-endpoint?
|
||||
bool e2c = pos2 == PointPos::none && pos1 != PointPos::none;//is endpoint-to-curve?
|
||||
bool e2e = pos2 != PointPos::none && pos1 != PointPos::none;//is endpoint-to-endpoint?
|
||||
|
||||
if (!( avp || e2c || e2e )) {
|
||||
//assert(0);//none of the three types. Why are we here??
|
||||
@@ -2616,19 +2616,19 @@ int Sketch::addAngleConstraint(int geoId1, PointPos pos1, int geoId2, PointPos p
|
||||
return -1;
|
||||
|
||||
GCS::Point *l1p1=0, *l1p2=0;
|
||||
if (pos1 == start) {
|
||||
if (pos1 == PointPos::start) {
|
||||
l1p1 = &Points[Geoms[geoId1].startPointId];
|
||||
l1p2 = &Points[Geoms[geoId1].endPointId];
|
||||
} else if (pos1 == end) {
|
||||
} else if (pos1 == PointPos::end) {
|
||||
l1p1 = &Points[Geoms[geoId1].endPointId];
|
||||
l1p2 = &Points[Geoms[geoId1].startPointId];
|
||||
}
|
||||
|
||||
GCS::Point *l2p1=0, *l2p2=0;
|
||||
if (pos2 == start) {
|
||||
if (pos2 == PointPos::start) {
|
||||
l2p1 = &Points[Geoms[geoId2].startPointId];
|
||||
l2p2 = &Points[Geoms[geoId2].endPointId];
|
||||
} else if (pos2 == end) {
|
||||
} else if (pos2 == PointPos::end) {
|
||||
l2p1 = &Points[Geoms[geoId2].endPointId];
|
||||
l2p2 = &Points[Geoms[geoId2].startPointId];
|
||||
}
|
||||
@@ -2909,7 +2909,7 @@ int Sketch::addSnellsLawConstraint(int geoIdRay1, PointPos posRay1,
|
||||
GCSsys.addConstraintSnellsLaw(*ray1, *ray2,
|
||||
*boundary, p1,
|
||||
n1, n2,
|
||||
posRay1==start, posRay2 == end,
|
||||
posRay1 == PointPos::start, posRay2 == PointPos::end,
|
||||
tag, driving);
|
||||
return ConstraintsCounter;
|
||||
}
|
||||
@@ -2927,8 +2927,8 @@ int Sketch::addInternalAlignmentEllipseMajorDiameter(int geoId1, int geoId2)
|
||||
if (Geoms[geoId2].type != Line)
|
||||
return -1;
|
||||
|
||||
int pointId1 = getPointId(geoId2, start);
|
||||
int pointId2 = getPointId(geoId2, end);
|
||||
int pointId1 = getPointId(geoId2, PointPos::start);
|
||||
int pointId2 = getPointId(geoId2, PointPos::end);
|
||||
|
||||
if (pointId1 >= 0 && pointId1 < int(Points.size()) &&
|
||||
pointId2 >= 0 && pointId2 < int(Points.size())) {
|
||||
@@ -2969,8 +2969,8 @@ int Sketch::addInternalAlignmentEllipseMinorDiameter(int geoId1, int geoId2)
|
||||
if (Geoms[geoId2].type != Line)
|
||||
return -1;
|
||||
|
||||
int pointId1 = getPointId(geoId2, start);
|
||||
int pointId2 = getPointId(geoId2, end);
|
||||
int pointId1 = getPointId(geoId2, PointPos::start);
|
||||
int pointId2 = getPointId(geoId2, PointPos::end);
|
||||
|
||||
if (pointId1 >= 0 && pointId1 < int(Points.size()) &&
|
||||
pointId2 >= 0 && pointId2 < int(Points.size())) {
|
||||
@@ -3010,7 +3010,7 @@ int Sketch::addInternalAlignmentEllipseFocus1(int geoId1, int geoId2)
|
||||
if (Geoms[geoId2].type != Point)
|
||||
return -1;
|
||||
|
||||
int pointId1 = getPointId(geoId2, start);
|
||||
int pointId1 = getPointId(geoId2, PointPos::start);
|
||||
|
||||
if (pointId1 >= 0 && pointId1 < int(Points.size())) {
|
||||
GCS::Point &p1 = Points[pointId1];
|
||||
@@ -3049,7 +3049,7 @@ int Sketch::addInternalAlignmentEllipseFocus2(int geoId1, int geoId2)
|
||||
if (Geoms[geoId2].type != Point)
|
||||
return -1;
|
||||
|
||||
int pointId1 = getPointId(geoId2, start);
|
||||
int pointId1 = getPointId(geoId2, PointPos::start);
|
||||
|
||||
if (pointId1 >= 0 && pointId1 < int(Points.size())) {
|
||||
GCS::Point &p1 = Points[pointId1];
|
||||
@@ -3088,8 +3088,8 @@ int Sketch::addInternalAlignmentHyperbolaMajorDiameter(int geoId1, int geoId2)
|
||||
if (Geoms[geoId2].type != Line)
|
||||
return -1;
|
||||
|
||||
int pointId1 = getPointId(geoId2, start);
|
||||
int pointId2 = getPointId(geoId2, end);
|
||||
int pointId1 = getPointId(geoId2, PointPos::start);
|
||||
int pointId2 = getPointId(geoId2, PointPos::end);
|
||||
|
||||
if (pointId1 >= 0 && pointId1 < int(Points.size()) &&
|
||||
pointId2 >= 0 && pointId2 < int(Points.size())) {
|
||||
@@ -3119,8 +3119,8 @@ int Sketch::addInternalAlignmentHyperbolaMinorDiameter(int geoId1, int geoId2)
|
||||
if (Geoms[geoId2].type != Line)
|
||||
return -1;
|
||||
|
||||
int pointId1 = getPointId(geoId2, start);
|
||||
int pointId2 = getPointId(geoId2, end);
|
||||
int pointId1 = getPointId(geoId2, PointPos::start);
|
||||
int pointId2 = getPointId(geoId2, PointPos::end);
|
||||
|
||||
if (pointId1 >= 0 && pointId1 < int(Points.size()) &&
|
||||
pointId2 >= 0 && pointId2 < int(Points.size())) {
|
||||
@@ -3150,7 +3150,7 @@ int Sketch::addInternalAlignmentHyperbolaFocus(int geoId1, int geoId2)
|
||||
if (Geoms[geoId2].type != Point)
|
||||
return -1;
|
||||
|
||||
int pointId1 = getPointId(geoId2, start);
|
||||
int pointId1 = getPointId(geoId2, PointPos::start);
|
||||
|
||||
if (pointId1 >= 0 && pointId1 < int(Points.size())) {
|
||||
GCS::Point &p1 = Points[pointId1];
|
||||
@@ -3176,7 +3176,7 @@ int Sketch::addInternalAlignmentParabolaFocus(int geoId1, int geoId2)
|
||||
if (Geoms[geoId2].type != Point)
|
||||
return -1;
|
||||
|
||||
int pointId1 = getPointId(geoId2, start);
|
||||
int pointId1 = getPointId(geoId2, PointPos::start);
|
||||
|
||||
if (pointId1 >= 0 && pointId1 < int(Points.size())) {
|
||||
GCS::Point &p1 = Points[pointId1];
|
||||
@@ -3202,7 +3202,7 @@ int Sketch::addInternalAlignmentBSplineControlPoint(int geoId1, int geoId2, int
|
||||
if (Geoms[geoId2].type != Circle)
|
||||
return -1;
|
||||
|
||||
int pointId1 = getPointId(geoId2, mid);
|
||||
int pointId1 = getPointId(geoId2, PointPos::mid);
|
||||
|
||||
if (pointId1 >= 0 && pointId1 < int(Points.size())) {
|
||||
GCS::Circle &c = Circles[Geoms[geoId2].index];
|
||||
@@ -3230,7 +3230,7 @@ int Sketch::addInternalAlignmentKnotPoint(int geoId1, int geoId2, int knotindex)
|
||||
if (Geoms[geoId2].type != Point)
|
||||
return -1;
|
||||
|
||||
int pointId1 = getPointId(geoId2, start);
|
||||
int pointId1 = getPointId(geoId2, PointPos::start);
|
||||
|
||||
if (pointId1 >= 0 && pointId1 < int(Points.size())) {
|
||||
// GCS::Point &p = Points[pointId1];
|
||||
@@ -3461,7 +3461,7 @@ bool Sketch::updateGeometry()
|
||||
point->setPoint(pointcoords); // update the geompoint of the knot (geometry update)
|
||||
// Now we update the position of the points in the solver, so that any call to solve()
|
||||
// calculates constraints and positions based on the actual position of the knots.
|
||||
auto pointindex = getPointId(*it5, start);
|
||||
auto pointindex = getPointId(*it5, PointPos::start);
|
||||
auto solverpoint = Points[pointindex];
|
||||
*(solverpoint.x) = pointcoords.x;
|
||||
*(solverpoint.y) = pointcoords.y;
|
||||
@@ -3706,7 +3706,7 @@ int Sketch::initMove(int geoId, PointPos pos, bool fine)
|
||||
}
|
||||
|
||||
if (Geoms[geoId].type == Point) {
|
||||
if (pos == start) {
|
||||
if (pos == PointPos::start) {
|
||||
GCS::Point &point = Points[Geoms[geoId].startPointId];
|
||||
GCS::Point p0;
|
||||
MoveParameters.resize(2); // px,py
|
||||
@@ -3717,23 +3717,23 @@ int Sketch::initMove(int geoId, PointPos pos, bool fine)
|
||||
GCSsys.addConstraintP2PCoincident(p0,point,GCS::DefaultTemporaryConstraint);
|
||||
}
|
||||
} else if (Geoms[geoId].type == Line) {
|
||||
if (pos == start || pos == end) {
|
||||
if (pos == PointPos::start || pos == PointPos::end) {
|
||||
MoveParameters.resize(2); // x,y
|
||||
GCS::Point p0;
|
||||
p0.x = &MoveParameters[0];
|
||||
p0.y = &MoveParameters[1];
|
||||
if (pos == start) {
|
||||
if (pos == PointPos::start) {
|
||||
GCS::Point &p = Points[Geoms[geoId].startPointId];
|
||||
*p0.x = *p.x;
|
||||
*p0.y = *p.y;
|
||||
GCSsys.addConstraintP2PCoincident(p0,p,GCS::DefaultTemporaryConstraint);
|
||||
} else if (pos == end) {
|
||||
} else if (pos == PointPos::end) {
|
||||
GCS::Point &p = Points[Geoms[geoId].endPointId];
|
||||
*p0.x = *p.x;
|
||||
*p0.y = *p.y;
|
||||
GCSsys.addConstraintP2PCoincident(p0,p,GCS::DefaultTemporaryConstraint);
|
||||
}
|
||||
} else if (pos == none || pos == mid) {
|
||||
} else if (pos == PointPos::none || pos == PointPos::mid) {
|
||||
MoveParameters.resize(4); // x1,y1,x2,y2
|
||||
GCS::Point p1, p2;
|
||||
p1.x = &MoveParameters[0];
|
||||
@@ -3751,14 +3751,14 @@ int Sketch::initMove(int geoId, PointPos pos, bool fine)
|
||||
} else if (Geoms[geoId].type == Circle) {
|
||||
GCS::Point ¢er = Points[Geoms[geoId].midPointId];
|
||||
GCS::Point p0,p1;
|
||||
if (pos == mid) {
|
||||
if (pos == PointPos::mid) {
|
||||
MoveParameters.resize(2); // cx,cy
|
||||
p0.x = &MoveParameters[0];
|
||||
p0.y = &MoveParameters[1];
|
||||
*p0.x = *center.x;
|
||||
*p0.y = *center.y;
|
||||
GCSsys.addConstraintP2PCoincident(p0,center,GCS::DefaultTemporaryConstraint);
|
||||
} else if (pos == none) {
|
||||
} else if (pos == PointPos::none) {
|
||||
//bool pole = GeometryFacade::isInternalType(Geoms[geoId].geo, InternalType::BSplineControlPoint);
|
||||
MoveParameters.resize(4); // x,y,cx,cy - For poles blocking the center
|
||||
GCS::Circle &c = Circles[Geoms[geoId].index];
|
||||
@@ -3779,7 +3779,7 @@ int Sketch::initMove(int geoId, PointPos pos, bool fine)
|
||||
|
||||
GCS::Point ¢er = Points[Geoms[geoId].midPointId];
|
||||
GCS::Point p0,p1;
|
||||
if (pos == mid || pos == none) {
|
||||
if (pos == PointPos::mid || pos == PointPos::none) {
|
||||
MoveParameters.resize(2); // cx,cy
|
||||
p0.x = &MoveParameters[0];
|
||||
p0.y = &MoveParameters[1];
|
||||
@@ -3792,7 +3792,7 @@ int Sketch::initMove(int geoId, PointPos pos, bool fine)
|
||||
|
||||
GCS::Point ¢er = Points[Geoms[geoId].midPointId];
|
||||
GCS::Point p0,p1;
|
||||
if (pos == mid || pos == none) {
|
||||
if (pos == PointPos::mid || pos == PointPos::none) {
|
||||
MoveParameters.resize(2); // cx,cy
|
||||
p0.x = &MoveParameters[0];
|
||||
p0.y = &MoveParameters[1];
|
||||
@@ -3800,12 +3800,12 @@ int Sketch::initMove(int geoId, PointPos pos, bool fine)
|
||||
*p0.y = *center.y;
|
||||
GCSsys.addConstraintP2PCoincident(p0,center,GCS::DefaultTemporaryConstraint);
|
||||
|
||||
} else if (pos == start || pos == end) {
|
||||
} else if (pos == PointPos::start || pos == PointPos::end) {
|
||||
|
||||
MoveParameters.resize(4); // x,y,cx,cy
|
||||
if (pos == start || pos == end) {
|
||||
GCS::Point &p = (pos == start) ? Points[Geoms[geoId].startPointId]
|
||||
: Points[Geoms[geoId].endPointId];;
|
||||
if (pos == PointPos::start || pos == PointPos::end) {
|
||||
GCS::Point &p = (pos == PointPos::start) ? Points[Geoms[geoId].startPointId]
|
||||
: Points[Geoms[geoId].endPointId];;
|
||||
p0.x = &MoveParameters[0];
|
||||
p0.y = &MoveParameters[1];
|
||||
*p0.x = *p.x;
|
||||
@@ -3827,7 +3827,7 @@ int Sketch::initMove(int geoId, PointPos pos, bool fine)
|
||||
|
||||
GCS::Point ¢er = Points[Geoms[geoId].midPointId];
|
||||
GCS::Point p0,p1;
|
||||
if (pos == mid || pos == none) {
|
||||
if (pos == PointPos::mid || pos == PointPos::none) {
|
||||
MoveParameters.resize(2); // cx,cy
|
||||
p0.x = &MoveParameters[0];
|
||||
p0.y = &MoveParameters[1];
|
||||
@@ -3835,12 +3835,12 @@ int Sketch::initMove(int geoId, PointPos pos, bool fine)
|
||||
*p0.y = *center.y;
|
||||
|
||||
GCSsys.addConstraintP2PCoincident(p0,center,GCS::DefaultTemporaryConstraint);
|
||||
} else if (pos == start || pos == end) {
|
||||
} else if (pos == PointPos::start || pos == PointPos::end) {
|
||||
|
||||
MoveParameters.resize(4); // x,y,cx,cy
|
||||
if (pos == start || pos == end) {
|
||||
GCS::Point &p = (pos == start) ? Points[Geoms[geoId].startPointId]
|
||||
: Points[Geoms[geoId].endPointId];;
|
||||
if (pos == PointPos::start || pos == PointPos::end) {
|
||||
GCS::Point &p = (pos == PointPos::start) ? Points[Geoms[geoId].startPointId]
|
||||
: Points[Geoms[geoId].endPointId];;
|
||||
p0.x = &MoveParameters[0];
|
||||
p0.y = &MoveParameters[1];
|
||||
*p0.x = *p.x;
|
||||
@@ -3862,7 +3862,7 @@ int Sketch::initMove(int geoId, PointPos pos, bool fine)
|
||||
|
||||
GCS::Point ¢er = Points[Geoms[geoId].midPointId];
|
||||
GCS::Point p0,p1;
|
||||
if (pos == mid || pos == none) {
|
||||
if (pos == PointPos::mid || pos == PointPos::none) {
|
||||
MoveParameters.resize(2); // cx,cy
|
||||
p0.x = &MoveParameters[0];
|
||||
p0.y = &MoveParameters[1];
|
||||
@@ -3870,12 +3870,12 @@ int Sketch::initMove(int geoId, PointPos pos, bool fine)
|
||||
*p0.y = *center.y;
|
||||
|
||||
GCSsys.addConstraintP2PCoincident(p0,center,GCS::DefaultTemporaryConstraint);
|
||||
} else if (pos == start || pos == end) {
|
||||
} else if (pos == PointPos::start || pos == PointPos::end) {
|
||||
|
||||
MoveParameters.resize(4); // x,y,cx,cy
|
||||
if (pos == start || pos == end) {
|
||||
GCS::Point &p = (pos == start) ? Points[Geoms[geoId].startPointId]
|
||||
: Points[Geoms[geoId].endPointId];;
|
||||
if (pos == PointPos::start || pos == PointPos::end) {
|
||||
GCS::Point &p = (pos == PointPos::start) ? Points[Geoms[geoId].startPointId]
|
||||
: Points[Geoms[geoId].endPointId];;
|
||||
p0.x = &MoveParameters[0];
|
||||
p0.y = &MoveParameters[1];
|
||||
*p0.x = *p.x;
|
||||
@@ -3894,23 +3894,23 @@ int Sketch::initMove(int geoId, PointPos pos, bool fine)
|
||||
|
||||
}
|
||||
} else if (Geoms[geoId].type == BSpline) {
|
||||
if (pos == start || pos == end) {
|
||||
if (pos == PointPos::start || pos == PointPos::end) {
|
||||
MoveParameters.resize(2); // x,y
|
||||
GCS::Point p0;
|
||||
p0.x = &MoveParameters[0];
|
||||
p0.y = &MoveParameters[1];
|
||||
if (pos == start) {
|
||||
if (pos == PointPos::start) {
|
||||
GCS::Point &p = Points[Geoms[geoId].startPointId];
|
||||
*p0.x = *p.x;
|
||||
*p0.y = *p.y;
|
||||
GCSsys.addConstraintP2PCoincident(p0,p,GCS::DefaultTemporaryConstraint);
|
||||
} else if (pos == end) {
|
||||
} else if (pos == PointPos::end) {
|
||||
GCS::Point &p = Points[Geoms[geoId].endPointId];
|
||||
*p0.x = *p.x;
|
||||
*p0.y = *p.y;
|
||||
GCSsys.addConstraintP2PCoincident(p0,p,GCS::DefaultTemporaryConstraint);
|
||||
}
|
||||
} else if (pos == none || pos == mid) {
|
||||
} else if (pos == PointPos::none || pos == PointPos::mid) {
|
||||
GCS::BSpline &bsp = BSplines[Geoms[geoId].index];
|
||||
MoveParameters.resize(bsp.poles.size()*2); // x0,y0,x1,y1,....xp,yp
|
||||
|
||||
@@ -3931,24 +3931,24 @@ int Sketch::initMove(int geoId, PointPos pos, bool fine)
|
||||
} else if (Geoms[geoId].type == Arc) {
|
||||
GCS::Point ¢er = Points[Geoms[geoId].midPointId];
|
||||
GCS::Point p0,p1;
|
||||
if (pos == mid) {
|
||||
if (pos == PointPos::mid) {
|
||||
MoveParameters.resize(2); // cx,cy
|
||||
p0.x = &MoveParameters[0];
|
||||
p0.y = &MoveParameters[1];
|
||||
*p0.x = *center.x;
|
||||
*p0.y = *center.y;
|
||||
GCSsys.addConstraintP2PCoincident(p0,center,GCS::DefaultTemporaryConstraint);
|
||||
} else if (pos == start || pos == end || pos == none) {
|
||||
} else if (pos == PointPos::start || pos == PointPos::end || pos == PointPos::none) {
|
||||
MoveParameters.resize(4); // x,y,cx,cy
|
||||
if (pos == start || pos == end) {
|
||||
GCS::Point &p = (pos == start) ? Points[Geoms[geoId].startPointId]
|
||||
if (pos == PointPos::start || pos == PointPos::end) {
|
||||
GCS::Point &p = (pos == PointPos::start) ? Points[Geoms[geoId].startPointId]
|
||||
: Points[Geoms[geoId].endPointId];;
|
||||
p0.x = &MoveParameters[0];
|
||||
p0.y = &MoveParameters[1];
|
||||
*p0.x = *p.x;
|
||||
*p0.y = *p.y;
|
||||
GCSsys.addConstraintP2PCoincident(p0,p,GCS::DefaultTemporaryConstraint);
|
||||
} else if (pos == none) {
|
||||
} else if (pos == PointPos::none) {
|
||||
GCS::Arc &a = Arcs[Geoms[geoId].index];
|
||||
p0.x = &MoveParameters[0];
|
||||
p0.y = &MoveParameters[1];
|
||||
@@ -4010,15 +4010,15 @@ int Sketch::movePoint(int geoId, PointPos pos, Base::Vector3d toPoint, bool rela
|
||||
MoveParameters[i+1] = InitParameters[i+1] + toPoint.y;
|
||||
}
|
||||
} else if (Geoms[geoId].type == Point) {
|
||||
if (pos == start) {
|
||||
if (pos == PointPos::start) {
|
||||
MoveParameters[0] = toPoint.x;
|
||||
MoveParameters[1] = toPoint.y;
|
||||
}
|
||||
} else if (Geoms[geoId].type == Line) {
|
||||
if (pos == start || pos == end) {
|
||||
if (pos == PointPos::start || pos == PointPos::end) {
|
||||
MoveParameters[0] = toPoint.x;
|
||||
MoveParameters[1] = toPoint.y;
|
||||
} else if (pos == none || pos == mid) {
|
||||
} else if (pos == PointPos::none || pos == PointPos::mid) {
|
||||
double dx = (InitParameters[2]-InitParameters[0])/2;
|
||||
double dy = (InitParameters[3]-InitParameters[1])/2;
|
||||
MoveParameters[0] = toPoint.x - dx;
|
||||
@@ -4027,40 +4027,40 @@ int Sketch::movePoint(int geoId, PointPos pos, Base::Vector3d toPoint, bool rela
|
||||
MoveParameters[3] = toPoint.y + dy;
|
||||
}
|
||||
} else if (Geoms[geoId].type == Circle) {
|
||||
if (pos == mid || pos == none) {
|
||||
if (pos == PointPos::mid || pos == PointPos::none) {
|
||||
MoveParameters[0] = toPoint.x;
|
||||
MoveParameters[1] = toPoint.y;
|
||||
}
|
||||
} else if (Geoms[geoId].type == Arc) {
|
||||
if (pos == start || pos == end || pos == mid || pos == none) {
|
||||
if (pos == PointPos::start || pos == PointPos::end || pos == PointPos::mid || pos == PointPos::none) {
|
||||
MoveParameters[0] = toPoint.x;
|
||||
MoveParameters[1] = toPoint.y;
|
||||
}
|
||||
} else if (Geoms[geoId].type == Ellipse) {
|
||||
if (pos == mid || pos == none) {
|
||||
if (pos == PointPos::mid || pos == PointPos::none) {
|
||||
MoveParameters[0] = toPoint.x;
|
||||
MoveParameters[1] = toPoint.y;
|
||||
}
|
||||
} else if (Geoms[geoId].type == ArcOfEllipse) {
|
||||
if (pos == start || pos == end || pos == mid || pos == none) {
|
||||
if (pos == PointPos::start || pos == PointPos::end || pos == PointPos::mid || pos == PointPos::none) {
|
||||
MoveParameters[0] = toPoint.x;
|
||||
MoveParameters[1] = toPoint.y;
|
||||
}
|
||||
} else if (Geoms[geoId].type == ArcOfHyperbola) {
|
||||
if (pos == start || pos == end || pos == mid || pos == none) {
|
||||
if (pos == PointPos::start || pos == PointPos::end || pos == PointPos::mid || pos == PointPos::none) {
|
||||
MoveParameters[0] = toPoint.x;
|
||||
MoveParameters[1] = toPoint.y;
|
||||
}
|
||||
} else if (Geoms[geoId].type == ArcOfParabola) {
|
||||
if (pos == start || pos == end || pos == mid || pos == none) {
|
||||
if (pos == PointPos::start || pos == PointPos::end || pos == PointPos::mid || pos == PointPos::none) {
|
||||
MoveParameters[0] = toPoint.x;
|
||||
MoveParameters[1] = toPoint.y;
|
||||
}
|
||||
} else if (Geoms[geoId].type == BSpline) {
|
||||
if (pos == start || pos == end) {
|
||||
if (pos == PointPos::start || pos == PointPos::end) {
|
||||
MoveParameters[0] = toPoint.x;
|
||||
MoveParameters[1] = toPoint.y;
|
||||
} else if (pos == none || pos == mid) {
|
||||
} else if (pos == PointPos::none || pos == PointPos::mid) {
|
||||
GCS::BSpline &bsp = BSplines[Geoms[geoId].index];
|
||||
|
||||
double cx = 0, cy = 0; // geometric center
|
||||
@@ -4095,13 +4095,13 @@ int Sketch::getPointId(int geoId, PointPos pos) const
|
||||
if (geoId < 0 || geoId >= (int)Geoms.size())
|
||||
return -1;
|
||||
switch (pos) {
|
||||
case start:
|
||||
case PointPos::start:
|
||||
return Geoms[geoId].startPointId;
|
||||
case end:
|
||||
case PointPos::end:
|
||||
return Geoms[geoId].endPointId;
|
||||
case mid:
|
||||
case PointPos::mid:
|
||||
return Geoms[geoId].midPointId;
|
||||
case none:
|
||||
case PointPos::none:
|
||||
break;
|
||||
}
|
||||
return -1;
|
||||
|
||||
@@ -154,11 +154,11 @@ int SketchAnalysis::detectMissingPointOnPointConstraints(double precision, bool
|
||||
const Part::GeomLineSegment *segm = static_cast<const Part::GeomLineSegment*>(gf->getGeometry());
|
||||
VertexIds id;
|
||||
id.GeoId = (int)i;
|
||||
id.PosId = Sketcher::start;
|
||||
id.PosId = Sketcher::PointPos::start;
|
||||
id.v = segm->getStartPoint();
|
||||
vertexIds.push_back(id);
|
||||
id.GeoId = (int)i;
|
||||
id.PosId = Sketcher::end;
|
||||
id.PosId = Sketcher::PointPos::end;
|
||||
id.v = segm->getEndPoint();
|
||||
vertexIds.push_back(id);
|
||||
}
|
||||
@@ -166,11 +166,11 @@ int SketchAnalysis::detectMissingPointOnPointConstraints(double precision, bool
|
||||
const Part::GeomArcOfCircle *segm = static_cast<const Part::GeomArcOfCircle*>(gf->getGeometry());
|
||||
VertexIds id;
|
||||
id.GeoId = (int)i;
|
||||
id.PosId = Sketcher::start;
|
||||
id.PosId = Sketcher::PointPos::start;
|
||||
id.v = segm->getStartPoint(/*emulateCCW=*/true);
|
||||
vertexIds.push_back(id);
|
||||
id.GeoId = (int)i;
|
||||
id.PosId = Sketcher::end;
|
||||
id.PosId = Sketcher::PointPos::end;
|
||||
id.v = segm->getEndPoint(/*emulateCCW=*/true);
|
||||
vertexIds.push_back(id);
|
||||
}
|
||||
@@ -178,11 +178,11 @@ int SketchAnalysis::detectMissingPointOnPointConstraints(double precision, bool
|
||||
const Part::GeomArcOfEllipse *segm = static_cast<const Part::GeomArcOfEllipse*>(gf->getGeometry());
|
||||
VertexIds id;
|
||||
id.GeoId = (int)i;
|
||||
id.PosId = Sketcher::start;
|
||||
id.PosId = Sketcher::PointPos::start;
|
||||
id.v = segm->getStartPoint(/*emulateCCW=*/true);
|
||||
vertexIds.push_back(id);
|
||||
id.GeoId = (int)i;
|
||||
id.PosId = Sketcher::end;
|
||||
id.PosId = Sketcher::PointPos::end;
|
||||
id.v = segm->getEndPoint(/*emulateCCW=*/true);
|
||||
vertexIds.push_back(id);
|
||||
}
|
||||
@@ -190,11 +190,11 @@ int SketchAnalysis::detectMissingPointOnPointConstraints(double precision, bool
|
||||
const Part::GeomArcOfHyperbola *segm = static_cast<const Part::GeomArcOfHyperbola*>(gf->getGeometry());
|
||||
VertexIds id;
|
||||
id.GeoId = (int)i;
|
||||
id.PosId = Sketcher::start;
|
||||
id.PosId = Sketcher::PointPos::start;
|
||||
id.v = segm->getStartPoint();
|
||||
vertexIds.push_back(id);
|
||||
id.GeoId = (int)i;
|
||||
id.PosId = Sketcher::end;
|
||||
id.PosId = Sketcher::PointPos::end;
|
||||
id.v = segm->getEndPoint();
|
||||
vertexIds.push_back(id);
|
||||
}
|
||||
@@ -202,11 +202,11 @@ int SketchAnalysis::detectMissingPointOnPointConstraints(double precision, bool
|
||||
const Part::GeomArcOfParabola *segm = static_cast<const Part::GeomArcOfParabola*>(gf->getGeometry());
|
||||
VertexIds id;
|
||||
id.GeoId = (int)i;
|
||||
id.PosId = Sketcher::start;
|
||||
id.PosId = Sketcher::PointPos::start;
|
||||
id.v = segm->getStartPoint();
|
||||
vertexIds.push_back(id);
|
||||
id.GeoId = (int)i;
|
||||
id.PosId = Sketcher::end;
|
||||
id.PosId = Sketcher::PointPos::end;
|
||||
id.v = segm->getEndPoint();
|
||||
vertexIds.push_back(id);
|
||||
}
|
||||
@@ -214,11 +214,11 @@ int SketchAnalysis::detectMissingPointOnPointConstraints(double precision, bool
|
||||
const Part::GeomBSplineCurve *segm = static_cast<const Part::GeomBSplineCurve*>(gf->getGeometry());
|
||||
VertexIds id;
|
||||
id.GeoId = (int)i;
|
||||
id.PosId = Sketcher::start;
|
||||
id.PosId = Sketcher::PointPos::start;
|
||||
id.v = segm->getStartPoint();
|
||||
vertexIds.push_back(id);
|
||||
id.GeoId = (int)i;
|
||||
id.PosId = Sketcher::end;
|
||||
id.PosId = Sketcher::PointPos::end;
|
||||
id.v = segm->getEndPoint();
|
||||
vertexIds.push_back(id);
|
||||
}
|
||||
@@ -406,9 +406,9 @@ int SketchAnalysis::detectMissingVerticalHorizontalConstraints(double anglepreci
|
||||
|
||||
id.v = dir;
|
||||
id.First = (int)i;
|
||||
id.FirstPos = Sketcher::none;
|
||||
id.FirstPos = Sketcher::PointPos::none;
|
||||
id.Second = GeoEnum::GeoUndef;
|
||||
id.SecondPos = Sketcher::none;
|
||||
id.SecondPos = Sketcher::PointPos::none;
|
||||
|
||||
if( checkVertical(dir, angleprecision) ) {
|
||||
id.Type = Sketcher::Vertical;
|
||||
@@ -528,9 +528,9 @@ int SketchAnalysis::detectMissingEqualityConstraints(double precision)
|
||||
id.Type = Equal;
|
||||
id.v.x = vt->l;
|
||||
id.First = vt->GeoId;
|
||||
id.FirstPos = Sketcher::none;
|
||||
id.FirstPos = Sketcher::PointPos::none;
|
||||
id.Second = vn->GeoId;
|
||||
id.SecondPos = Sketcher::none;
|
||||
id.SecondPos = Sketcher::PointPos::none;
|
||||
equallines.push_back(id);
|
||||
}
|
||||
else {
|
||||
@@ -558,9 +558,9 @@ int SketchAnalysis::detectMissingEqualityConstraints(double precision)
|
||||
id.Type = Equal;
|
||||
id.v.x = vt->l;
|
||||
id.First = vt->GeoId;
|
||||
id.FirstPos = Sketcher::none;
|
||||
id.FirstPos = Sketcher::PointPos::none;
|
||||
id.Second = vn->GeoId;
|
||||
id.SecondPos = Sketcher::none;
|
||||
id.SecondPos = Sketcher::PointPos::none;
|
||||
equalradius.push_back(id);
|
||||
}
|
||||
else {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -281,12 +281,12 @@ public:
|
||||
/// trim a curve
|
||||
int trim(int geoId, const Base::Vector3d& point);
|
||||
/// extend a curve
|
||||
int extend(int geoId, double increment, int endPoint);
|
||||
int extend(int geoId, double increment, PointPos endPoint);
|
||||
/// split a curve
|
||||
int split(int geoId, const Base::Vector3d &point);
|
||||
|
||||
/// adds symmetric geometric elements with respect to the refGeoId (line or point)
|
||||
int addSymmetric(const std::vector<int> &geoIdList, int refGeoId, Sketcher::PointPos refPosId=Sketcher::none);
|
||||
int addSymmetric(const std::vector<int> &geoIdList, int refGeoId, Sketcher::PointPos refPosId=Sketcher::PointPos::none);
|
||||
/// with default parameters adds a copy of the geometric elements displaced by the displacement vector.
|
||||
/// It creates an array of csize elements in the direction of the displacement vector by rsize elements in the
|
||||
/// direction perpendicular to the displacement vector, wherein the modulus of this perpendicular vector is scaled by perpscale.
|
||||
@@ -595,18 +595,18 @@ protected:
|
||||
int firstGeoId,
|
||||
Sketcher::PointPos firstPos,
|
||||
int secondGeoId = GeoEnum::GeoUndef,
|
||||
Sketcher::PointPos secondPos = Sketcher::none,
|
||||
Sketcher::PointPos secondPos = Sketcher::PointPos::none,
|
||||
int thirdGeoId = GeoEnum::GeoUndef,
|
||||
Sketcher::PointPos thirdPos = Sketcher::none);
|
||||
Sketcher::PointPos thirdPos = Sketcher::PointPos::none);
|
||||
|
||||
// creates a new constraint
|
||||
std::unique_ptr<Constraint> createConstraint( Sketcher::ConstraintType constrType,
|
||||
int firstGeoId,
|
||||
Sketcher::PointPos firstPos,
|
||||
int secondGeoId = GeoEnum::GeoUndef,
|
||||
Sketcher::PointPos secondPos = Sketcher::none,
|
||||
Sketcher::PointPos secondPos = Sketcher::PointPos::none,
|
||||
int thirdGeoId = GeoEnum::GeoUndef,
|
||||
Sketcher::PointPos thirdPos = Sketcher::none);
|
||||
Sketcher::PointPos thirdPos = Sketcher::PointPos::none);
|
||||
|
||||
private:
|
||||
/// Flag to allow external geometry from other bodies than the one this sketch belongs to
|
||||
|
||||
@@ -570,7 +570,7 @@ PyObject* SketchObjectPy::delConstraintOnPoint(PyObject *args)
|
||||
if (!PyArg_ParseTuple(args, "i|i", &Index, &pos))
|
||||
return 0;
|
||||
|
||||
if (pos>=Sketcher::none && pos<=Sketcher::mid) { // This is the whole range of valid positions
|
||||
if (pos >= static_cast<int>(Sketcher::PointPos::none) && pos <= static_cast<int>(Sketcher::PointPos::mid)) { // This is the whole range of valid positions
|
||||
if (this->getSketchObjectPtr()->delConstraintOnPoint(Index,(Sketcher::PointPos)pos)) {
|
||||
std::stringstream str;
|
||||
str << "Not able to delete a constraint on point with the given index: " << Index
|
||||
@@ -1030,7 +1030,7 @@ PyObject* SketchObjectPy::getGeoVertexIndex(PyObject *args)
|
||||
obj->getGeoVertexIndex(index, geoId, posId);
|
||||
Py::Tuple tuple(2);
|
||||
tuple.setItem(0, Py::Long(geoId));
|
||||
tuple.setItem(1, Py::Long(posId));
|
||||
tuple.setItem(1, Py::Long(static_cast<int>(posId)));
|
||||
return Py::new_reference_to(tuple);
|
||||
}
|
||||
|
||||
@@ -1136,7 +1136,7 @@ PyObject* SketchObjectPy::extend(PyObject *args)
|
||||
int GeoId;
|
||||
|
||||
if (PyArg_ParseTuple(args, "idi", &GeoId, &increment, &endPoint)) {
|
||||
if (this->getSketchObjectPtr()->extend(GeoId, increment, endPoint)) {
|
||||
if (this->getSketchObjectPtr()->extend(GeoId, increment, static_cast<Sketcher::PointPos>(endPoint))) {
|
||||
std::stringstream str;
|
||||
str << "Not able to extend geometry with id : (" << GeoId << ") for increment (" << increment << ") and point position (" << endPoint << ")";
|
||||
PyErr_SetString(PyExc_ValueError, str.str().c_str());
|
||||
@@ -1173,7 +1173,7 @@ PyObject* SketchObjectPy::addSymmetric(PyObject *args)
|
||||
{
|
||||
PyObject *pcObj;
|
||||
int refGeoId;
|
||||
int refPosId = Sketcher::none;
|
||||
int refPosId = static_cast<int>(Sketcher::PointPos::none);
|
||||
|
||||
if (!PyArg_ParseTuple(args, "Oi|i", &pcObj, &refGeoId, &refPosId))
|
||||
return 0;
|
||||
@@ -1671,9 +1671,9 @@ Py::List SketchObjectPy::getMissingPointOnPointConstraints(void) const
|
||||
for (auto c : constraints) {
|
||||
Py::Tuple t(5);
|
||||
t.setItem(0, Py::Long(c.First));
|
||||
t.setItem(1, Py::Long(((c.FirstPos == Sketcher::none)?0:(c.FirstPos == Sketcher::start)?1:(c.FirstPos == Sketcher::end)?2:3)));
|
||||
t.setItem(1, Py::Long(((c.FirstPos == Sketcher::PointPos::none)?0:(c.FirstPos == Sketcher::PointPos::start)?1:(c.FirstPos == Sketcher::PointPos::end)?2:3)));
|
||||
t.setItem(2, Py::Long(c.Second));
|
||||
t.setItem(3, Py::Long(((c.SecondPos == Sketcher::none)?0:(c.SecondPos == Sketcher::start)?1:(c.SecondPos == Sketcher::end)?2:3)));
|
||||
t.setItem(3, Py::Long(((c.SecondPos == Sketcher::PointPos::none)?0:(c.SecondPos == Sketcher::PointPos::start)?1:(c.SecondPos == Sketcher::PointPos::end)?2:3)));
|
||||
t.setItem(4, Py::Long(c.Type));
|
||||
list.append(t);
|
||||
}
|
||||
@@ -1686,7 +1686,7 @@ void SketchObjectPy::setMissingPointOnPointConstraints(Py::List arg)
|
||||
|
||||
auto checkpos = [](Py::Tuple &t,int i) {
|
||||
auto checkitem = [](Py::Tuple &t,int i, int val) {return long(Py::Long(t.getItem(i)))==val;};
|
||||
return (checkitem(t,i,0)?Sketcher::none:(checkitem(t,i,1)?Sketcher::start:(checkitem(t,i,2)?Sketcher::end:Sketcher::mid)));
|
||||
return (checkitem(t,i,0)?Sketcher::PointPos::none:(checkitem(t,i,1)?Sketcher::PointPos::start:(checkitem(t,i,2)?Sketcher::PointPos::end:Sketcher::PointPos::mid)));
|
||||
};
|
||||
|
||||
for (auto ti : arg) {
|
||||
@@ -1712,9 +1712,9 @@ Py::List SketchObjectPy::getMissingVerticalHorizontalConstraints(void) const
|
||||
for (auto c : constraints) {
|
||||
Py::Tuple t(5);
|
||||
t.setItem(0, Py::Long(c.First));
|
||||
t.setItem(1, Py::Long(((c.FirstPos == Sketcher::none)?0:(c.FirstPos == Sketcher::start)?1:(c.FirstPos == Sketcher::end)?2:3)));
|
||||
t.setItem(1, Py::Long(((c.FirstPos == Sketcher::PointPos::none)?0:(c.FirstPos == Sketcher::PointPos::start)?1:(c.FirstPos == Sketcher::PointPos::end)?2:3)));
|
||||
t.setItem(2, Py::Long(c.Second));
|
||||
t.setItem(3, Py::Long(((c.SecondPos == Sketcher::none)?0:(c.SecondPos == Sketcher::start)?1:(c.SecondPos == Sketcher::end)?2:3)));
|
||||
t.setItem(3, Py::Long(((c.SecondPos == Sketcher::PointPos::none)?0:(c.SecondPos == Sketcher::PointPos::start)?1:(c.SecondPos == Sketcher::PointPos::end)?2:3)));
|
||||
t.setItem(4, Py::Long(c.Type));
|
||||
list.append(t);
|
||||
}
|
||||
@@ -1727,7 +1727,7 @@ void SketchObjectPy::setMissingVerticalHorizontalConstraints(Py::List arg)
|
||||
|
||||
auto checkpos = [](Py::Tuple &t,int i) {
|
||||
auto checkitem = [](Py::Tuple &t,int i, int val) {return long(Py::Long(t.getItem(i)))==val;};
|
||||
return (checkitem(t,i,0)?Sketcher::none:(checkitem(t,i,1)?Sketcher::start:(checkitem(t,i,2)?Sketcher::end:Sketcher::mid)));
|
||||
return (checkitem(t,i,0)?Sketcher::PointPos::none:(checkitem(t,i,1)?Sketcher::PointPos::start:(checkitem(t,i,2)?Sketcher::PointPos::end:Sketcher::PointPos::mid)));
|
||||
};
|
||||
|
||||
for (auto ti : arg) {
|
||||
@@ -1753,9 +1753,9 @@ Py::List SketchObjectPy::getMissingLineEqualityConstraints(void) const
|
||||
for (auto c : constraints) {
|
||||
Py::Tuple t(4);
|
||||
t.setItem(0, Py::Long(c.First));
|
||||
t.setItem(1, Py::Long(((c.FirstPos == Sketcher::none)?0:(c.FirstPos == Sketcher::start)?1:(c.FirstPos == Sketcher::end)?2:3)));
|
||||
t.setItem(1, Py::Long(((c.FirstPos == Sketcher::PointPos::none)?0:(c.FirstPos == Sketcher::PointPos::start)?1:(c.FirstPos == Sketcher::PointPos::end)?2:3)));
|
||||
t.setItem(2, Py::Long(c.Second));
|
||||
t.setItem(3, Py::Long(((c.SecondPos == Sketcher::none)?0:(c.SecondPos == Sketcher::start)?1:(c.SecondPos == Sketcher::end)?2:3)));
|
||||
t.setItem(3, Py::Long(((c.SecondPos == Sketcher::PointPos::none)?0:(c.SecondPos == Sketcher::PointPos::start)?1:(c.SecondPos == Sketcher::PointPos::end)?2:3)));
|
||||
list.append(t);
|
||||
}
|
||||
return list;
|
||||
@@ -1767,7 +1767,7 @@ void SketchObjectPy::setMissingLineEqualityConstraints(Py::List arg)
|
||||
|
||||
auto checkpos = [](Py::Tuple &t,int i) {
|
||||
auto checkitem = [](Py::Tuple &t,int i, int val) {return long(Py::Long(t.getItem(i)))==val;};
|
||||
return (checkitem(t,i,0)?Sketcher::none:(checkitem(t,i,1)?Sketcher::start:(checkitem(t,i,2)?Sketcher::end:Sketcher::mid)));
|
||||
return (checkitem(t,i,0)?Sketcher::PointPos::none:(checkitem(t,i,1)?Sketcher::PointPos::start:(checkitem(t,i,2)?Sketcher::PointPos::end:Sketcher::PointPos::mid)));
|
||||
};
|
||||
|
||||
for (auto ti : arg) {
|
||||
@@ -1793,9 +1793,9 @@ Py::List SketchObjectPy::getMissingRadiusConstraints(void) const
|
||||
for (auto c : constraints) {
|
||||
Py::Tuple t(4);
|
||||
t.setItem(0, Py::Long(c.First));
|
||||
t.setItem(1, Py::Long(((c.FirstPos == Sketcher::none)?0:(c.FirstPos == Sketcher::start)?1:(c.FirstPos == Sketcher::end)?2:3)));
|
||||
t.setItem(1, Py::Long(((c.FirstPos == Sketcher::PointPos::none)?0:(c.FirstPos == Sketcher::PointPos::start)?1:(c.FirstPos == Sketcher::PointPos::end)?2:3)));
|
||||
t.setItem(2, Py::Long(c.Second));
|
||||
t.setItem(3, Py::Long(((c.SecondPos == Sketcher::none)?0:(c.SecondPos == Sketcher::start)?1:(c.SecondPos == Sketcher::end)?2:3)));
|
||||
t.setItem(3, Py::Long(((c.SecondPos == Sketcher::PointPos::none)?0:(c.SecondPos == Sketcher::PointPos::start)?1:(c.SecondPos == Sketcher::PointPos::end)?2:3)));
|
||||
list.append(t);
|
||||
}
|
||||
return list;
|
||||
@@ -1807,7 +1807,7 @@ void SketchObjectPy::setMissingRadiusConstraints(Py::List arg)
|
||||
|
||||
auto checkpos = [](Py::Tuple &t,int i) {
|
||||
auto checkitem = [](Py::Tuple &t,int i, int val) {return long(Py::Long(t.getItem(i)))==val;};
|
||||
return (checkitem(t,i,0)?Sketcher::none:(checkitem(t,i,1)?Sketcher::start:(checkitem(t,i,2)?Sketcher::end:Sketcher::mid)));
|
||||
return (checkitem(t,i,0)?Sketcher::PointPos::none:(checkitem(t,i,1)?Sketcher::PointPos::start:(checkitem(t,i,2)?Sketcher::PointPos::end:Sketcher::PointPos::mid)));
|
||||
};
|
||||
|
||||
for (auto ti : arg) {
|
||||
@@ -1838,7 +1838,7 @@ PyObject* SketchObjectPy::getGeometryWithDependentParameters(PyObject *args)
|
||||
for (auto pair : geometrymap) {
|
||||
Py::Tuple t(2);
|
||||
t.setItem(0, Py::Long(pair.first));
|
||||
t.setItem(1, Py::Long(((pair.second == Sketcher::none)?0:(pair.second == Sketcher::start)?1:(pair.second == Sketcher::end)?2:3)));
|
||||
t.setItem(1, Py::Long(((pair.second == Sketcher::PointPos::none)?0:(pair.second == Sketcher::PointPos::start)?1:(pair.second == Sketcher::PointPos::end)?2:3)));
|
||||
list.append(t);
|
||||
}
|
||||
return Py::new_reference_to(list);
|
||||
|
||||
@@ -777,7 +777,7 @@ void CmdSketcherMirrorSketch::activated(int iMsg)
|
||||
}
|
||||
|
||||
int refgeoid = -1;
|
||||
Sketcher::PointPos refposid = Sketcher::none;
|
||||
Sketcher::PointPos refposid = Sketcher::PointPos::none;
|
||||
// Ask the user the type of mirroring
|
||||
SketchMirrorDialog smd;
|
||||
if (smd.exec() != QDialog::Accepted)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -195,17 +195,17 @@ void removeRedundantHorizontalVertical(Sketcher::SketchObject* psketch,
|
||||
geoId1iterator = coincidents.find(-1);
|
||||
|
||||
if( geoId1iterator != coincidents.end()) {
|
||||
if( (*geoId1iterator).second == Sketcher::start )
|
||||
if( (*geoId1iterator).second == Sketcher::PointPos::start )
|
||||
orig = true;
|
||||
}
|
||||
}
|
||||
else { // it may be that there is no constraint at all, but there is external geometry
|
||||
ext = (*it).GeoId < 0;
|
||||
orig = ((*it).GeoId == -1 && (*it).PosId == Sketcher::start);
|
||||
orig = ((*it).GeoId == -1 && (*it).PosId == Sketcher::PointPos::start);
|
||||
}
|
||||
}
|
||||
else if( (*it).Type == Sketcher::PointOnObject && axis == false) {
|
||||
axis = (((*it).GeoId == -1 && (*it).PosId == Sketcher::none) || ((*it).GeoId == -2 && (*it).PosId == Sketcher::none));
|
||||
axis = (((*it).GeoId == -1 && (*it).PosId == Sketcher::PointPos::none) || ((*it).GeoId == -2 && (*it).PosId == Sketcher::PointPos::none));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -340,13 +340,13 @@ public:
|
||||
|
||||
// add auto constraints for the line segment start
|
||||
if (!sugConstr1.empty()) {
|
||||
createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::start);
|
||||
createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::PointPos::start);
|
||||
sugConstr1.clear();
|
||||
}
|
||||
|
||||
// add auto constraints for the line segment end
|
||||
if (!sugConstr2.empty()) {
|
||||
createAutoConstraints(sugConstr2, getHighestCurveIndex(), Sketcher::end);
|
||||
createAutoConstraints(sugConstr2, getHighestCurveIndex(), Sketcher::PointPos::end);
|
||||
sugConstr2.clear();
|
||||
}
|
||||
|
||||
@@ -626,13 +626,13 @@ public:
|
||||
if(constructionMethod == Diagonal) {
|
||||
// add auto constraints at the start of the first side
|
||||
if (sugConstr1.size() > 0) {
|
||||
createAutoConstraints(sugConstr1, getHighestCurveIndex() - 3 , Sketcher::start);
|
||||
createAutoConstraints(sugConstr1, getHighestCurveIndex() - 3 , Sketcher::PointPos::start);
|
||||
sugConstr1.clear();
|
||||
}
|
||||
|
||||
// add auto constraints at the end of the second side
|
||||
if (sugConstr2.size() > 0) {
|
||||
createAutoConstraints(sugConstr2, getHighestCurveIndex() - 2, Sketcher::end);
|
||||
createAutoConstraints(sugConstr2, getHighestCurveIndex() - 2, Sketcher::PointPos::end);
|
||||
sugConstr2.clear();
|
||||
}
|
||||
|
||||
@@ -640,13 +640,13 @@ public:
|
||||
else if (constructionMethod == CenterAndCorner) {
|
||||
// add auto constraints at the start of the first side
|
||||
if (sugConstr1.size() > 0) {
|
||||
createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::start);
|
||||
createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::PointPos::start);
|
||||
sugConstr1.clear();
|
||||
}
|
||||
|
||||
// add auto constraints at the end of the second side
|
||||
if (sugConstr2.size() > 0) {
|
||||
createAutoConstraints(sugConstr2, getHighestCurveIndex() - 3, Sketcher::end);
|
||||
createAutoConstraints(sugConstr2, getHighestCurveIndex() - 3, Sketcher::PointPos::end);
|
||||
sugConstr2.clear();
|
||||
}
|
||||
}
|
||||
@@ -1002,13 +1002,13 @@ public:
|
||||
|
||||
// add auto constraints at the StartPos auxiliary point
|
||||
if (sugConstr1.size() > 0) {
|
||||
createAutoConstraints(sugConstr1, getHighestCurveIndex() - 1, Sketcher::start);
|
||||
createAutoConstraints(sugConstr1, getHighestCurveIndex() - 1, Sketcher::PointPos::start);
|
||||
sugConstr1.clear();
|
||||
}
|
||||
|
||||
// add auto constraints at the EndPos auxiliary point
|
||||
if (sugConstr2.size() > 0) {
|
||||
createAutoConstraints(sugConstr2, getHighestCurveIndex(), Sketcher::start);
|
||||
createAutoConstraints(sugConstr2, getHighestCurveIndex(), Sketcher::PointPos::start);
|
||||
sugConstr2.clear();
|
||||
}
|
||||
|
||||
@@ -1215,8 +1215,8 @@ public:
|
||||
, EditCurve(2)
|
||||
, firstCurve(-1)
|
||||
, previousCurve(-1)
|
||||
, firstPosId(Sketcher::none)
|
||||
, previousPosId(Sketcher::none)
|
||||
, firstPosId(Sketcher::PointPos::none)
|
||||
, previousPosId(Sketcher::PointPos::none)
|
||||
, startAngle(0)
|
||||
, endAngle(0)
|
||||
, arcRadius(0)
|
||||
@@ -1478,8 +1478,8 @@ public:
|
||||
const Part::Geometry *geom = sketchgui->getSketchObject()->getGeometry(sugConstr1[i].GeoId);
|
||||
if ((geom->getTypeId() == Part::GeomLineSegment::getClassTypeId() ||
|
||||
geom->getTypeId() == Part::GeomArcOfCircle::getClassTypeId()) &&
|
||||
(sugConstr1[i].PosId == Sketcher::start ||
|
||||
sugConstr1[i].PosId == Sketcher::end)) {
|
||||
(sugConstr1[i].PosId == Sketcher::PointPos::start ||
|
||||
sugConstr1[i].PosId == Sketcher::PointPos::end)) {
|
||||
previousCurve = sugConstr1[i].GeoId;
|
||||
previousPosId = sugConstr1[i].PosId;
|
||||
updateTransitionData(previousCurve,previousPosId); // -> dirVec, EditCurve[0]
|
||||
@@ -1494,7 +1494,7 @@ public:
|
||||
|
||||
// remember our first point (even if we are doing a transition from a previous curve)
|
||||
firstCurve = getHighestCurveIndex() + 1;
|
||||
firstPosId = Sketcher::start;
|
||||
firstPosId = Sketcher::PointPos::start;
|
||||
|
||||
if (SegmentMode == SEGMENT_MODE_Line)
|
||||
EditCurve.resize(TransitionMode == TRANSITION_MODE_Free ? 2 : 3);
|
||||
@@ -1522,8 +1522,8 @@ public:
|
||||
suppressTransition=false;
|
||||
firstCurve=-1;
|
||||
previousCurve=-1;
|
||||
firstPosId=Sketcher::none;
|
||||
previousPosId=Sketcher::none;
|
||||
firstPosId=Sketcher::PointPos::none;
|
||||
previousPosId=Sketcher::PointPos::none;
|
||||
EditCurve.clear();
|
||||
sketchgui->drawEdit(EditCurve);
|
||||
EditCurve.resize(2);
|
||||
@@ -1541,16 +1541,17 @@ public:
|
||||
}
|
||||
|
||||
Mode = STATUS_Do;
|
||||
if (sketchgui->getPreselectPoint() != -1 && firstPosId != Sketcher::none) {
|
||||
|
||||
if (sketchgui->getPreselectPoint() != -1 && firstPosId != Sketcher::PointPos::none) {
|
||||
int GeoId;
|
||||
Sketcher::PointPos PosId;
|
||||
sketchgui->getSketchObject()->getGeoVertexIndex(sketchgui->getPreselectPoint(),GeoId,PosId);
|
||||
if (sketchgui->getSketchObject()->arePointsCoincident(GeoId,PosId,firstCurve,firstPosId))
|
||||
Mode = STATUS_Close;
|
||||
}
|
||||
else if (sketchgui->getPreselectCross() == 0 && firstPosId != Sketcher::none) {
|
||||
else if (sketchgui->getPreselectCross() == 0 && firstPosId != Sketcher::PointPos::none) {
|
||||
// close line started at root point
|
||||
if (sketchgui->getSketchObject()->arePointsCoincident(-1,Sketcher::start,firstCurve,firstPosId))
|
||||
if (sketchgui->getSketchObject()->arePointsCoincident(-1,Sketcher::PointPos::start,firstCurve,firstPosId))
|
||||
Mode = STATUS_Close;
|
||||
}
|
||||
}
|
||||
@@ -1603,11 +1604,11 @@ public:
|
||||
|
||||
int lastCurve = getHighestCurveIndex();
|
||||
// issue the constraint
|
||||
if (addedGeometry && (previousPosId != Sketcher::none)) {
|
||||
if (addedGeometry && (previousPosId != Sketcher::PointPos::none)) {
|
||||
Sketcher::PointPos lastStartPosId = (SegmentMode == SEGMENT_MODE_Arc && startAngle > endAngle) ?
|
||||
Sketcher::end : Sketcher::start;
|
||||
Sketcher::PointPos::end : Sketcher::PointPos::start;
|
||||
Sketcher::PointPos lastEndPosId = (SegmentMode == SEGMENT_MODE_Arc && startAngle > endAngle) ?
|
||||
Sketcher::start : Sketcher::end;
|
||||
Sketcher::PointPos::start : Sketcher::PointPos::end;
|
||||
// in case of a tangency constraint, the coincident constraint is redundant
|
||||
std::string constrType = "Coincident";
|
||||
if (!suppressTransition && previousCurve != -1) {
|
||||
@@ -1618,7 +1619,7 @@ public:
|
||||
constrType = "Perpendicular";
|
||||
}
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addConstraint(Sketcher.Constraint('%s',%i,%i,%i,%i)) ",
|
||||
constrType.c_str(), previousCurve, previousPosId, lastCurve, lastStartPosId);
|
||||
constrType.c_str(), previousCurve, static_cast<int>(previousPosId), lastCurve, static_cast<int>(lastStartPosId));
|
||||
|
||||
if(SnapMode == SNAP_MODE_45Degree && Mode != STATUS_Close) {
|
||||
// -360, -315, -270, -225, -180, -135, -90, -45, 0, 45, 90, 135, 180, 225, 270, 315, 360
|
||||
@@ -1633,7 +1634,7 @@ public:
|
||||
if (Mode == STATUS_Close) {
|
||||
// close the loop by constrain to the first curve point
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addConstraint(Sketcher.Constraint('Coincident',%i,%i,%i,%i)) ",
|
||||
lastCurve,lastEndPosId,firstCurve,firstPosId);
|
||||
lastCurve,static_cast<int>(lastEndPosId),firstCurve,static_cast<int>(firstPosId));
|
||||
}
|
||||
Gui::Command::commitCommand();
|
||||
|
||||
@@ -1661,7 +1662,7 @@ public:
|
||||
if (sugConstr2[i].Type != Sketcher::Coincident)
|
||||
sugConstr.push_back(sugConstr2[i]);
|
||||
}
|
||||
createAutoConstraints(sugConstr, getHighestCurveIndex(), Sketcher::end);
|
||||
createAutoConstraints(sugConstr, getHighestCurveIndex(), Sketcher::PointPos::end);
|
||||
sugConstr2.clear();
|
||||
}
|
||||
|
||||
@@ -1685,8 +1686,8 @@ public:
|
||||
suppressTransition=false;
|
||||
firstCurve=-1;
|
||||
previousCurve=-1;
|
||||
firstPosId=Sketcher::none;
|
||||
previousPosId=Sketcher::none;
|
||||
firstPosId=Sketcher::PointPos::none;
|
||||
previousPosId=Sketcher::PointPos::none;
|
||||
EditCurve.clear();
|
||||
sketchgui->drawEdit(EditCurve);
|
||||
EditCurve.resize(2);
|
||||
@@ -1705,7 +1706,7 @@ public:
|
||||
|
||||
// Add auto constraints
|
||||
if (sugConstr1.size() > 0) { // this is relevant only to the very first point
|
||||
createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::start);
|
||||
createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::PointPos::start);
|
||||
sugConstr1.clear();
|
||||
}
|
||||
|
||||
@@ -1724,7 +1725,7 @@ public:
|
||||
if (sugConstr2.size() > 0) {
|
||||
createAutoConstraints(sugConstr2, getHighestCurveIndex(),
|
||||
(SegmentMode == SEGMENT_MODE_Arc && startAngle > endAngle) ?
|
||||
Sketcher::start : Sketcher::end);
|
||||
Sketcher::PointPos::start : Sketcher::PointPos::end);
|
||||
sugConstr2.clear();
|
||||
}
|
||||
|
||||
@@ -1733,7 +1734,7 @@ public:
|
||||
// remember the vertex for the next rounds constraint..
|
||||
previousCurve = getHighestCurveIndex();
|
||||
previousPosId = (SegmentMode == SEGMENT_MODE_Arc && startAngle > endAngle) ?
|
||||
Sketcher::start : Sketcher::end; // cw arcs are rendered in reverse
|
||||
Sketcher::PointPos::start : Sketcher::PointPos::end; // cw arcs are rendered in reverse
|
||||
|
||||
// setup for the next line segment
|
||||
// calculate dirVec and EditCurve[0]
|
||||
@@ -1785,8 +1786,8 @@ public:
|
||||
suppressTransition=false;
|
||||
firstCurve=-1;
|
||||
previousCurve=-1;
|
||||
firstPosId=Sketcher::none;
|
||||
previousPosId=Sketcher::none;
|
||||
firstPosId=Sketcher::PointPos::none;
|
||||
previousPosId=Sketcher::PointPos::none;
|
||||
firstsegment=true;
|
||||
EditCurve.clear();
|
||||
sketchgui->drawEdit(EditCurve);
|
||||
@@ -1826,7 +1827,7 @@ protected:
|
||||
dirVec.Set(lineSeg->getEndPoint().x - lineSeg->getStartPoint().x,
|
||||
lineSeg->getEndPoint().y - lineSeg->getStartPoint().y,
|
||||
0.f);
|
||||
if (PosId == Sketcher::start) {
|
||||
if (PosId == Sketcher::PointPos::start) {
|
||||
dirVec *= -1;
|
||||
EditCurve[0] = Base::Vector2d(lineSeg->getStartPoint().x, lineSeg->getStartPoint().y);
|
||||
}
|
||||
@@ -1835,7 +1836,7 @@ protected:
|
||||
}
|
||||
else if (geom->getTypeId() == Part::GeomArcOfCircle::getClassTypeId()) {
|
||||
const Part::GeomArcOfCircle *arcSeg = static_cast<const Part::GeomArcOfCircle *>(geom);
|
||||
if (PosId == Sketcher::start) {
|
||||
if (PosId == Sketcher::PointPos::start) {
|
||||
EditCurve[0] = Base::Vector2d(arcSeg->getStartPoint(/*emulateCCW=*/true).x,arcSeg->getStartPoint(/*emulateCCW=*/true).y);
|
||||
dirVec = Base::Vector3d(0.f,0.f,-1.0) % (arcSeg->getStartPoint(/*emulateCCW=*/true)-arcSeg->getCenter());
|
||||
}
|
||||
@@ -2045,19 +2046,19 @@ public:
|
||||
|
||||
// Auto Constraint center point
|
||||
if (sugConstr1.size() > 0) {
|
||||
createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::mid);
|
||||
createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::PointPos::mid);
|
||||
sugConstr1.clear();
|
||||
}
|
||||
|
||||
// Auto Constraint first picked point
|
||||
if (sugConstr2.size() > 0) {
|
||||
createAutoConstraints(sugConstr2, getHighestCurveIndex(), (arcAngle > 0) ? Sketcher::start : Sketcher::end );
|
||||
createAutoConstraints(sugConstr2, getHighestCurveIndex(), (arcAngle > 0) ? Sketcher::PointPos::start : Sketcher::PointPos::end );
|
||||
sugConstr2.clear();
|
||||
}
|
||||
|
||||
// Auto Constraint second picked point
|
||||
if (sugConstr3.size() > 0) {
|
||||
createAutoConstraints(sugConstr3, getHighestCurveIndex(), (arcAngle > 0) ? Sketcher::end : Sketcher::start);
|
||||
createAutoConstraints(sugConstr3, getHighestCurveIndex(), (arcAngle > 0) ? Sketcher::PointPos::end : Sketcher::PointPos::start);
|
||||
sugConstr3.clear();
|
||||
}
|
||||
|
||||
@@ -2129,8 +2130,8 @@ public:
|
||||
: Mode(STATUS_SEEK_First), EditCurve(2)
|
||||
, radius(0), startAngle(0)
|
||||
, endAngle(0), arcAngle(0)
|
||||
, arcPos1(Sketcher::none)
|
||||
, arcPos2(Sketcher::none)
|
||||
, arcPos1(Sketcher::PointPos::none)
|
||||
, arcPos2(Sketcher::PointPos::none)
|
||||
{
|
||||
}
|
||||
virtual ~DrawSketchHandler3PointArc(){}
|
||||
@@ -2205,14 +2206,14 @@ public:
|
||||
if (angle2 > angle1) {
|
||||
EditCurve[0] = FirstPoint;
|
||||
EditCurve[29] = SecondPoint;
|
||||
arcPos1 = Sketcher::start;
|
||||
arcPos2 = Sketcher::end;
|
||||
arcPos1 = Sketcher::PointPos::start;
|
||||
arcPos2 = Sketcher::PointPos::end;
|
||||
}
|
||||
else {
|
||||
EditCurve[0] = SecondPoint;
|
||||
EditCurve[29] = FirstPoint;
|
||||
arcPos1 = Sketcher::end;
|
||||
arcPos2 = Sketcher::start;
|
||||
arcPos1 = Sketcher::PointPos::end;
|
||||
arcPos2 = Sketcher::PointPos::start;
|
||||
}
|
||||
startAngle = min(angle1, angle2);
|
||||
endAngle = max(angle1, angle2);
|
||||
@@ -2223,14 +2224,14 @@ public:
|
||||
if (angle2 > angle1) {
|
||||
EditCurve[0] = SecondPoint;
|
||||
EditCurve[29] = FirstPoint;
|
||||
arcPos1 = Sketcher::end;
|
||||
arcPos2 = Sketcher::start;
|
||||
arcPos1 = Sketcher::PointPos::end;
|
||||
arcPos2 = Sketcher::PointPos::start;
|
||||
}
|
||||
else {
|
||||
EditCurve[0] = FirstPoint;
|
||||
EditCurve[29] = SecondPoint;
|
||||
arcPos1 = Sketcher::start;
|
||||
arcPos2 = Sketcher::end;
|
||||
arcPos1 = Sketcher::PointPos::start;
|
||||
arcPos2 = Sketcher::PointPos::end;
|
||||
}
|
||||
startAngle = max(angle1, angle2);
|
||||
endAngle = min(angle1, angle2);
|
||||
@@ -2327,7 +2328,7 @@ public:
|
||||
|
||||
// Auto Constraint third picked point
|
||||
if (sugConstr3.size() > 0) {
|
||||
createAutoConstraints(sugConstr3, getHighestCurveIndex(), Sketcher::none);
|
||||
createAutoConstraints(sugConstr3, getHighestCurveIndex(), Sketcher::PointPos::none);
|
||||
sugConstr3.clear();
|
||||
}
|
||||
|
||||
@@ -2585,13 +2586,13 @@ public:
|
||||
|
||||
// add auto constraints for the center point
|
||||
if (sugConstr1.size() > 0) {
|
||||
createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::mid);
|
||||
createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::PointPos::mid);
|
||||
sugConstr1.clear();
|
||||
}
|
||||
|
||||
// add suggested constraints for circumference
|
||||
if (sugConstr2.size() > 0) {
|
||||
createAutoConstraints(sugConstr2, getHighestCurveIndex(), Sketcher::none);
|
||||
createAutoConstraints(sugConstr2, getHighestCurveIndex(), Sketcher::PointPos::none);
|
||||
sugConstr2.clear();
|
||||
}
|
||||
|
||||
@@ -3355,30 +3356,30 @@ private:
|
||||
if (method == CENTER_PERIAPSIS_B) {
|
||||
// add auto constraints for the center point
|
||||
if (sugConstr1.size() > 0) {
|
||||
createAutoConstraints(sugConstr1, currentgeoid, Sketcher::mid);
|
||||
createAutoConstraints(sugConstr1, currentgeoid, Sketcher::PointPos::mid);
|
||||
sugConstr1.clear();
|
||||
}
|
||||
if (sugConstr2.size() > 0) {
|
||||
createAutoConstraints(sugConstr2, currentgeoid, Sketcher::none);
|
||||
createAutoConstraints(sugConstr2, currentgeoid, Sketcher::PointPos::none);
|
||||
sugConstr2.clear();
|
||||
}
|
||||
if (sugConstr3.size() > 0) {
|
||||
createAutoConstraints(sugConstr3, currentgeoid, Sketcher::none);
|
||||
createAutoConstraints(sugConstr3, currentgeoid, Sketcher::PointPos::none);
|
||||
sugConstr3.clear();
|
||||
}
|
||||
}
|
||||
|
||||
if (method == PERIAPSIS_APOAPSIS_B) {
|
||||
if (sugConstr1.size() > 0) {
|
||||
createAutoConstraints(sugConstr1, currentgeoid, Sketcher::none);
|
||||
createAutoConstraints(sugConstr1, currentgeoid, Sketcher::PointPos::none);
|
||||
sugConstr1.clear();
|
||||
}
|
||||
if (sugConstr2.size() > 0) {
|
||||
createAutoConstraints(sugConstr2, currentgeoid, Sketcher::none);
|
||||
createAutoConstraints(sugConstr2, currentgeoid, Sketcher::PointPos::none);
|
||||
sugConstr2.clear();
|
||||
}
|
||||
if (sugConstr3.size() > 0) {
|
||||
createAutoConstraints(sugConstr3, currentgeoid, Sketcher::none);
|
||||
createAutoConstraints(sugConstr3, currentgeoid, Sketcher::PointPos::none);
|
||||
sugConstr3.clear();
|
||||
}
|
||||
}
|
||||
@@ -3727,25 +3728,25 @@ public:
|
||||
|
||||
// add auto constraints for the center point
|
||||
if (sugConstr1.size() > 0) {
|
||||
createAutoConstraints(sugConstr1, currentgeoid, Sketcher::mid);
|
||||
createAutoConstraints(sugConstr1, currentgeoid, Sketcher::PointPos::mid);
|
||||
sugConstr1.clear();
|
||||
}
|
||||
|
||||
// add suggested constraints for arc
|
||||
if (sugConstr2.size() > 0) {
|
||||
createAutoConstraints(sugConstr2, currentgeoid, Sketcher::none);
|
||||
createAutoConstraints(sugConstr2, currentgeoid, Sketcher::PointPos::none);
|
||||
sugConstr2.clear();
|
||||
}
|
||||
|
||||
// add suggested constraints for start of arc
|
||||
if (sugConstr3.size() > 0) {
|
||||
createAutoConstraints(sugConstr3, currentgeoid, isOriginalArcCCW?Sketcher::start:Sketcher::end);
|
||||
createAutoConstraints(sugConstr3, currentgeoid, isOriginalArcCCW?Sketcher::PointPos::start:Sketcher::PointPos::end);
|
||||
sugConstr3.clear();
|
||||
}
|
||||
|
||||
// add suggested constraints for start of arc
|
||||
if (sugConstr4.size() > 0) {
|
||||
createAutoConstraints(sugConstr4, currentgeoid, isOriginalArcCCW?Sketcher::end:Sketcher::start);
|
||||
createAutoConstraints(sugConstr4, currentgeoid, isOriginalArcCCW?Sketcher::PointPos::end:Sketcher::PointPos::start);
|
||||
sugConstr4.clear();
|
||||
}
|
||||
|
||||
@@ -4069,25 +4070,25 @@ public:
|
||||
|
||||
// add auto constraints for the center point
|
||||
if (sugConstr1.size() > 0) {
|
||||
createAutoConstraints(sugConstr1, currentgeoid, Sketcher::mid);
|
||||
createAutoConstraints(sugConstr1, currentgeoid, Sketcher::PointPos::mid);
|
||||
sugConstr1.clear();
|
||||
}
|
||||
|
||||
// add suggested constraints for arc
|
||||
if (sugConstr2.size() > 0) {
|
||||
createAutoConstraints(sugConstr2, currentgeoid, Sketcher::none);
|
||||
createAutoConstraints(sugConstr2, currentgeoid, Sketcher::PointPos::none);
|
||||
sugConstr2.clear();
|
||||
}
|
||||
|
||||
// add suggested constraints for start of arc
|
||||
if (sugConstr3.size() > 0) {
|
||||
createAutoConstraints(sugConstr3, currentgeoid, isOriginalArcCCW?Sketcher::start:Sketcher::end);
|
||||
createAutoConstraints(sugConstr3, currentgeoid, isOriginalArcCCW?Sketcher::PointPos::start:Sketcher::PointPos::end);
|
||||
sugConstr3.clear();
|
||||
}
|
||||
|
||||
// add suggested constraints for start of arc
|
||||
if (sugConstr4.size() > 0) {
|
||||
createAutoConstraints(sugConstr4, currentgeoid, isOriginalArcCCW?Sketcher::end:Sketcher::start);
|
||||
createAutoConstraints(sugConstr4, currentgeoid, isOriginalArcCCW?Sketcher::PointPos::end:Sketcher::PointPos::start);
|
||||
sugConstr4.clear();
|
||||
}
|
||||
|
||||
@@ -4369,25 +4370,25 @@ public:
|
||||
|
||||
// add auto constraints for the focus point
|
||||
if (sugConstr1.size() > 0) {
|
||||
createAutoConstraints(sugConstr1, currentgeoid+1, Sketcher::start);
|
||||
createAutoConstraints(sugConstr1, currentgeoid+1, Sketcher::PointPos::start);
|
||||
sugConstr1.clear();
|
||||
}
|
||||
|
||||
// add suggested constraints for vertex point
|
||||
if (sugConstr2.size() > 0) {
|
||||
createAutoConstraints(sugConstr2, currentgeoid, Sketcher::mid);
|
||||
createAutoConstraints(sugConstr2, currentgeoid, Sketcher::PointPos::mid);
|
||||
sugConstr2.clear();
|
||||
}
|
||||
|
||||
// add suggested constraints for start of arc
|
||||
if (sugConstr3.size() > 0) {
|
||||
createAutoConstraints(sugConstr3, currentgeoid, isOriginalArcCCW?Sketcher::start:Sketcher::end);
|
||||
createAutoConstraints(sugConstr3, currentgeoid, isOriginalArcCCW?Sketcher::PointPos::start:Sketcher::PointPos::end);
|
||||
sugConstr3.clear();
|
||||
}
|
||||
|
||||
// add suggested constraints for start of arc
|
||||
if (sugConstr4.size() > 0) {
|
||||
createAutoConstraints(sugConstr4, currentgeoid, isOriginalArcCCW?Sketcher::end:Sketcher::start);
|
||||
createAutoConstraints(sugConstr4, currentgeoid, isOriginalArcCCW?Sketcher::PointPos::end:Sketcher::PointPos::start);
|
||||
sugConstr4.clear();
|
||||
}
|
||||
|
||||
@@ -4690,7 +4691,7 @@ public:
|
||||
|
||||
// add auto constraints on pole
|
||||
if (sugConstr[CurrentConstraint].size() > 0) {
|
||||
createAutoConstraints(sugConstr[CurrentConstraint], FirstPoleGeoId, Sketcher::mid, false);
|
||||
createAutoConstraints(sugConstr[CurrentConstraint], FirstPoleGeoId, Sketcher::PointPos::mid, false);
|
||||
}
|
||||
|
||||
static_cast<Sketcher::SketchObject *>(sketchgui->getObject())->solve();
|
||||
@@ -4705,7 +4706,7 @@ public:
|
||||
|
||||
// check if coincident with first pole
|
||||
for(std::vector<AutoConstraint>::const_iterator it = sugConstr[CurrentConstraint].begin(); it != sugConstr[CurrentConstraint].end(); it++) {
|
||||
if( (*it).Type == Sketcher::Coincident && (*it).GeoId == FirstPoleGeoId && (*it).PosId == Sketcher::mid ) {
|
||||
if( (*it).Type == Sketcher::Coincident && (*it).GeoId == FirstPoleGeoId && (*it).PosId == Sketcher::PointPos::mid ) {
|
||||
|
||||
IsClosed = true;
|
||||
}
|
||||
@@ -4756,7 +4757,7 @@ public:
|
||||
|
||||
// add auto constraints on pole
|
||||
if (sugConstr[CurrentConstraint].size() > 0) {
|
||||
createAutoConstraints(sugConstr[CurrentConstraint], FirstPoleGeoId + EditCurve.size()-1, Sketcher::mid, false);
|
||||
createAutoConstraints(sugConstr[CurrentConstraint], FirstPoleGeoId + EditCurve.size()-1, Sketcher::PointPos::mid, false);
|
||||
}
|
||||
|
||||
//static_cast<Sketcher::SketchObject *>(sketchgui->getObject())->solve();
|
||||
@@ -4825,13 +4826,13 @@ public:
|
||||
if (ConstrMethod == 0) {
|
||||
|
||||
for(auto & constr : static_cast<Sketcher::SketchObject *>(sketchgui->getObject())->Constraints.getValues()) {
|
||||
if(constr->First == FirstPoleGeoId && constr->FirstPos == Sketcher::mid) {
|
||||
if(constr->First == FirstPoleGeoId && constr->FirstPos == Sketcher::PointPos::mid) {
|
||||
constr->First = currentgeoid;
|
||||
constr->FirstPos = Sketcher::start;
|
||||
constr->FirstPos = Sketcher::PointPos::start;
|
||||
}
|
||||
else if(constr->First == (FirstPoleGeoId + CurrentConstraint - 1) && constr->FirstPos == Sketcher::mid) {
|
||||
else if(constr->First == (FirstPoleGeoId + CurrentConstraint - 1) && constr->FirstPos == Sketcher::PointPos::mid) {
|
||||
constr->First = currentgeoid;
|
||||
constr->FirstPos = Sketcher::end;
|
||||
constr->FirstPos = Sketcher::PointPos::end;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4843,7 +4844,7 @@ public:
|
||||
|
||||
for (size_t i = 0; i < EditCurve.size(); i++) {
|
||||
cstream << "conList.append(Sketcher.Constraint('InternalAlignment:Sketcher::BSplineControlPoint'," << FirstPoleGeoId+i
|
||||
<< "," << Sketcher::mid << "," << currentgeoid << "," << i << "))\n";
|
||||
<< "," << static_cast<int>(Sketcher::PointPos::mid) << "," << currentgeoid << "," << i << "))\n";
|
||||
}
|
||||
|
||||
cstream << Gui::Command::getObjectCmd(sketchgui->getObject()) << ".addConstraint(conList)\n";
|
||||
@@ -5272,19 +5273,19 @@ public:
|
||||
|
||||
// Auto Constraint first picked point
|
||||
if (sugConstr1.size() > 0) {
|
||||
createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::none);
|
||||
createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::PointPos::none);
|
||||
sugConstr1.clear();
|
||||
}
|
||||
|
||||
// Auto Constraint second picked point
|
||||
if (sugConstr2.size() > 0) {
|
||||
createAutoConstraints(sugConstr2, getHighestCurveIndex(), Sketcher::none);
|
||||
createAutoConstraints(sugConstr2, getHighestCurveIndex(), Sketcher::PointPos::none);
|
||||
sugConstr2.clear();
|
||||
}
|
||||
|
||||
// Auto Constraint third picked point
|
||||
if (sugConstr3.size() > 0) {
|
||||
createAutoConstraints(sugConstr3, getHighestCurveIndex(), Sketcher::none);
|
||||
createAutoConstraints(sugConstr3, getHighestCurveIndex(), Sketcher::PointPos::none);
|
||||
sugConstr3.clear();
|
||||
}
|
||||
|
||||
@@ -5497,7 +5498,7 @@ public:
|
||||
|
||||
// add auto constraints for the line segment start
|
||||
if (sugConstr.size() > 0) {
|
||||
createAutoConstraints(sugConstr, getHighestCurveIndex(), Sketcher::start);
|
||||
createAutoConstraints(sugConstr, getHighestCurveIndex(), Sketcher::PointPos::start);
|
||||
sugConstr.clear();
|
||||
}
|
||||
|
||||
@@ -5696,11 +5697,11 @@ public:
|
||||
int VtId = sketchgui->getPreselectPoint();
|
||||
if (Mode == STATUS_SEEK_First && VtId != -1) {
|
||||
int GeoId;
|
||||
Sketcher::PointPos PosId=Sketcher::none;
|
||||
Sketcher::PointPos PosId=Sketcher::PointPos::none;
|
||||
sketchgui->getSketchObject()->getGeoVertexIndex(VtId,GeoId,PosId);
|
||||
const Part::Geometry *geom = sketchgui->getSketchObject()->getGeometry(GeoId);
|
||||
if (geom->getTypeId() == Part::GeomLineSegment::getClassTypeId() &&
|
||||
(PosId == Sketcher::start || PosId == Sketcher::end)) {
|
||||
(PosId == Sketcher::PointPos::start || PosId == Sketcher::PointPos::end)) {
|
||||
|
||||
// guess fillet radius
|
||||
double radius=-1;
|
||||
@@ -5717,9 +5718,9 @@ public:
|
||||
const Part::GeomLineSegment *lineSeg2 = static_cast<const Part::GeomLineSegment *>(geom2);
|
||||
Base::Vector3d dir1 = lineSeg1->getEndPoint() - lineSeg1->getStartPoint();
|
||||
Base::Vector3d dir2 = lineSeg2->getEndPoint() - lineSeg2->getStartPoint();
|
||||
if (PosIdList[0] == Sketcher::end)
|
||||
if (PosIdList[0] == Sketcher::PointPos::end)
|
||||
dir1 *= -1;
|
||||
if (PosIdList[1] == Sketcher::end)
|
||||
if (PosIdList[1] == Sketcher::PointPos::end)
|
||||
dir2 *= -1;
|
||||
double l1 = dir1.Length();
|
||||
double l2 = dir2.Length();
|
||||
@@ -5735,7 +5736,7 @@ public:
|
||||
try {
|
||||
bool pointFillet = (filletType == 1);
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Create fillet"));
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "fillet(%d,%d,%f,%s,%s)", GeoId, PosId, radius, "True",
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "fillet(%d,%d,%f,%s,%s)", GeoId, static_cast<int>(PosId), radius, "True",
|
||||
pointFillet ? "True":"False");
|
||||
|
||||
if (construction) {
|
||||
@@ -6094,14 +6095,14 @@ public:
|
||||
if(GeoId1 != Sketcher::GeoEnum::GeoUndef)
|
||||
EditMarkers.emplace_back(intersect1.x, intersect1.y);
|
||||
else {
|
||||
auto start = sk->getPoint(GeoId, Sketcher::start);
|
||||
auto start = sk->getPoint(GeoId, Sketcher::PointPos::start);
|
||||
EditMarkers.emplace_back(start.x, start.y);
|
||||
}
|
||||
|
||||
if(GeoId2 != Sketcher::GeoEnum::GeoUndef)
|
||||
EditMarkers.emplace_back(intersect2.x, intersect2.y);
|
||||
else {
|
||||
auto end = sk->getPoint(GeoId, Sketcher::end);
|
||||
auto end = sk->getPoint(GeoId, Sketcher::PointPos::end);
|
||||
EditMarkers.emplace_back( end.x, end.y);
|
||||
}
|
||||
|
||||
@@ -6408,7 +6409,7 @@ public:
|
||||
try {
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Extend edge"));
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "extend(%d, %f, %d)\n", // GeoId, increment, PointPos
|
||||
BaseGeoId, Increment, ExtendFromStart ? Sketcher::start : Sketcher::end);
|
||||
BaseGeoId, Increment, ExtendFromStart ? static_cast<int>(Sketcher::PointPos::start) : static_cast<int>(Sketcher::PointPos::end));
|
||||
Gui::Command::commitCommand();
|
||||
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
|
||||
@@ -6418,7 +6419,7 @@ public:
|
||||
|
||||
// constrain chosen point
|
||||
if (SugConstr.size() > 0) {
|
||||
createAutoConstraints(SugConstr, BaseGeoId, (ExtendFromStart) ? Sketcher::start : Sketcher::end);
|
||||
createAutoConstraints(SugConstr, BaseGeoId, (ExtendFromStart) ? Sketcher::PointPos::start : Sketcher::PointPos::end);
|
||||
SugConstr.clear();
|
||||
}
|
||||
bool continuousMode = hGrp->GetBool("ContinuousCreationMode",true);
|
||||
@@ -7145,7 +7146,7 @@ public:
|
||||
try {
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Add slot"));
|
||||
|
||||
AutoConstraint lastCons = {Sketcher::None, Sketcher::GeoEnum::GeoUndef, Sketcher::none};
|
||||
AutoConstraint lastCons = {Sketcher::None, Sketcher::GeoEnum::GeoUndef, Sketcher::PointPos::none};
|
||||
|
||||
if (!sugConstr2.empty()) lastCons = sugConstr2.back();
|
||||
|
||||
@@ -7208,13 +7209,13 @@ public:
|
||||
|
||||
// add auto constraints at the center of the first arc
|
||||
if (sugConstr1.size() > 0) {
|
||||
createAutoConstraints(sugConstr1, getHighestCurveIndex() - 3, Sketcher::mid);
|
||||
createAutoConstraints(sugConstr1, getHighestCurveIndex() - 3, Sketcher::PointPos::mid);
|
||||
sugConstr1.clear();
|
||||
}
|
||||
|
||||
// add auto constraints at the center of the second arc
|
||||
if (sugConstr2.size() > 0) {
|
||||
createAutoConstraints(sugConstr2, getHighestCurveIndex() - 2, Sketcher::mid);
|
||||
createAutoConstraints(sugConstr2, getHighestCurveIndex() - 2, Sketcher::PointPos::mid);
|
||||
sugConstr2.clear();
|
||||
}
|
||||
|
||||
@@ -7400,13 +7401,13 @@ public:
|
||||
|
||||
// add auto constraints at the center of the polygon
|
||||
if (sugConstr1.size() > 0) {
|
||||
createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::mid);
|
||||
createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::PointPos::mid);
|
||||
sugConstr1.clear();
|
||||
}
|
||||
|
||||
// add auto constraints to the last side of the polygon
|
||||
if (sugConstr2.size() > 0) {
|
||||
createAutoConstraints(sugConstr2, getHighestCurveIndex() - 1, Sketcher::end);
|
||||
createAutoConstraints(sugConstr2, getHighestCurveIndex() - 1, Sketcher::PointPos::end);
|
||||
sugConstr2.clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -184,14 +184,14 @@ void CmdSketcherCloseShape::activated(int iMsg)
|
||||
|
||||
Gui::cmdAppObjectArgs(selection[0].getObject(),
|
||||
"addConstraint(Sketcher.Constraint('Coincident', %d, %d, %d, %d)) ",
|
||||
GeoId1, Sketcher::end, GeoId2, Sketcher::start);
|
||||
GeoId1, static_cast<int>(Sketcher::PointPos::end), GeoId2, static_cast<int>(Sketcher::PointPos::start));
|
||||
}
|
||||
}
|
||||
|
||||
// Close Last Edge with First Edge
|
||||
Gui::cmdAppObjectArgs(selection[0].getObject(),
|
||||
"addConstraint(Sketcher.Constraint('Coincident', %d, %d, %d, %d)) ",
|
||||
GeoIdLast, Sketcher::end, GeoIdFirst, Sketcher::start);
|
||||
GeoIdLast, static_cast<int>(Sketcher::PointPos::end), GeoIdFirst, static_cast<int>(Sketcher::PointPos::start));
|
||||
|
||||
// finish the transaction and update, and clear the selection (convenience)
|
||||
commitCommand();
|
||||
@@ -276,7 +276,7 @@ void CmdSketcherConnect::activated(int iMsg)
|
||||
}
|
||||
|
||||
Gui::cmdAppObjectArgs(selection[0].getObject(),"addConstraint(Sketcher.Constraint('Coincident',%d,%d,%d,%d)) ",
|
||||
GeoId1,Sketcher::end,GeoId2,Sketcher::start);
|
||||
GeoId1,static_cast<int>(Sketcher::PointPos::end),GeoId2,static_cast<int>(Sketcher::PointPos::start));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -775,12 +775,12 @@ void CmdSketcherSelectElementsAssociatedWithConstraints::activated(int iMsg)
|
||||
|
||||
switch(vals[ConstrId]->FirstPos)
|
||||
{
|
||||
case Sketcher::none:
|
||||
case Sketcher::PointPos::none:
|
||||
ss << "Edge" << vals[ConstrId]->First + 1;
|
||||
break;
|
||||
case Sketcher::start:
|
||||
case Sketcher::end:
|
||||
case Sketcher::mid:
|
||||
case Sketcher::PointPos::start:
|
||||
case Sketcher::PointPos::end:
|
||||
case Sketcher::PointPos::mid:
|
||||
int vertex = Obj->getVertexIndexGeoPos(vals[ConstrId]->First,vals[ConstrId]->FirstPos);
|
||||
if(vertex>-1)
|
||||
ss << "Vertex" << vertex + 1;
|
||||
@@ -794,12 +794,12 @@ void CmdSketcherSelectElementsAssociatedWithConstraints::activated(int iMsg)
|
||||
|
||||
switch(vals[ConstrId]->SecondPos)
|
||||
{
|
||||
case Sketcher::none:
|
||||
case Sketcher::PointPos::none:
|
||||
ss << "Edge" << vals[ConstrId]->Second + 1;
|
||||
break;
|
||||
case Sketcher::start:
|
||||
case Sketcher::end:
|
||||
case Sketcher::mid:
|
||||
case Sketcher::PointPos::start:
|
||||
case Sketcher::PointPos::end:
|
||||
case Sketcher::PointPos::mid:
|
||||
int vertex = Obj->getVertexIndexGeoPos(vals[ConstrId]->Second,vals[ConstrId]->SecondPos);
|
||||
if(vertex>-1)
|
||||
ss << "Vertex" << vertex + 1;
|
||||
@@ -814,12 +814,12 @@ void CmdSketcherSelectElementsAssociatedWithConstraints::activated(int iMsg)
|
||||
|
||||
switch(vals[ConstrId]->ThirdPos)
|
||||
{
|
||||
case Sketcher::none:
|
||||
case Sketcher::PointPos::none:
|
||||
ss << "Edge" << vals[ConstrId]->Third + 1;
|
||||
break;
|
||||
case Sketcher::start:
|
||||
case Sketcher::end:
|
||||
case Sketcher::mid:
|
||||
case Sketcher::PointPos::start:
|
||||
case Sketcher::PointPos::end:
|
||||
case Sketcher::PointPos::mid:
|
||||
int vertex = Obj->getVertexIndexGeoPos(vals[ConstrId]->Third,vals[ConstrId]->ThirdPos);
|
||||
if(vertex>-1)
|
||||
ss << "Vertex" << vertex + 1;
|
||||
@@ -915,11 +915,11 @@ void CmdSketcherSelectElementsWithDoFs::activated(int iMsg)
|
||||
if (solvext->getEdge() == SolverGeometryExtension::Dependent)
|
||||
testselectedge(geoid);
|
||||
if (solvext->getStart() == SolverGeometryExtension::Dependent)
|
||||
testselectvertex(geoid, Sketcher::start);
|
||||
testselectvertex(geoid, Sketcher::PointPos::start);
|
||||
if (solvext->getEnd() == SolverGeometryExtension::Dependent)
|
||||
testselectvertex(geoid, Sketcher::end);
|
||||
testselectvertex(geoid, Sketcher::PointPos::end);
|
||||
if (solvext->getMid() == SolverGeometryExtension::Dependent)
|
||||
testselectvertex(geoid, Sketcher::mid);
|
||||
testselectvertex(geoid, Sketcher::PointPos::mid);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1083,7 +1083,7 @@ void CmdSketcherSymmetry::activated(int iMsg)
|
||||
getSelection().clearSelection();
|
||||
|
||||
int LastGeoId = 0;
|
||||
Sketcher::PointPos LastPointPos = Sketcher::none;
|
||||
Sketcher::PointPos LastPointPos = Sketcher::PointPos::none;
|
||||
const Part::Geometry *LastGeo;
|
||||
typedef enum { invalid = -1, line = 0, point = 1 } GeoType;
|
||||
|
||||
@@ -1100,11 +1100,11 @@ void CmdSketcherSymmetry::activated(int iMsg)
|
||||
|
||||
if (it->substr(0,4) == "Edge") {
|
||||
LastGeoId = std::atoi(it->substr(4,4000).c_str()) - 1;
|
||||
LastPointPos = Sketcher::none;
|
||||
LastPointPos = Sketcher::PointPos::none;
|
||||
}
|
||||
else {
|
||||
LastGeoId = -std::atoi(it->substr(12,4000).c_str()) - 2;
|
||||
LastPointPos = Sketcher::none;
|
||||
LastPointPos = Sketcher::PointPos::none;
|
||||
}
|
||||
|
||||
// reference can be external or non-external
|
||||
@@ -1130,7 +1130,7 @@ void CmdSketcherSymmetry::activated(int iMsg)
|
||||
|
||||
if (Obj->getGeometry(GeoId)->getTypeId() == Part::GeomPoint::getClassTypeId()) {
|
||||
LastGeoId = GeoId;
|
||||
LastPointPos = Sketcher::start;
|
||||
LastPointPos = Sketcher::PointPos::start;
|
||||
lastgeotype = point;
|
||||
|
||||
// points to make symmetric
|
||||
@@ -1159,21 +1159,21 @@ void CmdSketcherSymmetry::activated(int iMsg)
|
||||
// check if last selected element is horizontal axis
|
||||
else if (SubNames.rbegin()->size() == 6 && SubNames.rbegin()->substr(0,6) == "H_Axis") {
|
||||
LastGeoId = Sketcher::GeoEnum::HAxis;
|
||||
LastPointPos = Sketcher::none;
|
||||
LastPointPos = Sketcher::PointPos::none;
|
||||
lastgeotype = line;
|
||||
lastvertexoraxis = true;
|
||||
}
|
||||
// check if last selected element is vertical axis
|
||||
else if (SubNames.rbegin()->size() == 6 && SubNames.rbegin()->substr(0,6) == "V_Axis") {
|
||||
LastGeoId = Sketcher::GeoEnum::VAxis;
|
||||
LastPointPos = Sketcher::none;
|
||||
LastPointPos = Sketcher::PointPos::none;
|
||||
lastgeotype = line;
|
||||
lastvertexoraxis = true;
|
||||
}
|
||||
// check if last selected element is the root point
|
||||
else if (SubNames.rbegin()->size() == 9 && SubNames.rbegin()->substr(0,9) == "RootPoint") {
|
||||
LastGeoId = Sketcher::GeoEnum::RtPnt;
|
||||
LastPointPos = Sketcher::start;
|
||||
LastPointPos = Sketcher::PointPos::start;
|
||||
lastgeotype = point;
|
||||
lastvertexoraxis = true;
|
||||
}
|
||||
@@ -1221,7 +1221,7 @@ void CmdSketcherSymmetry::activated(int iMsg)
|
||||
try{
|
||||
Gui::cmdAppObjectArgs(Obj,
|
||||
"addSymmetric(%s, %d, %d)",
|
||||
geoIdList.c_str(), LastGeoId, LastPointPos);
|
||||
geoIdList.c_str(), LastGeoId, static_cast<int>(LastPointPos));
|
||||
Gui::Command::commitCommand();
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
@@ -1465,7 +1465,7 @@ void SketcherCopy::activate(SketcherCopy::Op op)
|
||||
getSelection().clearSelection();
|
||||
|
||||
int LastGeoId = 0;
|
||||
Sketcher::PointPos LastPointPos = Sketcher::none;
|
||||
Sketcher::PointPos LastPointPos = Sketcher::PointPos::none;
|
||||
const Part::Geometry *LastGeo = 0;
|
||||
|
||||
// create python command with list of elements
|
||||
@@ -1475,7 +1475,7 @@ void SketcherCopy::activate(SketcherCopy::Op op)
|
||||
// only handle non-external edges
|
||||
if (it->size() > 4 && it->substr(0,4) == "Edge") {
|
||||
LastGeoId = std::atoi(it->substr(4,4000).c_str()) - 1;
|
||||
LastPointPos = Sketcher::none;
|
||||
LastPointPos = Sketcher::PointPos::none;
|
||||
LastGeo = Obj->getGeometry(LastGeoId);
|
||||
// lines to copy
|
||||
if (LastGeoId >= 0) {
|
||||
@@ -1491,7 +1491,7 @@ void SketcherCopy::activate(SketcherCopy::Op op)
|
||||
Obj->getGeoVertexIndex(VtId, GeoId, PosId);
|
||||
if (Obj->getGeometry(GeoId)->getTypeId() == Part::GeomPoint::getClassTypeId()) {
|
||||
LastGeoId = GeoId;
|
||||
LastPointPos = Sketcher::start;
|
||||
LastPointPos = Sketcher::PointPos::start;
|
||||
// points to copy
|
||||
if (LastGeoId >= 0) {
|
||||
geoids++;
|
||||
@@ -1530,13 +1530,13 @@ void SketcherCopy::activate(SketcherCopy::Op op)
|
||||
|
||||
// if the last element is not a point serving as a reference for the copy process
|
||||
// then make the start point of the last element the copy reference (if it exists, if not the center point)
|
||||
if (LastPointPos == Sketcher::none) {
|
||||
if (LastPointPos == Sketcher::PointPos::none) {
|
||||
if (LastGeo->getTypeId() == Part::GeomCircle::getClassTypeId() ||
|
||||
LastGeo->getTypeId() == Part::GeomEllipse::getClassTypeId()) {
|
||||
LastPointPos = Sketcher::mid;
|
||||
LastPointPos = Sketcher::PointPos::mid;
|
||||
}
|
||||
else {
|
||||
LastPointPos = Sketcher::start;
|
||||
LastPointPos = Sketcher::PointPos::start;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2021,7 +2021,7 @@ void CmdSketcherRectangularArray::activated(int iMsg)
|
||||
getSelection().clearSelection();
|
||||
|
||||
int LastGeoId = 0;
|
||||
Sketcher::PointPos LastPointPos = Sketcher::none;
|
||||
Sketcher::PointPos LastPointPos = Sketcher::PointPos::none;
|
||||
const Part::Geometry *LastGeo = 0;
|
||||
|
||||
// create python command with list of elements
|
||||
@@ -2032,7 +2032,7 @@ void CmdSketcherRectangularArray::activated(int iMsg)
|
||||
// only handle non-external edges
|
||||
if (it->size() > 4 && it->substr(0,4) == "Edge") {
|
||||
LastGeoId = std::atoi(it->substr(4,4000).c_str()) - 1;
|
||||
LastPointPos = Sketcher::none;
|
||||
LastPointPos = Sketcher::PointPos::none;
|
||||
LastGeo = Obj->getGeometry(LastGeoId);
|
||||
|
||||
// lines to copy
|
||||
@@ -2049,7 +2049,7 @@ void CmdSketcherRectangularArray::activated(int iMsg)
|
||||
Obj->getGeoVertexIndex(VtId, GeoId, PosId);
|
||||
if (Obj->getGeometry(GeoId)->getTypeId() == Part::GeomPoint::getClassTypeId()) {
|
||||
LastGeoId = GeoId;
|
||||
LastPointPos = Sketcher::start;
|
||||
LastPointPos = Sketcher::PointPos::start;
|
||||
// points to copy
|
||||
if (LastGeoId >= 0) {
|
||||
geoids++;
|
||||
@@ -2088,13 +2088,13 @@ void CmdSketcherRectangularArray::activated(int iMsg)
|
||||
|
||||
// if the last element is not a point serving as a reference for the copy process
|
||||
// then make the start point of the last element the copy reference (if it exists, if not the center point)
|
||||
if (LastPointPos == Sketcher::none) {
|
||||
if (LastPointPos == Sketcher::PointPos::none) {
|
||||
if (LastGeo->getTypeId() == Part::GeomCircle::getClassTypeId() ||
|
||||
LastGeo->getTypeId() == Part::GeomEllipse::getClassTypeId()) {
|
||||
LastPointPos = Sketcher::mid;
|
||||
LastPointPos = Sketcher::PointPos::mid;
|
||||
}
|
||||
else {
|
||||
LastPointPos = Sketcher::start;
|
||||
LastPointPos = Sketcher::PointPos::start;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -319,7 +319,8 @@ int DrawSketchHandler::seekAutoConstraint(std::vector<AutoConstraint> &suggested
|
||||
int preSelCrs = sketchgui->getPreselectCross();
|
||||
int GeoId = GeoEnum::GeoUndef;
|
||||
|
||||
Sketcher::PointPos PosId = Sketcher::none;
|
||||
Sketcher::PointPos PosId = Sketcher::PointPos::none;
|
||||
|
||||
if (preSelPnt != -1)
|
||||
sketchgui->getSketchObject()->getGeoVertexIndex(preSelPnt, GeoId, PosId);
|
||||
else if (preSelCrv != -1){
|
||||
@@ -334,7 +335,7 @@ int DrawSketchHandler::seekAutoConstraint(std::vector<AutoConstraint> &suggested
|
||||
}
|
||||
else if (preSelCrs == 0) { // root point
|
||||
GeoId = Sketcher::GeoEnum::RtPnt;
|
||||
PosId = Sketcher::start;
|
||||
PosId = Sketcher::PointPos::start;
|
||||
}
|
||||
else if (preSelCrs == 1){ // x axis
|
||||
GeoId = Sketcher::GeoEnum::HAxis;
|
||||
@@ -355,13 +356,13 @@ int DrawSketchHandler::seekAutoConstraint(std::vector<AutoConstraint> &suggested
|
||||
constr.Type = Sketcher::None;
|
||||
constr.GeoId = GeoId;
|
||||
constr.PosId = PosId;
|
||||
if ((type == AutoConstraint::VERTEX || type == AutoConstraint::VERTEX_NO_TANGENCY) && PosId != Sketcher::none)
|
||||
if ((type == AutoConstraint::VERTEX || type == AutoConstraint::VERTEX_NO_TANGENCY) && PosId != Sketcher::PointPos::none)
|
||||
constr.Type = Sketcher::Coincident;
|
||||
else if (type == AutoConstraint::CURVE && PosId != Sketcher::none)
|
||||
else if (type == AutoConstraint::CURVE && PosId != Sketcher::PointPos::none)
|
||||
constr.Type = Sketcher::PointOnObject;
|
||||
else if ((type == AutoConstraint::VERTEX || type == AutoConstraint::VERTEX_NO_TANGENCY) && PosId == Sketcher::none && hitobject->getTypeId() != Part::GeomBSplineCurve::getClassTypeId())
|
||||
else if ((type == AutoConstraint::VERTEX || type == AutoConstraint::VERTEX_NO_TANGENCY) && PosId == Sketcher::PointPos::none && hitobject->getTypeId() != Part::GeomBSplineCurve::getClassTypeId())
|
||||
constr.Type = Sketcher::PointOnObject;
|
||||
else if (type == AutoConstraint::CURVE && PosId == Sketcher::none)
|
||||
else if (type == AutoConstraint::CURVE && PosId == Sketcher::PointPos::none)
|
||||
constr.Type = Sketcher::Tangent;
|
||||
|
||||
if(constr.Type == Sketcher::Tangent && Dir.Length() > 1e-8 && hitShapeDir.Length() > 1e-8) { // We are hitting a line and have hitting vector information
|
||||
@@ -394,7 +395,7 @@ int DrawSketchHandler::seekAutoConstraint(std::vector<AutoConstraint> &suggested
|
||||
AutoConstraint constr;
|
||||
constr.Type = Sketcher::None;
|
||||
constr.GeoId = GeoEnum::GeoUndef;
|
||||
constr.PosId = Sketcher::none;
|
||||
constr.PosId = Sketcher::PointPos::none;
|
||||
double angle = std::abs(atan2(Dir.y, Dir.x));
|
||||
if (angle < angleDevRad || (M_PI - angle) < angleDevRad )
|
||||
// Suggest horizontal constraint
|
||||
@@ -559,7 +560,7 @@ int DrawSketchHandler::seekAutoConstraint(std::vector<AutoConstraint> &suggested
|
||||
// Suggest vertical constraint
|
||||
constr.Type = Tangent;
|
||||
constr.GeoId = tangId;
|
||||
constr.PosId = Sketcher::none;
|
||||
constr.PosId = Sketcher::PointPos::none;
|
||||
suggestedConstraints.push_back(constr);
|
||||
}
|
||||
|
||||
@@ -587,22 +588,22 @@ void DrawSketchHandler::createAutoConstraints(const std::vector<AutoConstraint>
|
||||
switch (it->Type)
|
||||
{
|
||||
case Sketcher::Coincident: {
|
||||
if (posId1 == Sketcher::none)
|
||||
if (posId1 == Sketcher::PointPos::none)
|
||||
continue;
|
||||
// If the auto constraint has a point create a coincident otherwise it is an edge on a point
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addConstraint(Sketcher.Constraint('Coincident',%i,%i,%i,%i)) "
|
||||
, geoId1, posId1, it->GeoId, it->PosId);
|
||||
, geoId1, static_cast<int>(posId1), it->GeoId, static_cast<int>(it->PosId));
|
||||
} break;
|
||||
case Sketcher::PointOnObject: {
|
||||
Sketcher::PointPos posId2 = it->PosId;
|
||||
if (posId1 == Sketcher::none) {
|
||||
if (posId1 == Sketcher::PointPos::none) {
|
||||
// Auto constraining an edge so swap parameters
|
||||
std::swap(geoId1,geoId2);
|
||||
std::swap(posId1,posId2);
|
||||
}
|
||||
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addConstraint(Sketcher.Constraint('PointOnObject',%i,%i,%i)) "
|
||||
, geoId1, posId1, geoId2);
|
||||
, geoId1, static_cast<int>(posId1), geoId2);
|
||||
} break;
|
||||
// In special case of Horizontal/Vertical constraint, geoId2 is normally unused and should be 'Constraint::GeoUndef'
|
||||
// However it can be used as a way to require the function to apply these constraints on another geometry
|
||||
|
||||
@@ -86,7 +86,7 @@ public:
|
||||
// createowncommand indicates whether a separate command shall be create and committed (for example for undo purposes) or not
|
||||
// is not it is the responsibility of the developer to create and commit the command appropriately.
|
||||
void createAutoConstraints(const std::vector<AutoConstraint> &autoConstrs,
|
||||
int geoId, Sketcher::PointPos pointPos=Sketcher::none, bool createowncommand = true);
|
||||
int geoId, Sketcher::PointPos pointPos=Sketcher::PointPos::none, bool createowncommand = true);
|
||||
|
||||
void setPositionText(const Base::Vector2d &Pos, const SbString &text);
|
||||
void setPositionText(const Base::Vector2d &Pos);
|
||||
|
||||
@@ -41,7 +41,7 @@ using namespace SketcherGui;
|
||||
SketchMirrorDialog::SketchMirrorDialog(void)
|
||||
: QDialog(Gui::getMainWindow())
|
||||
, RefGeoid(-1)
|
||||
, RefPosid(Sketcher::none)
|
||||
, RefPosid(Sketcher::PointPos::none)
|
||||
, ui(new Ui_SketchMirrorDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
@@ -55,15 +55,15 @@ void SketchMirrorDialog::accept()
|
||||
{
|
||||
if (ui->XAxisRadioButton->isChecked()) {
|
||||
RefGeoid=Sketcher::GeoEnum::HAxis;
|
||||
RefPosid=Sketcher::none;
|
||||
RefPosid=Sketcher::PointPos::none;
|
||||
}
|
||||
else if (ui->YAxisRadioButton->isChecked()) {
|
||||
RefGeoid=Sketcher::GeoEnum::VAxis;
|
||||
RefPosid=Sketcher::none;
|
||||
RefPosid=Sketcher::PointPos::none;
|
||||
}
|
||||
else if (ui->OriginRadioButton->isChecked()) {
|
||||
RefGeoid=Sketcher::GeoEnum::RtPnt;
|
||||
RefPosid=Sketcher::start;
|
||||
RefPosid=Sketcher::PointPos::start;
|
||||
}
|
||||
|
||||
QDialog::accept();
|
||||
|
||||
@@ -172,13 +172,13 @@ public:
|
||||
|
||||
if(extended) {
|
||||
if(constraint->Second == Sketcher::GeoEnum::GeoUndef) {
|
||||
name = QString::fromLatin1("%1 [(%2,%3)]").arg(name).arg(constraint->First).arg(constraint->FirstPos);
|
||||
name = QString::fromLatin1("%1 [(%2,%3)]").arg(name).arg(constraint->First).arg(static_cast<int>(constraint->FirstPos));
|
||||
}
|
||||
else if(constraint->Third == Sketcher::GeoEnum::GeoUndef) {
|
||||
name = QString::fromLatin1("%1 [(%2,%3),(%4,%5)]").arg(name).arg(constraint->First).arg(constraint->FirstPos).arg(constraint->Second).arg(constraint->SecondPos);
|
||||
name = QString::fromLatin1("%1 [(%2,%3),(%4,%5)]").arg(name).arg(constraint->First).arg(static_cast<int>(constraint->FirstPos)).arg(constraint->Second).arg(static_cast<int>(constraint->SecondPos));
|
||||
}
|
||||
else {
|
||||
name = QString::fromLatin1("%1 [(%2,%3),(%4,%5),(%6,%7)]").arg(name).arg(constraint->First).arg(constraint->FirstPos).arg(constraint->Second).arg(constraint->SecondPos).arg(constraint->Third).arg(constraint->ThirdPos);
|
||||
name = QString::fromLatin1("%1 [(%2,%3),(%4,%5),(%6,%7)]").arg(name).arg(constraint->First).arg(static_cast<int>(constraint->FirstPos)).arg(constraint->Second).arg(static_cast<int>(constraint->SecondPos)).arg(constraint->Third).arg(static_cast<int>(constraint->ThirdPos));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -998,10 +998,10 @@ void TaskSketcherConstraints::onSelectionChanged(const Gui::SelectionChanges& ms
|
||||
}
|
||||
else if(isFilter(ConstraintFilter::SpecialFilterValue::AssociatedConstraints)) { // is NOT a constraint
|
||||
int geoid = Sketcher::GeoEnum::GeoUndef;
|
||||
Sketcher::PointPos pointpos = Sketcher::none;
|
||||
Sketcher::PointPos pointpos = Sketcher::PointPos::none;
|
||||
getSelectionGeoId(expr, geoid, pointpos);
|
||||
|
||||
if(geoid != Sketcher::GeoEnum::GeoUndef && pointpos == Sketcher::none){
|
||||
if(geoid != Sketcher::GeoEnum::GeoUndef && pointpos == Sketcher::PointPos::none){
|
||||
// It is not possible to update on single addition/removal of a geometric element,
|
||||
// as one removal may imply removing a constraint that should be added by a different element
|
||||
// that is still selected. The necessary checks outweigh a full rebuild of the filter.
|
||||
@@ -1021,7 +1021,7 @@ void TaskSketcherConstraints::getSelectionGeoId(QString expr, int & geoid, Sketc
|
||||
QRegExp rxEdge(QString::fromLatin1("^Edge(\\d+)$"));
|
||||
int pos = expr.indexOf(rxEdge);
|
||||
geoid = Sketcher::GeoEnum::GeoUndef;
|
||||
pointpos = Sketcher::none;
|
||||
pointpos = Sketcher::PointPos::none;
|
||||
|
||||
if (pos > -1) {
|
||||
bool ok;
|
||||
|
||||
@@ -400,13 +400,13 @@ void TaskSketcherElements::onSelectionChanged(const Gui::SelectionChanges& msg)
|
||||
if (item->ElementNbr == GeoId) {
|
||||
switch(PosId)
|
||||
{
|
||||
case Sketcher::start:
|
||||
case Sketcher::PointPos::start:
|
||||
item->isStartingPointSelected=select;
|
||||
break;
|
||||
case Sketcher::end:
|
||||
case Sketcher::PointPos::end:
|
||||
item->isEndPointSelected=select;
|
||||
break;
|
||||
case Sketcher::mid:
|
||||
case Sketcher::PointPos::mid:
|
||||
item->isMidPointSelected=select;
|
||||
break;
|
||||
default:
|
||||
@@ -791,9 +791,9 @@ void TaskSketcherElements::slotElementsChanged(void)
|
||||
(construction?(QString::fromLatin1("-")+tr("Construction")):QString::fromLatin1("")):
|
||||
(QString::fromLatin1("%1-").arg(i)+tr("Other"))),
|
||||
i-1,
|
||||
sketchView->getSketchObject()->getVertexIndexGeoPos(i-1,Sketcher::start),
|
||||
sketchView->getSketchObject()->getVertexIndexGeoPos(i-1,Sketcher::mid),
|
||||
sketchView->getSketchObject()->getVertexIndexGeoPos(i-1,Sketcher::end),
|
||||
sketchView->getSketchObject()->getVertexIndexGeoPos(i-1,Sketcher::PointPos::start),
|
||||
sketchView->getSketchObject()->getVertexIndexGeoPos(i-1,Sketcher::PointPos::mid),
|
||||
sketchView->getSketchObject()->getVertexIndexGeoPos(i-1,Sketcher::PointPos::end),
|
||||
type,
|
||||
construction,
|
||||
false));
|
||||
@@ -888,9 +888,9 @@ void TaskSketcherElements::slotElementsChanged(void)
|
||||
(tr("Other") + linkname):
|
||||
(QString::fromLatin1("%1-").arg(i-2)+tr("Other"))),
|
||||
-j,
|
||||
sketchView->getSketchObject()->getVertexIndexGeoPos(-j,Sketcher::start),
|
||||
sketchView->getSketchObject()->getVertexIndexGeoPos(-j,Sketcher::mid),
|
||||
sketchView->getSketchObject()->getVertexIndexGeoPos(-j,Sketcher::end),
|
||||
sketchView->getSketchObject()->getVertexIndexGeoPos(-j,Sketcher::PointPos::start),
|
||||
sketchView->getSketchObject()->getVertexIndexGeoPos(-j,Sketcher::PointPos::mid),
|
||||
sketchView->getSketchObject()->getVertexIndexGeoPos(-j,Sketcher::PointPos::end),
|
||||
type,
|
||||
false, // externals are not construction geometry in the sense of the sketcher ui
|
||||
true // yes, external geometry
|
||||
|
||||
@@ -131,14 +131,14 @@ void SketcherGui::getIdsFromName(const std::string &name, const Sketcher::Sketch
|
||||
int &GeoId, PointPos &PosId)
|
||||
{
|
||||
GeoId = GeoEnum::GeoUndef;
|
||||
PosId = Sketcher::none;
|
||||
PosId = Sketcher::PointPos::none;
|
||||
|
||||
if (name.size() > 4 && name.substr(0,4) == "Edge") {
|
||||
GeoId = std::atoi(name.substr(4,4000).c_str()) - 1;
|
||||
}
|
||||
else if (name.size() == 9 && name.substr(0,9) == "RootPoint") {
|
||||
GeoId = Sketcher::GeoEnum::RtPnt;
|
||||
PosId = Sketcher::start;
|
||||
PosId = Sketcher::PointPos::start;
|
||||
}
|
||||
else if (name.size() == 6 && name.substr(0,6) == "H_Axis")
|
||||
GeoId = Sketcher::GeoEnum::HAxis;
|
||||
@@ -176,7 +176,7 @@ bool SketcherGui::isPointOrSegmentFixed(const Sketcher::SketchObject* Obj, int G
|
||||
if (GeoId == GeoEnum::GeoUndef)
|
||||
return false;
|
||||
else
|
||||
return checkConstraint(vals, Sketcher::Block, GeoId, Sketcher::none) || GeoId <= Sketcher::GeoEnum::RtPnt || isBsplineKnot(Obj,GeoId);
|
||||
return checkConstraint(vals, Sketcher::Block, GeoId, Sketcher::PointPos::none) || GeoId <= Sketcher::GeoEnum::RtPnt || isBsplineKnot(Obj,GeoId);
|
||||
}
|
||||
|
||||
bool SketcherGui::areBothPointsOrSegmentsFixed(const Sketcher::SketchObject* Obj, int GeoId1, int GeoId2)
|
||||
@@ -186,8 +186,8 @@ bool SketcherGui::areBothPointsOrSegmentsFixed(const Sketcher::SketchObject* Obj
|
||||
if (GeoId1 == GeoEnum::GeoUndef || GeoId2 == GeoEnum::GeoUndef)
|
||||
return false;
|
||||
else
|
||||
return ((checkConstraint(vals, Sketcher::Block, GeoId1, Sketcher::none) || GeoId1 <= Sketcher::GeoEnum::RtPnt || isBsplineKnot(Obj,GeoId1)) &&
|
||||
(checkConstraint(vals, Sketcher::Block, GeoId2, Sketcher::none) || GeoId2 <= Sketcher::GeoEnum::RtPnt || isBsplineKnot(Obj,GeoId2)));
|
||||
return ((checkConstraint(vals, Sketcher::Block, GeoId1, Sketcher::PointPos::none) || GeoId1 <= Sketcher::GeoEnum::RtPnt || isBsplineKnot(Obj,GeoId1)) &&
|
||||
(checkConstraint(vals, Sketcher::Block, GeoId2, Sketcher::PointPos::none) || GeoId2 <= Sketcher::GeoEnum::RtPnt || isBsplineKnot(Obj,GeoId2)));
|
||||
}
|
||||
|
||||
bool SketcherGui::areAllPointsOrSegmentsFixed(const Sketcher::SketchObject* Obj, int GeoId1, int GeoId2, int GeoId3)
|
||||
@@ -197,19 +197,19 @@ bool SketcherGui::areAllPointsOrSegmentsFixed(const Sketcher::SketchObject* Obj,
|
||||
if (GeoId1 == GeoEnum::GeoUndef || GeoId2 == GeoEnum::GeoUndef || GeoId3 == GeoEnum::GeoUndef)
|
||||
return false;
|
||||
else
|
||||
return ((checkConstraint(vals, Sketcher::Block, GeoId1, Sketcher::none) || GeoId1 <= Sketcher::GeoEnum::RtPnt || isBsplineKnot(Obj,GeoId1)) &&
|
||||
(checkConstraint(vals, Sketcher::Block, GeoId2, Sketcher::none) || GeoId2 <= Sketcher::GeoEnum::RtPnt || isBsplineKnot(Obj,GeoId2)) &&
|
||||
(checkConstraint(vals, Sketcher::Block, GeoId3, Sketcher::none) || GeoId3 <= Sketcher::GeoEnum::RtPnt || isBsplineKnot(Obj,GeoId3)));
|
||||
return ((checkConstraint(vals, Sketcher::Block, GeoId1, Sketcher::PointPos::none) || GeoId1 <= Sketcher::GeoEnum::RtPnt || isBsplineKnot(Obj,GeoId1)) &&
|
||||
(checkConstraint(vals, Sketcher::Block, GeoId2, Sketcher::PointPos::none) || GeoId2 <= Sketcher::GeoEnum::RtPnt || isBsplineKnot(Obj,GeoId2)) &&
|
||||
(checkConstraint(vals, Sketcher::Block, GeoId3, Sketcher::PointPos::none) || GeoId3 <= Sketcher::GeoEnum::RtPnt || isBsplineKnot(Obj,GeoId3)));
|
||||
}
|
||||
|
||||
bool SketcherGui::isSimpleVertex(const Sketcher::SketchObject* Obj, int GeoId, PointPos PosId)
|
||||
{
|
||||
if (PosId == Sketcher::start && (GeoId == Sketcher::GeoEnum::HAxis || GeoId == Sketcher::GeoEnum::VAxis))
|
||||
if (PosId == Sketcher::PointPos::start && (GeoId == Sketcher::GeoEnum::HAxis || GeoId == Sketcher::GeoEnum::VAxis))
|
||||
return true;
|
||||
const Part::Geometry *geo = Obj->getGeometry(GeoId);
|
||||
if (geo->getTypeId() == Part::GeomPoint::getClassTypeId())
|
||||
return true;
|
||||
else if (PosId == Sketcher::mid)
|
||||
else if (PosId == Sketcher::PointPos::mid)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#define SKETCHERGUI_Recompute_H
|
||||
|
||||
namespace Sketcher {
|
||||
enum PointPos : int;
|
||||
enum class PointPos : int;
|
||||
class SketchObject;
|
||||
}
|
||||
|
||||
@@ -79,12 +79,12 @@ bool checkConstraint(const std::vector< Sketcher::Constraint * > &vals, Sketcher
|
||||
|
||||
inline bool isVertex(int GeoId, Sketcher::PointPos PosId)
|
||||
{
|
||||
return (GeoId != Sketcher::GeoEnum::GeoUndef && PosId != Sketcher::none);
|
||||
return (GeoId != Sketcher::GeoEnum::GeoUndef && PosId != Sketcher::PointPos::none);
|
||||
}
|
||||
|
||||
inline bool isEdge(int GeoId, Sketcher::PointPos PosId)
|
||||
{
|
||||
return (GeoId != Sketcher::GeoEnum::GeoUndef && PosId == Sketcher::none);
|
||||
return (GeoId != Sketcher::GeoEnum::GeoUndef && PosId == Sketcher::PointPos::none);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -522,7 +522,7 @@ bool ViewProviderSketch::keyPressed(bool pressed, int key)
|
||||
}
|
||||
if (edit && edit->DragCurve >= 0) {
|
||||
if (!pressed) {
|
||||
getSketchObject()->movePoint(edit->DragCurve, Sketcher::none, Base::Vector3d(0,0,0), true);
|
||||
getSketchObject()->movePoint(edit->DragCurve, Sketcher::PointPos::none, Base::Vector3d(0,0,0), true);
|
||||
edit->DragCurve = -1;
|
||||
resetPositionText();
|
||||
Mode = STATUS_NONE;
|
||||
@@ -852,11 +852,11 @@ bool ViewProviderSketch::mouseButtonPressed(int Button, bool pressed, const SbVe
|
||||
int GeoId;
|
||||
Sketcher::PointPos PosId;
|
||||
getSketchObject()->getGeoVertexIndex(edit->DragPoint, GeoId, PosId);
|
||||
if (GeoId != Sketcher::GeoEnum::GeoUndef && PosId != Sketcher::none) {
|
||||
if (GeoId != Sketcher::GeoEnum::GeoUndef && PosId != Sketcher::PointPos::none) {
|
||||
getDocument()->openCommand(QT_TRANSLATE_NOOP("Command", "Drag Point"));
|
||||
try {
|
||||
Gui::cmdAppObjectArgs(getObject(), "movePoint(%i,%i,App.Vector(%f,%f,0),%i)"
|
||||
,GeoId, PosId, x-xInit, y-yInit, 0);
|
||||
,GeoId, static_cast<int>(PosId), x-xInit, y-yInit, 0);
|
||||
getDocument()->commitCommand();
|
||||
|
||||
tryAutoRecomputeIfNotSolve(getSketchObject());
|
||||
@@ -916,7 +916,7 @@ bool ViewProviderSketch::mouseButtonPressed(int Button, bool pressed, const SbVe
|
||||
|
||||
try {
|
||||
Gui::cmdAppObjectArgs(getObject(), "movePoint(%i,%i,App.Vector(%f,%f,0),%i)"
|
||||
,edit->DragCurve, Sketcher::none, vec.x, vec.y, relative ? 1 : 0);
|
||||
,edit->DragCurve, static_cast<int>(Sketcher::PointPos::none), vec.x, vec.y, relative ? 1 : 0);
|
||||
getDocument()->commitCommand();
|
||||
|
||||
tryAutoRecomputeIfNotSolve(getSketchObject());
|
||||
@@ -1181,7 +1181,7 @@ bool ViewProviderSketch::mouseMove(const SbVec2s &cursorPos, Gui::View3DInventor
|
||||
int GeoId;
|
||||
Sketcher::PointPos PosId;
|
||||
getSketchObject()->getGeoVertexIndex(edit->DragPoint, GeoId, PosId);
|
||||
if (GeoId != Sketcher::GeoEnum::GeoUndef && PosId != Sketcher::none) {
|
||||
if (GeoId != Sketcher::GeoEnum::GeoUndef && PosId != Sketcher::PointPos::none) {
|
||||
getSketchObject()->initTemporaryMove(GeoId, PosId, false);
|
||||
relative = false;
|
||||
xInit = 0;
|
||||
@@ -1218,7 +1218,7 @@ bool ViewProviderSketch::mouseMove(const SbVec2s &cursorPos, Gui::View3DInventor
|
||||
|
||||
// The B-Spline is constrained to be non-rational (equal weights), moving produces a bad effect
|
||||
// because OCCT will normalize the values of the weights.
|
||||
auto grp = getSolvedSketch().getDependencyGroup(edit->DragCurve, Sketcher::none);
|
||||
auto grp = getSolvedSketch().getDependencyGroup(edit->DragCurve, Sketcher::PointPos::none);
|
||||
|
||||
int bsplinegeoid = -1;
|
||||
|
||||
@@ -1251,7 +1251,7 @@ bool ViewProviderSketch::mouseMove(const SbVec2s &cursorPos, Gui::View3DInventor
|
||||
bool allingroup = true;
|
||||
|
||||
for( auto polegeoid : polegeoids ) {
|
||||
std::pair< int, Sketcher::PointPos > thispole = std::make_pair(polegeoid,Sketcher::none);
|
||||
std::pair< int, Sketcher::PointPos > thispole = std::make_pair(polegeoid,Sketcher::PointPos::none);
|
||||
|
||||
if(grp.find(thispole) == grp.end()) // not found
|
||||
allingroup = false;
|
||||
@@ -1283,7 +1283,7 @@ bool ViewProviderSketch::mouseMove(const SbVec2s &cursorPos, Gui::View3DInventor
|
||||
yInit = 0;
|
||||
}
|
||||
|
||||
getSketchObject()->initTemporaryMove(edit->DragCurve, Sketcher::none, false);
|
||||
getSketchObject()->initTemporaryMove(edit->DragCurve, Sketcher::PointPos::none, false);
|
||||
|
||||
} else {
|
||||
Mode = STATUS_NONE;
|
||||
@@ -1308,7 +1308,7 @@ bool ViewProviderSketch::mouseMove(const SbVec2s &cursorPos, Gui::View3DInventor
|
||||
Sketcher::PointPos PosId;
|
||||
getSketchObject()->getGeoVertexIndex(edit->DragPoint, GeoId, PosId);
|
||||
Base::Vector3d vec(x,y,0);
|
||||
if (GeoId != Sketcher::GeoEnum::GeoUndef && PosId != Sketcher::none) {
|
||||
if (GeoId != Sketcher::GeoEnum::GeoUndef && PosId != Sketcher::PointPos::none) {
|
||||
if (getSketchObject()->moveTemporaryPoint(GeoId, PosId, vec, false) == 0) {
|
||||
setPositionText(Base::Vector2d(x,y));
|
||||
draw(true,false);
|
||||
@@ -1346,7 +1346,7 @@ bool ViewProviderSketch::mouseMove(const SbVec2s &cursorPos, Gui::View3DInventor
|
||||
vec = center + dir / scalefactor;
|
||||
}
|
||||
|
||||
if (getSketchObject()->moveTemporaryPoint(edit->DragCurve, Sketcher::none, vec, relative) == 0) {
|
||||
if (getSketchObject()->moveTemporaryPoint(edit->DragCurve, Sketcher::PointPos::none, vec, relative) == 0) {
|
||||
setPositionText(Base::Vector2d(x,y));
|
||||
draw(true,false);
|
||||
}
|
||||
@@ -1416,7 +1416,7 @@ void ViewProviderSketch::moveConstraint(int constNum, const Base::Vector2d &toPo
|
||||
Constr->Type == Radius || Constr->Type == Diameter || Constr-> Type == Weight) {
|
||||
|
||||
Base::Vector3d p1(0.,0.,0.), p2(0.,0.,0.);
|
||||
if (Constr->SecondPos != Sketcher::none) { // point to point distance
|
||||
if (Constr->SecondPos != Sketcher::PointPos::none) { // point to point distance
|
||||
p1 = getSolvedSketch().getPoint(Constr->First, Constr->FirstPos);
|
||||
p2 = getSolvedSketch().getPoint(Constr->Second, Constr->SecondPos);
|
||||
} else if (Constr->Second != GeoEnum::GeoUndef) { // point to line distance
|
||||
@@ -1431,7 +1431,7 @@ void ViewProviderSketch::moveConstraint(int constNum, const Base::Vector2d &toPo
|
||||
p2 += p1;
|
||||
} else
|
||||
return;
|
||||
} else if (Constr->FirstPos != Sketcher::none) {
|
||||
} else if (Constr->FirstPos != Sketcher::PointPos::none) {
|
||||
p2 = getSolvedSketch().getPoint(Constr->First, Constr->FirstPos);
|
||||
} else if (Constr->First != GeoEnum::GeoUndef) {
|
||||
const Part::Geometry *geo = GeoById(geomlist, Constr->First);
|
||||
@@ -1535,8 +1535,8 @@ void ViewProviderSketch::moveConstraint(int constNum, const Base::Vector2d &toPo
|
||||
const Part::GeomLineSegment *lineSeg1 = static_cast<const Part::GeomLineSegment *>(geo1);
|
||||
const Part::GeomLineSegment *lineSeg2 = static_cast<const Part::GeomLineSegment *>(geo2);
|
||||
|
||||
bool flip1 = (Constr->FirstPos == end);
|
||||
bool flip2 = (Constr->SecondPos == end);
|
||||
bool flip1 = (Constr->FirstPos == Sketcher::PointPos::end);
|
||||
bool flip2 = (Constr->SecondPos == Sketcher::PointPos::end);
|
||||
dir1 = (flip1 ? -1. : 1.) * (lineSeg1->getEndPoint()-lineSeg1->getStartPoint());
|
||||
dir2 = (flip2 ? -1. : 1.) * (lineSeg2->getEndPoint()-lineSeg2->getStartPoint());
|
||||
Base::Vector3d pnt1 = flip1 ? lineSeg1->getEndPoint() : lineSeg1->getStartPoint();
|
||||
@@ -3402,8 +3402,8 @@ void ViewProviderSketch::drawConstraintIcons()
|
||||
case Vertical:
|
||||
{ // second icon is available only for point alignment
|
||||
if ((*it)->Second != GeoEnum::GeoUndef &&
|
||||
(*it)->FirstPos != Sketcher::none &&
|
||||
(*it)->SecondPos != Sketcher::none) {
|
||||
(*it)->FirstPos != Sketcher::PointPos::none &&
|
||||
(*it)->SecondPos != Sketcher::PointPos::none) {
|
||||
multipleIcons = true;
|
||||
}
|
||||
}
|
||||
@@ -3413,7 +3413,7 @@ void ViewProviderSketch::drawConstraintIcons()
|
||||
break;
|
||||
case Perpendicular:
|
||||
// second icon is available only when there is no common point
|
||||
if ((*it)->FirstPos == Sketcher::none && (*it)->Third == GeoEnum::GeoUndef)
|
||||
if ((*it)->FirstPos == Sketcher::PointPos::none && (*it)->Third == GeoEnum::GeoUndef)
|
||||
multipleIcons = true;
|
||||
break;
|
||||
case Equal:
|
||||
@@ -5089,7 +5089,7 @@ Restart:
|
||||
}
|
||||
else {
|
||||
assert(Constr->Second >= -extGeoCount && Constr->Second < intGeoCount);
|
||||
assert(Constr->FirstPos != Sketcher::none && Constr->SecondPos != Sketcher::none);
|
||||
assert(Constr->FirstPos != Sketcher::PointPos::none && Constr->SecondPos != Sketcher::PointPos::none);
|
||||
|
||||
Base::Vector3d midpos1, dir1, norm1;
|
||||
Base::Vector3d midpos2, dir2, norm2;
|
||||
@@ -5135,20 +5135,20 @@ Restart:
|
||||
|
||||
|
||||
if (Constr->Third != GeoEnum::GeoUndef || //perpty via point
|
||||
Constr->FirstPos != Sketcher::none) { //endpoint-to-curve or endpoint-to-endpoint perpty
|
||||
Constr->FirstPos != Sketcher::PointPos::none) { //endpoint-to-curve or endpoint-to-endpoint perpty
|
||||
|
||||
int ptGeoId;
|
||||
Sketcher::PointPos ptPosId;
|
||||
do {//dummy loop to use break =) Maybe goto?
|
||||
ptGeoId = Constr->First;
|
||||
ptPosId = Constr->FirstPos;
|
||||
if (ptPosId != Sketcher::none) break;
|
||||
if (ptPosId != Sketcher::PointPos::none) break;
|
||||
ptGeoId = Constr->Second;
|
||||
ptPosId = Constr->SecondPos;
|
||||
if (ptPosId != Sketcher::none) break;
|
||||
if (ptPosId != Sketcher::PointPos::none) break;
|
||||
ptGeoId = Constr->Third;
|
||||
ptPosId = Constr->ThirdPos;
|
||||
if (ptPosId != Sketcher::none) break;
|
||||
if (ptPosId != Sketcher::PointPos::none) break;
|
||||
assert(0);//no point found!
|
||||
} while (false);
|
||||
if (temp)
|
||||
@@ -5160,7 +5160,7 @@ Restart:
|
||||
norm1.Normalize();
|
||||
dir1 = norm1; dir1.RotateZ(-M_PI/2.0);
|
||||
|
||||
} else if (Constr->FirstPos == Sketcher::none) {
|
||||
} else if (Constr->FirstPos == Sketcher::PointPos::none) {
|
||||
|
||||
if (geo1->getTypeId() == Part::GeomLineSegment::getClassTypeId()) {
|
||||
const Part::GeomLineSegment *lineSeg1 = static_cast<const Part::GeomLineSegment *>(geo1);
|
||||
@@ -5418,7 +5418,7 @@ Restart:
|
||||
assert(Constr->First >= -extGeoCount && Constr->First < intGeoCount);
|
||||
|
||||
Base::Vector3d pnt1(0.,0.,0.), pnt2(0.,0.,0.);
|
||||
if (Constr->SecondPos != Sketcher::none) { // point to point distance
|
||||
if (Constr->SecondPos != Sketcher::PointPos::none) { // point to point distance
|
||||
if (temp) {
|
||||
pnt1 = getSolvedSketch().getPoint(Constr->First, Constr->FirstPos);
|
||||
pnt2 = getSolvedSketch().getPoint(Constr->Second, Constr->SecondPos);
|
||||
@@ -5442,7 +5442,7 @@ Restart:
|
||||
pnt2 += pnt1;
|
||||
} else
|
||||
break;
|
||||
} else if (Constr->FirstPos != Sketcher::none) {
|
||||
} else if (Constr->FirstPos != Sketcher::PointPos::none) {
|
||||
if (temp) {
|
||||
pnt2 = getSolvedSketch().getPoint(Constr->First, Constr->FirstPos);
|
||||
} else {
|
||||
@@ -5496,7 +5496,7 @@ Restart:
|
||||
if ( Constr->Type == PointOnObject ||
|
||||
Constr->Type == SnellsLaw ||
|
||||
(Constr->Type == Tangent && Constr->Third != GeoEnum::GeoUndef) || //Tangency via point
|
||||
(Constr->Type == Tangent && Constr->FirstPos != Sketcher::none) //endpoint-to-curve or endpoint-to-endpoint tangency
|
||||
(Constr->Type == Tangent && Constr->FirstPos != Sketcher::PointPos::none) //endpoint-to-curve or endpoint-to-endpoint tangency
|
||||
) {
|
||||
|
||||
//find the point of tangency/point that is on object
|
||||
@@ -5506,13 +5506,13 @@ Restart:
|
||||
do {//dummy loop to use break =) Maybe goto?
|
||||
ptGeoId = Constr->First;
|
||||
ptPosId = Constr->FirstPos;
|
||||
if (ptPosId != Sketcher::none) break;
|
||||
if (ptPosId != Sketcher::PointPos::none) break;
|
||||
ptGeoId = Constr->Second;
|
||||
ptPosId = Constr->SecondPos;
|
||||
if (ptPosId != Sketcher::none) break;
|
||||
if (ptPosId != Sketcher::PointPos::none) break;
|
||||
ptGeoId = Constr->Third;
|
||||
ptPosId = Constr->ThirdPos;
|
||||
if (ptPosId != Sketcher::none) break;
|
||||
if (ptPosId != Sketcher::PointPos::none) break;
|
||||
assert(0);//no point found!
|
||||
} while (false);
|
||||
pos = getSolvedSketch().getPoint(ptGeoId, ptPosId);
|
||||
@@ -5685,8 +5685,8 @@ Restart:
|
||||
const Part::GeomLineSegment *lineSeg1 = static_cast<const Part::GeomLineSegment *>(geo1);
|
||||
const Part::GeomLineSegment *lineSeg2 = static_cast<const Part::GeomLineSegment *>(geo2);
|
||||
|
||||
bool flip1 = (Constr->FirstPos == end);
|
||||
bool flip2 = (Constr->SecondPos == end);
|
||||
bool flip1 = (Constr->FirstPos == Sketcher::PointPos::end);
|
||||
bool flip2 = (Constr->SecondPos == Sketcher::PointPos::end);
|
||||
dir1 = (flip1 ? -1. : 1.) * (lineSeg1->getEndPoint()-lineSeg1->getStartPoint());
|
||||
dir2 = (flip2 ? -1. : 1.) * (lineSeg2->getEndPoint()-lineSeg2->getStartPoint());
|
||||
Base::Vector3d pnt1 = flip1 ? lineSeg1->getEndPoint() : lineSeg1->getStartPoint();
|
||||
@@ -7239,7 +7239,7 @@ bool ViewProviderSketch::onDelete(const std::vector<std::string> &subList)
|
||||
|
||||
if (*rit == GeoEnum::RtPnt) { // RootPoint
|
||||
GeoId = Sketcher::GeoEnum::RtPnt;
|
||||
PosId = start;
|
||||
PosId = Sketcher::PointPos::start;
|
||||
} else {
|
||||
getSketchObject()->getGeoVertexIndex(*rit, GeoId, PosId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user