fix whitespaces
This commit is contained in:
parent
7a3c8d0a81
commit
0955ccf594
|
@ -809,11 +809,11 @@ void GeomBSplineCurve::Save(Base::Writer& writer) const
|
|||
// save the attributes of the father class
|
||||
GeomCurve::Save(writer);
|
||||
|
||||
std::vector<Base::Vector3d> poles = this->getPoles();
|
||||
std::vector<double> weights = this->getWeights();
|
||||
std::vector<double> knots = this->getKnots();
|
||||
std::vector<int> mults = this->getMultiplicities();
|
||||
int degree = this->getDegree();
|
||||
std::vector<Base::Vector3d> poles = this->getPoles();
|
||||
std::vector<double> weights = this->getWeights();
|
||||
std::vector<double> knots = this->getKnots();
|
||||
std::vector<int> mults = this->getMultiplicities();
|
||||
int degree = this->getDegree();
|
||||
bool isperiodic = this->isPeriodic();
|
||||
|
||||
writer.Stream()
|
||||
|
@ -830,27 +830,27 @@ void GeomBSplineCurve::Save(Base::Writer& writer) const
|
|||
std::vector<Base::Vector3d>::const_iterator itp;
|
||||
std::vector<double>::const_iterator itw;
|
||||
|
||||
for(itp = poles.begin(), itw = weights.begin(); itp != poles.end() && itw != weights.end(); ++itp, ++itw){
|
||||
writer.Stream()
|
||||
<< writer.ind()
|
||||
<< "<Pole "
|
||||
<< "X=\"" << (*itp).x <<
|
||||
"\" Y=\"" << (*itp).y <<
|
||||
"\" Z=\"" << (*itp).z <<
|
||||
"\" Weight=\"" << (*itw) <<
|
||||
"\"/>" << endl;
|
||||
for (itp = poles.begin(), itw = weights.begin(); itp != poles.end() && itw != weights.end(); ++itp, ++itw) {
|
||||
writer.Stream()
|
||||
<< writer.ind()
|
||||
<< "<Pole "
|
||||
<< "X=\"" << (*itp).x <<
|
||||
"\" Y=\"" << (*itp).y <<
|
||||
"\" Z=\"" << (*itp).z <<
|
||||
"\" Weight=\"" << (*itw) <<
|
||||
"\"/>" << endl;
|
||||
}
|
||||
|
||||
std::vector<double>::const_iterator itk;
|
||||
std::vector<int>::const_iterator itm;
|
||||
|
||||
for(itk = knots.begin(), itm = mults.begin(); itk != knots.end() && itm != mults.end(); ++itk, ++itm){
|
||||
writer.Stream()
|
||||
<< writer.ind()
|
||||
<< "<Knot "
|
||||
<< "Value=\"" << (*itk)
|
||||
<< "\" Mult=\"" << (*itm) <<
|
||||
"\"/>" << endl;
|
||||
for (itk = knots.begin(), itm = mults.begin(); itk != knots.end() && itm != mults.end(); ++itk, ++itm) {
|
||||
writer.Stream()
|
||||
<< writer.ind()
|
||||
<< "<Knot "
|
||||
<< "Value=\"" << (*itk)
|
||||
<< "\" Mult=\"" << (*itm) <<
|
||||
"\"/>" << endl;
|
||||
}
|
||||
|
||||
writer.decInd();
|
||||
|
|
|
@ -67,7 +67,7 @@ enum InternalAlignmentType {
|
|||
HyperbolaMajor = 5,
|
||||
HyperbolaMinor = 6,
|
||||
HyperbolaFocus = 7,
|
||||
ParabolaFocus = 8,
|
||||
ParabolaFocus = 8,
|
||||
BSplineControlPoint = 9 // in this constraint "Third" is used to indicate the index of the control point (0-poles), it is not a GeoId
|
||||
};
|
||||
|
||||
|
@ -111,7 +111,7 @@ public:
|
|||
PointPos FirstPos;
|
||||
int Second;
|
||||
PointPos SecondPos;
|
||||
int Third;
|
||||
int Third;
|
||||
PointPos ThirdPos;
|
||||
float LabelDistance;
|
||||
float LabelPosition;
|
||||
|
|
|
@ -185,7 +185,7 @@ const char* nameByType(Sketch::GeoType type)
|
|||
case Sketch::ArcOfParabola:
|
||||
return "arcofparabola";
|
||||
case Sketch::BSpline:
|
||||
return "bspline";
|
||||
return "bspline";
|
||||
case Sketch::None:
|
||||
default:
|
||||
return "unknown";
|
||||
|
@ -738,12 +738,12 @@ int Sketch::addBSpline(const Part::GeomBSplineCurve &bspline, bool fixed)
|
|||
GCS::BSpline bs;
|
||||
bs.start = p1;
|
||||
bs.end = p2;
|
||||
bs.poles = spoles;
|
||||
bs.weights = sweights;
|
||||
bs.knots = sknots;
|
||||
bs.mult = mult;
|
||||
bs.degree = degree;
|
||||
bs.periodic = periodic;
|
||||
bs.poles = spoles;
|
||||
bs.weights = sweights;
|
||||
bs.knots = sknots;
|
||||
bs.mult = mult;
|
||||
bs.degree = degree;
|
||||
bs.periodic = periodic;
|
||||
def.index = BSplines.size();
|
||||
BSplines.push_back(bs);
|
||||
|
||||
|
@ -945,10 +945,10 @@ GCS::Curve* Sketch::getGCSCurveByGeoId(int geoId)
|
|||
case ArcOfHyperbola:
|
||||
return &ArcsOfHyperbola[Geoms[geoId].index];
|
||||
break;
|
||||
case ArcOfParabola:
|
||||
case ArcOfParabola:
|
||||
return &ArcsOfParabola[Geoms[geoId].index];
|
||||
break;
|
||||
case BSpline:
|
||||
case BSpline:
|
||||
return &BSplines[Geoms[geoId].index];
|
||||
break;
|
||||
default:
|
||||
|
@ -1213,10 +1213,10 @@ int Sketch::addConstraint(const Constraint *constraint)
|
|||
case HyperbolaFocus:
|
||||
rtn = addInternalAlignmentHyperbolaFocus(constraint->First,constraint->Second);
|
||||
break;
|
||||
case ParabolaFocus:
|
||||
case ParabolaFocus:
|
||||
rtn = addInternalAlignmentParabolaFocus(constraint->First,constraint->Second);
|
||||
break;
|
||||
case BSplineControlPoint:
|
||||
case BSplineControlPoint:
|
||||
rtn = addInternalAlignmentBSplineControlPoint(constraint->First,constraint->Second, constraint->InternalAlignmentIndex);
|
||||
default:
|
||||
break;
|
||||
|
@ -2596,43 +2596,40 @@ bool Sketch::updateGeometry()
|
|||
|
||||
Base::Vector3d fd=f1-vertex;
|
||||
|
||||
aop->setXAxisDir(fd);
|
||||
|
||||
aop->setXAxisDir(fd);
|
||||
aop->setCenter(vertex);
|
||||
|
||||
aop->setFocal(fd.Length());
|
||||
|
||||
aop->setFocal(fd.Length());
|
||||
aop->setRange(*myArc.startAngle, *myArc.endAngle, /*emulateCCW=*/true);
|
||||
} else if (it->type == BSpline) {
|
||||
GCS::BSpline &mybsp = BSplines[it->index];
|
||||
|
||||
GeomBSplineCurve *bsp = dynamic_cast<GeomBSplineCurve*>(it->geo);
|
||||
|
||||
std::vector<Base::Vector3d> poles;
|
||||
std::vector<double> weights;
|
||||
|
||||
std::vector<GCS::Point>::const_iterator it1;
|
||||
std::vector<double *>::const_iterator it2;
|
||||
std::vector<Base::Vector3d> poles;
|
||||
std::vector<double> weights;
|
||||
|
||||
for( it1 = mybsp.poles.begin(), it2 = mybsp.weights.begin(); it1 != mybsp.poles.end() && it2 != mybsp.weights.end(); ++it1, ++it2) {
|
||||
poles.push_back(Vector3d( *(*it1).x , *(*it1).y , 0.0));
|
||||
weights.push_back(*(*it2));
|
||||
}
|
||||
|
||||
bsp->setPoles(poles, weights);
|
||||
std::vector<GCS::Point>::const_iterator it1;
|
||||
std::vector<double *>::const_iterator it2;
|
||||
|
||||
std::vector<double> knots;
|
||||
std::vector<int> mult;
|
||||
|
||||
std::vector<double *>::const_iterator it3;
|
||||
std::vector<int>::const_iterator it4;
|
||||
for( it1 = mybsp.poles.begin(), it2 = mybsp.weights.begin(); it1 != mybsp.poles.end() && it2 != mybsp.weights.end(); ++it1, ++it2) {
|
||||
poles.push_back(Vector3d( *(*it1).x , *(*it1).y , 0.0));
|
||||
weights.push_back(*(*it2));
|
||||
}
|
||||
|
||||
for( it3 = mybsp.knots.begin(), it4 = mybsp.mult.begin(); it3 != mybsp.knots.end() && it4 != mybsp.mult.end(); ++it3, ++it4) {
|
||||
knots.push_back(*(*it3));
|
||||
mult.push_back((*it4));
|
||||
}
|
||||
|
||||
bsp->setKnots(knots,mult);
|
||||
bsp->setPoles(poles, weights);
|
||||
|
||||
std::vector<double> knots;
|
||||
std::vector<int> mult;
|
||||
|
||||
std::vector<double *>::const_iterator it3;
|
||||
std::vector<int>::const_iterator it4;
|
||||
|
||||
for( it3 = mybsp.knots.begin(), it4 = mybsp.mult.begin(); it3 != mybsp.knots.end() && it4 != mybsp.mult.end(); ++it3, ++it4) {
|
||||
knots.push_back(*(*it3));
|
||||
mult.push_back((*it4));
|
||||
}
|
||||
|
||||
bsp->setKnots(knots,mult);
|
||||
|
||||
}
|
||||
} catch (Base::Exception e) {
|
||||
|
@ -2937,8 +2934,7 @@ int Sketch::initMove(int geoId, PointPos pos, bool fine)
|
|||
int i=GCSsys.addConstraintP2PCoincident(p1,center,-1);
|
||||
GCSsys.rescaleConstraint(i-1, 0.01);
|
||||
GCSsys.rescaleConstraint(i, 0.01);
|
||||
}
|
||||
|
||||
}
|
||||
} else if (Geoms[geoId].type == ArcOfHyperbola) {
|
||||
|
||||
GCS::Point ¢er = Points[Geoms[geoId].midPointId];
|
||||
|
|
|
@ -343,7 +343,7 @@ public:
|
|||
ArcOfEllipse = 6,
|
||||
ArcOfHyperbola = 7,
|
||||
ArcOfParabola = 8,
|
||||
BSpline = 9
|
||||
BSpline = 9
|
||||
};
|
||||
|
||||
float SolveTime;
|
||||
|
|
|
@ -2019,7 +2019,7 @@ int SketchObject::addSymmetric(const std::vector<int> &geoIdList, int refGeoId,
|
|||
}
|
||||
else if(geosym->getTypeId() == Part::GeomCircle::getClassTypeId()){
|
||||
Part::GeomCircle *geosymcircle = static_cast<Part::GeomCircle *>(geosym);
|
||||
Base::Vector3d cp = geosymcircle->getCenter();
|
||||
Base::Vector3d cp = geosymcircle->getCenter();
|
||||
|
||||
geosymcircle->setCenter(cp+2.0*(cp.Perpendicular(refGeoLine->getStartPoint(),vectline)-cp));
|
||||
isStartEndInverted.insert(std::make_pair(*it, false));
|
||||
|
@ -2063,7 +2063,7 @@ int SketchObject::addSymmetric(const std::vector<int> &geoIdList, int refGeoId,
|
|||
Part::GeomArcOfEllipse *geosymaoe = static_cast<Part::GeomArcOfEllipse *>(geosym);
|
||||
Base::Vector3d cp = geosymaoe->getCenter();
|
||||
Base::Vector3d sp = geosymaoe->getStartPoint(true);
|
||||
Base::Vector3d ep = geosymaoe->getEndPoint(true);
|
||||
Base::Vector3d ep = geosymaoe->getEndPoint(true);
|
||||
|
||||
Base::Vector3d majdir = geosymaoe->getMajorAxisDir();
|
||||
double majord=geosymaoe->getMajorRadius();
|
||||
|
@ -2074,7 +2074,7 @@ int SketchObject::addSymmetric(const std::vector<int> &geoIdList, int refGeoId,
|
|||
Base::Vector3d sf1 = f1+2.0*(f1.Perpendicular(refGeoLine->getStartPoint(),vectline)-f1);
|
||||
Base::Vector3d scp = cp+2.0*(cp.Perpendicular(refGeoLine->getStartPoint(),vectline)-cp);
|
||||
Base::Vector3d ssp = sp+2.0*(sp.Perpendicular(refGeoLine->getStartPoint(),vectline)-sp);
|
||||
Base::Vector3d sep = ep+2.0*(ep.Perpendicular(refGeoLine->getStartPoint(),vectline)-ep);
|
||||
Base::Vector3d sep = ep+2.0*(ep.Perpendicular(refGeoLine->getStartPoint(),vectline)-ep);
|
||||
|
||||
geosymaoe->setMajorAxisDir(sf1-scp);
|
||||
|
||||
|
@ -2091,7 +2091,7 @@ int SketchObject::addSymmetric(const std::vector<int> &geoIdList, int refGeoId,
|
|||
Part::GeomArcOfHyperbola *geosymaoe = static_cast<Part::GeomArcOfHyperbola *>(geosym);
|
||||
Base::Vector3d cp = geosymaoe->getCenter();
|
||||
Base::Vector3d sp = geosymaoe->getStartPoint(true);
|
||||
Base::Vector3d ep = geosymaoe->getEndPoint(true);
|
||||
Base::Vector3d ep = geosymaoe->getEndPoint(true);
|
||||
|
||||
Base::Vector3d majdir = geosymaoe->getMajorAxisDir();
|
||||
double majord=geosymaoe->getMajorRadius();
|
||||
|
@ -2102,7 +2102,7 @@ int SketchObject::addSymmetric(const std::vector<int> &geoIdList, int refGeoId,
|
|||
Base::Vector3d sf1 = f1+2.0*(f1.Perpendicular(refGeoLine->getStartPoint(),vectline)-f1);
|
||||
Base::Vector3d scp = cp+2.0*(cp.Perpendicular(refGeoLine->getStartPoint(),vectline)-cp);
|
||||
Base::Vector3d ssp = sp+2.0*(sp.Perpendicular(refGeoLine->getStartPoint(),vectline)-sp);
|
||||
Base::Vector3d sep = ep+2.0*(ep.Perpendicular(refGeoLine->getStartPoint(),vectline)-ep);
|
||||
Base::Vector3d sep = ep+2.0*(ep.Perpendicular(refGeoLine->getStartPoint(),vectline)-ep);
|
||||
|
||||
geosymaoe->setMajorAxisDir(sf1-scp);
|
||||
|
||||
|
@ -2119,7 +2119,7 @@ int SketchObject::addSymmetric(const std::vector<int> &geoIdList, int refGeoId,
|
|||
Part::GeomArcOfParabola *geosymaoe = static_cast<Part::GeomArcOfParabola *>(geosym);
|
||||
Base::Vector3d cp = geosymaoe->getCenter();
|
||||
Base::Vector3d sp = geosymaoe->getStartPoint(true);
|
||||
Base::Vector3d ep = geosymaoe->getEndPoint(true);
|
||||
Base::Vector3d ep = geosymaoe->getEndPoint(true);
|
||||
|
||||
//double df= geosymaoe->getFocal();
|
||||
Base::Vector3d f1 = geosymaoe->getFocus();
|
||||
|
@ -2129,10 +2129,9 @@ int SketchObject::addSymmetric(const std::vector<int> &geoIdList, int refGeoId,
|
|||
Base::Vector3d ssp = sp+2.0*(sp.Perpendicular(refGeoLine->getStartPoint(),vectline)-sp);
|
||||
Base::Vector3d sep = ep+2.0*(ep.Perpendicular(refGeoLine->getStartPoint(),vectline)-ep);
|
||||
|
||||
geosymaoe->setXAxisDir(sf1-scp);
|
||||
|
||||
geosymaoe->setXAxisDir(sf1-scp);
|
||||
geosymaoe->setCenter(scp);
|
||||
|
||||
|
||||
double theta1,theta2;
|
||||
geosymaoe->closestParameter(sep,theta1);
|
||||
geosymaoe->closestParameter(ssp,theta2);
|
||||
|
@ -2237,7 +2236,7 @@ int SketchObject::addSymmetric(const std::vector<int> &geoIdList, int refGeoId,
|
|||
case Sketcher::mid:
|
||||
if(georef->getTypeId() == Part::GeomCircle::getClassTypeId()){
|
||||
const Part::GeomCircle *geosymcircle = static_cast<const Part::GeomCircle *>(georef);
|
||||
refpoint = geosymcircle->getCenter();
|
||||
refpoint = geosymcircle->getCenter();
|
||||
}
|
||||
else if(georef->getTypeId() == Part::GeomArcOfCircle::getClassTypeId()){
|
||||
const Part::GeomArcOfCircle *geoaoc = static_cast<const Part::GeomArcOfCircle *>(georef);
|
||||
|
@ -2276,14 +2275,14 @@ int SketchObject::addSymmetric(const std::vector<int> &geoIdList, int refGeoId,
|
|||
Base::Vector3d sp = geosymline->getStartPoint();
|
||||
Base::Vector3d ep = geosymline->getEndPoint();
|
||||
Base::Vector3d ssp = sp + 2.0*(refpoint-sp);
|
||||
Base::Vector3d sep = ep + 2.0*(refpoint-ep);
|
||||
Base::Vector3d sep = ep + 2.0*(refpoint-ep);
|
||||
|
||||
geosymline->setPoints(ssp, sep);
|
||||
isStartEndInverted.insert(std::make_pair(*it, false));
|
||||
}
|
||||
else if(geosym->getTypeId() == Part::GeomCircle::getClassTypeId()){
|
||||
Part::GeomCircle *geosymcircle = static_cast<Part::GeomCircle *>(geosym);
|
||||
Base::Vector3d cp = geosymcircle->getCenter();
|
||||
Base::Vector3d cp = geosymcircle->getCenter();
|
||||
|
||||
geosymcircle->setCenter(cp + 2.0*(refpoint-cp));
|
||||
isStartEndInverted.insert(std::make_pair(*it, false));
|
||||
|
@ -2327,7 +2326,7 @@ int SketchObject::addSymmetric(const std::vector<int> &geoIdList, int refGeoId,
|
|||
Part::GeomArcOfEllipse *geosymaoe = static_cast<Part::GeomArcOfEllipse *>(geosym);
|
||||
Base::Vector3d cp = geosymaoe->getCenter();
|
||||
Base::Vector3d sp = geosymaoe->getStartPoint(true);
|
||||
Base::Vector3d ep = geosymaoe->getEndPoint(true);
|
||||
Base::Vector3d ep = geosymaoe->getEndPoint(true);
|
||||
|
||||
Base::Vector3d majdir = geosymaoe->getMajorAxisDir();
|
||||
double majord=geosymaoe->getMajorRadius();
|
||||
|
@ -2355,7 +2354,7 @@ int SketchObject::addSymmetric(const std::vector<int> &geoIdList, int refGeoId,
|
|||
Part::GeomArcOfHyperbola *geosymaoe = static_cast<Part::GeomArcOfHyperbola *>(geosym);
|
||||
Base::Vector3d cp = geosymaoe->getCenter();
|
||||
Base::Vector3d sp = geosymaoe->getStartPoint(true);
|
||||
Base::Vector3d ep = geosymaoe->getEndPoint(true);
|
||||
Base::Vector3d ep = geosymaoe->getEndPoint(true);
|
||||
|
||||
Base::Vector3d majdir = geosymaoe->getMajorAxisDir();
|
||||
double majord=geosymaoe->getMajorRadius();
|
||||
|
@ -2383,18 +2382,17 @@ int SketchObject::addSymmetric(const std::vector<int> &geoIdList, int refGeoId,
|
|||
Part::GeomArcOfParabola *geosymaoe = static_cast<Part::GeomArcOfParabola *>(geosym);
|
||||
Base::Vector3d cp = geosymaoe->getCenter();
|
||||
Base::Vector3d sp = geosymaoe->getStartPoint(true);
|
||||
Base::Vector3d ep = geosymaoe->getEndPoint(true);
|
||||
Base::Vector3d ep = geosymaoe->getEndPoint(true);
|
||||
|
||||
/*double df= geosymaoe->getFocal();*/
|
||||
Base::Vector3d f1 = geosymaoe->getFocus();
|
||||
Base::Vector3d f1 = geosymaoe->getFocus();
|
||||
|
||||
Base::Vector3d sf1 = f1 + 2.0*(refpoint-f1);
|
||||
Base::Vector3d scp = cp + 2.0*(refpoint-cp);
|
||||
Base::Vector3d ssp = sp + 2.0*(refpoint-sp);
|
||||
Base::Vector3d sep = ep + 2.0*(refpoint-ep);
|
||||
|
||||
geosymaoe->setXAxisDir(sf1-scp);
|
||||
|
||||
geosymaoe->setXAxisDir(sf1-scp);
|
||||
geosymaoe->setCenter(scp);
|
||||
|
||||
double theta1,theta2;
|
||||
|
@ -2641,7 +2639,7 @@ int SketchObject::addCopy(const std::vector<int> &geoIdList, const Base::Vector3
|
|||
else if(geocopy->getTypeId() == Part::GeomArcOfEllipse::getClassTypeId()){
|
||||
Part::GeomArcOfEllipse *geoaoe = static_cast<Part::GeomArcOfEllipse *>(geocopy);
|
||||
Base::Vector3d cp = geoaoe->getCenter();
|
||||
Base::Vector3d scp = cp+double(x)*displacement+double(y)*perpendicularDisplacement;
|
||||
Base::Vector3d scp = cp+double(x)*displacement+double(y)*perpendicularDisplacement;
|
||||
|
||||
geoaoe->setCenter(scp);
|
||||
|
||||
|
@ -2651,7 +2649,7 @@ int SketchObject::addCopy(const std::vector<int> &geoIdList, const Base::Vector3
|
|||
else if(geocopy->getTypeId() == Part::GeomArcOfHyperbola::getClassTypeId()){
|
||||
Part::GeomArcOfHyperbola *geoaoe = static_cast<Part::GeomArcOfHyperbola *>(geocopy);
|
||||
Base::Vector3d cp = geoaoe->getCenter();
|
||||
Base::Vector3d scp = cp+double(x)*displacement+double(y)*perpendicularDisplacement;
|
||||
Base::Vector3d scp = cp+double(x)*displacement+double(y)*perpendicularDisplacement;
|
||||
|
||||
geoaoe->setCenter(scp);
|
||||
|
||||
|
@ -2661,7 +2659,7 @@ int SketchObject::addCopy(const std::vector<int> &geoIdList, const Base::Vector3
|
|||
else if(geocopy->getTypeId() == Part::GeomArcOfParabola::getClassTypeId()){
|
||||
Part::GeomArcOfParabola *geoaoe = static_cast<Part::GeomArcOfParabola *>(geocopy);
|
||||
Base::Vector3d cp = geoaoe->getCenter();
|
||||
Base::Vector3d scp = cp+double(x)*displacement+double(y)*perpendicularDisplacement;
|
||||
Base::Vector3d scp = cp+double(x)*displacement+double(y)*perpendicularDisplacement;
|
||||
|
||||
geoaoe->setCenter(scp);
|
||||
|
||||
|
@ -3222,8 +3220,8 @@ int SketchObject::ExposeInternalGeometry(int GeoId)
|
|||
else if(geo->getTypeId() == Part::GeomArcOfParabola::getClassTypeId()) {
|
||||
// First we search what has to be restored
|
||||
bool focus=false;
|
||||
int focusgeoid=-1;
|
||||
bool focus_to_vertex=false;
|
||||
int focusgeoid=-1;
|
||||
bool focus_to_vertex=false;
|
||||
|
||||
const std::vector< Sketcher::Constraint * > &vals = Constraints.getValues();
|
||||
|
||||
|
@ -3234,7 +3232,7 @@ int SketchObject::ExposeInternalGeometry(int GeoId)
|
|||
switch((*it)->AlignmentType){
|
||||
case Sketcher::ParabolaFocus:
|
||||
focus=true;
|
||||
focusgeoid=(*it)->First;
|
||||
focusgeoid=(*it)->First;
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
|
@ -3243,37 +3241,33 @@ int SketchObject::ExposeInternalGeometry(int GeoId)
|
|||
}
|
||||
|
||||
if(focus) {
|
||||
// look for a line from focusgeoid:start to Geoid:mid_external
|
||||
std::vector<int> focusgeoidlistgeoidlist;
|
||||
std::vector<PointPos> focusposidlist;
|
||||
getDirectlyCoincidentPoints(focusgeoid, Sketcher::start, focusgeoidlistgeoidlist,
|
||||
focusposidlist);
|
||||
|
||||
std::vector<int> parabgeoidlistgeoidlist;
|
||||
std::vector<PointPos> parabposidlist;
|
||||
getDirectlyCoincidentPoints(GeoId, Sketcher::mid, parabgeoidlistgeoidlist,
|
||||
// look for a line from focusgeoid:start to Geoid:mid_external
|
||||
std::vector<int> focusgeoidlistgeoidlist;
|
||||
std::vector<PointPos> focusposidlist;
|
||||
getDirectlyCoincidentPoints(focusgeoid, Sketcher::start, focusgeoidlistgeoidlist,
|
||||
focusposidlist);
|
||||
|
||||
std::vector<int> parabgeoidlistgeoidlist;
|
||||
std::vector<PointPos> parabposidlist;
|
||||
getDirectlyCoincidentPoints(GeoId, Sketcher::mid, parabgeoidlistgeoidlist,
|
||||
parabposidlist);
|
||||
|
||||
if (!focusgeoidlistgeoidlist.empty() && !parabgeoidlistgeoidlist.empty()) {
|
||||
|
||||
std::size_t i,j;
|
||||
for(i=0;i<focusgeoidlistgeoidlist.size();i++){
|
||||
for(j=0;j<parabgeoidlistgeoidlist.size();j++) {
|
||||
if(focusgeoidlistgeoidlist[i] == parabgeoidlistgeoidlist[j]) {
|
||||
const Part::Geometry * geo = getGeometry(focusgeoidlistgeoidlist[i]);
|
||||
|
||||
if ( geo && geo->getTypeId() == Part::GeomLineSegment::getClassTypeId()) {
|
||||
|
||||
if((focusposidlist[i] == Sketcher::start && parabposidlist[j] == Sketcher::end) ||
|
||||
(focusposidlist[i] == Sketcher::end && parabposidlist[j] == Sketcher::start))
|
||||
|
||||
focus_to_vertex=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!focusgeoidlistgeoidlist.empty() && !parabgeoidlistgeoidlist.empty()) {
|
||||
std::size_t i,j;
|
||||
for(i=0;i<focusgeoidlistgeoidlist.size();i++) {
|
||||
for(j=0;j<parabgeoidlistgeoidlist.size();j++) {
|
||||
if(focusgeoidlistgeoidlist[i] == parabgeoidlistgeoidlist[j]) {
|
||||
const Part::Geometry * geo = getGeometry(focusgeoidlistgeoidlist[i]);
|
||||
if (geo && geo->getTypeId() == Part::GeomLineSegment::getClassTypeId()) {
|
||||
if((focusposidlist[i] == Sketcher::start && parabposidlist[j] == Sketcher::end) ||
|
||||
(focusposidlist[i] == Sketcher::end && parabposidlist[j] == Sketcher::start))
|
||||
focus_to_vertex=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int currentgeoid= getHighestCurveIndex();
|
||||
int incrgeo= 0;
|
||||
|
@ -3286,8 +3280,7 @@ int SketchObject::ExposeInternalGeometry(int GeoId)
|
|||
std::vector<Part::Geometry *> igeo;
|
||||
std::vector<Constraint *> icon;
|
||||
|
||||
if(!focus)
|
||||
{
|
||||
if (!focus) {
|
||||
Part::GeomPoint *pf1 = new Part::GeomPoint();
|
||||
pf1->setPoint(focusp);
|
||||
|
||||
|
@ -3300,7 +3293,7 @@ int SketchObject::ExposeInternalGeometry(int GeoId)
|
|||
newConstr->FirstPos = Sketcher::start;
|
||||
newConstr->Second = GeoId;
|
||||
|
||||
focusgeoid = currentgeoid+incrgeo+1;
|
||||
focusgeoid = currentgeoid+incrgeo+1;
|
||||
|
||||
icon.push_back(newConstr);
|
||||
incrgeo++;
|
||||
|
@ -3316,18 +3309,18 @@ int SketchObject::ExposeInternalGeometry(int GeoId)
|
|||
Sketcher::Constraint *newConstr = new Sketcher::Constraint();
|
||||
newConstr->Type = Sketcher::Coincident;
|
||||
newConstr->First = focusgeoid;
|
||||
newConstr->FirstPos = Sketcher::start;
|
||||
newConstr->FirstPos = Sketcher::start;
|
||||
newConstr->Second = currentgeoid+incrgeo+1; // just added line
|
||||
newConstr->SecondPos = Sketcher::end;
|
||||
|
||||
icon.push_back(newConstr);
|
||||
icon.push_back(newConstr);
|
||||
|
||||
Sketcher::Constraint *newConstr2 = new Sketcher::Constraint();
|
||||
newConstr2->Type = Sketcher::Coincident;
|
||||
newConstr2->First = GeoId;
|
||||
newConstr2->FirstPos = Sketcher::mid;
|
||||
newConstr2->FirstPos = Sketcher::mid;
|
||||
newConstr2->Second = currentgeoid+incrgeo+1; // just added line
|
||||
newConstr2->SecondPos = Sketcher::start;
|
||||
newConstr2->SecondPos = Sketcher::start;
|
||||
|
||||
icon.push_back(newConstr2);
|
||||
|
||||
|
@ -3337,16 +3330,18 @@ int SketchObject::ExposeInternalGeometry(int GeoId)
|
|||
this->addGeometry(igeo,true);
|
||||
this->addConstraints(icon);
|
||||
|
||||
for (std::vector<Part::Geometry *>::iterator it=igeo.begin(); it != igeo.end(); ++it)
|
||||
if (*it)
|
||||
for (std::vector<Part::Geometry *>::iterator it=igeo.begin(); it != igeo.end(); ++it) {
|
||||
if (*it)
|
||||
delete *it;
|
||||
}
|
||||
|
||||
for (std::vector<Constraint *>::iterator it=icon.begin(); it != icon.end(); ++it)
|
||||
if (*it)
|
||||
delete *it;
|
||||
for (std::vector<Constraint *>::iterator it=icon.begin(); it != icon.end(); ++it) {
|
||||
if (*it)
|
||||
delete *it;
|
||||
}
|
||||
|
||||
icon.clear();
|
||||
igeo.clear();
|
||||
icon.clear();
|
||||
igeo.clear();
|
||||
|
||||
return incrgeo; //number of added elements
|
||||
}
|
||||
|
@ -3486,9 +3481,9 @@ int SketchObject::DeleteUnusedInternalGeometry(int GeoId)
|
|||
|
||||
const Part::Geometry *geo = getGeometry(GeoId);
|
||||
// Only for supported types
|
||||
if( geo->getTypeId() == Part::GeomEllipse::getClassTypeId() ||
|
||||
geo->getTypeId() == Part::GeomArcOfEllipse::getClassTypeId() ||
|
||||
geo->getTypeId() == Part::GeomArcOfHyperbola::getClassTypeId()) {
|
||||
if (geo->getTypeId() == Part::GeomEllipse::getClassTypeId() ||
|
||||
geo->getTypeId() == Part::GeomArcOfEllipse::getClassTypeId() ||
|
||||
geo->getTypeId() == Part::GeomArcOfHyperbola::getClassTypeId()) {
|
||||
|
||||
int majorelementindex=-1;
|
||||
int minorelementindex=-1;
|
||||
|
@ -3503,15 +3498,15 @@ int SketchObject::DeleteUnusedInternalGeometry(int GeoId)
|
|||
{
|
||||
switch((*it)->AlignmentType){
|
||||
case Sketcher::EllipseMajorDiameter:
|
||||
case Sketcher::HyperbolaMajor:
|
||||
case Sketcher::HyperbolaMajor:
|
||||
majorelementindex=(*it)->First;
|
||||
break;
|
||||
case Sketcher::EllipseMinorDiameter:
|
||||
case Sketcher::HyperbolaMinor:
|
||||
case Sketcher::HyperbolaMinor:
|
||||
minorelementindex=(*it)->First;
|
||||
break;
|
||||
case Sketcher::EllipseFocus1:
|
||||
case Sketcher::HyperbolaFocus:
|
||||
case Sketcher::HyperbolaFocus:
|
||||
focus1elementindex=(*it)->First;
|
||||
break;
|
||||
case Sketcher::EllipseFocus2:
|
||||
|
@ -3569,9 +3564,9 @@ int SketchObject::DeleteUnusedInternalGeometry(int GeoId)
|
|||
return delgeometries.size(); //number of deleted elements
|
||||
}
|
||||
else if( geo->getTypeId() == Part::GeomArcOfParabola::getClassTypeId()) {
|
||||
// if the focus-to-vertex line is constrained, then never delete the focus
|
||||
// if the line is unconstrained, then the line may be deleted,
|
||||
// in this case the focus may be deleted if unconstrained.
|
||||
// if the focus-to-vertex line is constrained, then never delete the focus
|
||||
// if the line is unconstrained, then the line may be deleted,
|
||||
// in this case the focus may be deleted if unconstrained.
|
||||
int majorelementindex=-1;
|
||||
int focus1elementindex=-1;
|
||||
|
||||
|
@ -3592,37 +3587,33 @@ int SketchObject::DeleteUnusedInternalGeometry(int GeoId)
|
|||
}
|
||||
|
||||
if(focus1elementindex!=-1) {
|
||||
// look for a line from focusgeoid:start to Geoid:mid_external
|
||||
std::vector<int> focusgeoidlistgeoidlist;
|
||||
std::vector<PointPos> focusposidlist;
|
||||
getDirectlyCoincidentPoints(focus1elementindex, Sketcher::start, focusgeoidlistgeoidlist,
|
||||
focusposidlist);
|
||||
|
||||
std::vector<int> parabgeoidlistgeoidlist;
|
||||
std::vector<PointPos> parabposidlist;
|
||||
getDirectlyCoincidentPoints(GeoId, Sketcher::mid, parabgeoidlistgeoidlist,
|
||||
// look for a line from focusgeoid:start to Geoid:mid_external
|
||||
std::vector<int> focusgeoidlistgeoidlist;
|
||||
std::vector<PointPos> focusposidlist;
|
||||
getDirectlyCoincidentPoints(focus1elementindex, Sketcher::start, focusgeoidlistgeoidlist,
|
||||
focusposidlist);
|
||||
|
||||
std::vector<int> parabgeoidlistgeoidlist;
|
||||
std::vector<PointPos> parabposidlist;
|
||||
getDirectlyCoincidentPoints(GeoId, Sketcher::mid, parabgeoidlistgeoidlist,
|
||||
parabposidlist);
|
||||
|
||||
if (!focusgeoidlistgeoidlist.empty() && !parabgeoidlistgeoidlist.empty()) {
|
||||
|
||||
std::size_t i,j;
|
||||
for(i=0;i<focusgeoidlistgeoidlist.size();i++){
|
||||
for(j=0;j<parabgeoidlistgeoidlist.size();j++) {
|
||||
if(focusgeoidlistgeoidlist[i] == parabgeoidlistgeoidlist[j]) {
|
||||
const Part::Geometry * geo = getGeometry(focusgeoidlistgeoidlist[i]);
|
||||
|
||||
if ( geo && geo->getTypeId() == Part::GeomLineSegment::getClassTypeId()) {
|
||||
|
||||
if((focusposidlist[i] == Sketcher::start && parabposidlist[j] == Sketcher::end) ||
|
||||
(focusposidlist[i] == Sketcher::end && parabposidlist[j] == Sketcher::start))
|
||||
|
||||
majorelementindex = focusgeoidlistgeoidlist[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!focusgeoidlistgeoidlist.empty() && !parabgeoidlistgeoidlist.empty()) {
|
||||
std::size_t i,j;
|
||||
for(i=0;i<focusgeoidlistgeoidlist.size();i++){
|
||||
for(j=0;j<parabgeoidlistgeoidlist.size();j++) {
|
||||
if(focusgeoidlistgeoidlist[i] == parabgeoidlistgeoidlist[j]) {
|
||||
const Part::Geometry * geo = getGeometry(focusgeoidlistgeoidlist[i]);
|
||||
if (geo && geo->getTypeId() == Part::GeomLineSegment::getClassTypeId()) {
|
||||
if((focusposidlist[i] == Sketcher::start && parabposidlist[j] == Sketcher::end) ||
|
||||
(focusposidlist[i] == Sketcher::end && parabposidlist[j] == Sketcher::start))
|
||||
majorelementindex = focusgeoidlistgeoidlist[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Hide unused geometry here
|
||||
int majorconstraints=0; // number of constraints associated to the geoid of the major axis other than the coincident ones
|
||||
|
@ -3632,22 +3623,22 @@ int SketchObject::DeleteUnusedInternalGeometry(int GeoId)
|
|||
it != vals.end(); ++it) {
|
||||
|
||||
if( (*it)->Second == majorelementindex ||
|
||||
(*it)->First == majorelementindex ||
|
||||
(*it)->Third == majorelementindex)
|
||||
(*it)->First == majorelementindex ||
|
||||
(*it)->Third == majorelementindex)
|
||||
majorconstraints++;
|
||||
else if( (*it)->Second == focus1elementindex ||
|
||||
(*it)->First == focus1elementindex ||
|
||||
(*it)->Third == focus1elementindex)
|
||||
else if ((*it)->Second == focus1elementindex ||
|
||||
(*it)->First == focus1elementindex ||
|
||||
(*it)->Third == focus1elementindex)
|
||||
focus1constraints++;
|
||||
}
|
||||
|
||||
std::vector<int> delgeometries;
|
||||
|
||||
if(majorelementindex !=-1 && majorconstraints<3) { // major as two coincidents to focus and vertex
|
||||
if (majorelementindex !=-1 && majorconstraints<3) { // major as two coincidents to focus and vertex
|
||||
delgeometries.push_back(majorelementindex);
|
||||
majorelementindex = -1;
|
||||
}
|
||||
|
||||
majorelementindex = -1;
|
||||
}
|
||||
|
||||
if(majorelementindex == -1 && focus1elementindex !=-1 && focus1constraints<3) // focus has one coincident and one internal align
|
||||
delgeometries.push_back(focus1elementindex);
|
||||
|
||||
|
@ -4306,7 +4297,7 @@ void SketchObject::rebuildExternalGeometry(void)
|
|||
ExternalGeo.push_back(circle);
|
||||
} else {
|
||||
throw Base::Exception("BSpline: Not yet supported geometry for external geometry");
|
||||
}
|
||||
}
|
||||
} else if (projCurve.GetType() == GeomAbs_Hyperbola) {
|
||||
gp_Hypr e = projCurve.Hyperbola();
|
||||
gp_Pnt p = e.Location();
|
||||
|
@ -4472,7 +4463,7 @@ void SketchObject::rebuildVertexIndex(void)
|
|||
VertexId2GeoId.push_back(i);
|
||||
VertexId2PosId.push_back(end);
|
||||
VertexId2GeoId.push_back(i);
|
||||
VertexId2PosId.push_back(mid);
|
||||
VertexId2PosId.push_back(mid);
|
||||
} else if ((*it)->getTypeId() == Part::GeomArcOfHyperbola::getClassTypeId()) {
|
||||
VertexId2GeoId.push_back(i);
|
||||
VertexId2PosId.push_back(start);
|
||||
|
|
|
@ -168,7 +168,7 @@ PyObject* SketchObjectPy::addGeometry(PyObject *args)
|
|||
geo->getTypeId() == Part::GeomArcOfEllipse::getClassTypeId() ||
|
||||
geo->getTypeId() == Part::GeomArcOfHyperbola::getClassTypeId() ||
|
||||
geo->getTypeId() == Part::GeomArcOfParabola::getClassTypeId() ||
|
||||
geo->getTypeId() == Part::GeomBSplineCurve::getClassTypeId() ||
|
||||
geo->getTypeId() == Part::GeomBSplineCurve::getClassTypeId() ||
|
||||
geo->getTypeId() == Part::GeomLineSegment::getClassTypeId()) {
|
||||
geoList.push_back(geo);
|
||||
}
|
||||
|
@ -884,17 +884,15 @@ PyObject* SketchObjectPy::addRectangularArray(PyObject *args)
|
|||
std::vector<int> geoIdList;
|
||||
Py::Sequence list(pcObj);
|
||||
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
|
||||
if (PyInt_Check((*it).ptr()))
|
||||
geoIdList.push_back(PyInt_AsLong((*it).ptr()));
|
||||
if (PyInt_Check((*it).ptr()))
|
||||
geoIdList.push_back(PyInt_AsLong((*it).ptr()));
|
||||
}
|
||||
|
||||
int ret = this->getSketchObjectPtr()->addCopy(geoIdList,vect, PyObject_IsTrue(clone) ? true : false,
|
||||
rows, cols, PyObject_IsTrue(constraindisplacement) ? true : false, perpscale) + 1;
|
||||
|
||||
if(ret == -1)
|
||||
throw Py::TypeError("Copy operation unsuccessful!");
|
||||
|
||||
|
||||
if(ret == -1)
|
||||
throw Py::TypeError("Copy operation unsuccessful!");
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
|
|
|
@ -672,8 +672,8 @@ int BSpline::PushOwnParams(VEC_pD &pvec)
|
|||
int cnt=0;
|
||||
|
||||
for(VEC_P::const_iterator it = poles.begin(); it != poles.end(); ++it) {
|
||||
pvec.push_back( (*it).x );
|
||||
pvec.push_back( (*it).y );
|
||||
pvec.push_back( (*it).x );
|
||||
pvec.push_back( (*it).y );
|
||||
}
|
||||
|
||||
cnt = cnt + poles.size() * 2;
|
||||
|
@ -695,16 +695,16 @@ int BSpline::PushOwnParams(VEC_pD &pvec)
|
|||
void BSpline::ReconstructOnNewPvec(VEC_pD &pvec, int &cnt)
|
||||
{
|
||||
for(VEC_P::iterator it = poles.begin(); it != poles.end(); ++it) {
|
||||
(*it).x = pvec[cnt]; cnt++;
|
||||
(*it).y = pvec[cnt]; cnt++;
|
||||
(*it).x = pvec[cnt]; cnt++;
|
||||
(*it).y = pvec[cnt]; cnt++;
|
||||
}
|
||||
|
||||
for(VEC_pD::iterator it = weights.begin(); it != weights.end(); ++it) {
|
||||
(*it) = pvec[cnt]; cnt++;
|
||||
(*it) = pvec[cnt]; cnt++;
|
||||
}
|
||||
|
||||
for(VEC_pD::iterator it = knots.begin(); it != knots.end(); ++it) {
|
||||
(*it) = pvec[cnt]; cnt++;
|
||||
(*it) = pvec[cnt]; cnt++;
|
||||
}
|
||||
|
||||
start.x=pvec[cnt]; cnt++;
|
||||
|
|
|
@ -231,12 +231,12 @@ namespace GCS
|
|||
public:
|
||||
ArcOfHyperbola(){startAngle=0;endAngle=0;radmin = 0;}
|
||||
virtual ~ArcOfHyperbola(){}
|
||||
// parameters
|
||||
// parameters
|
||||
double *startAngle;
|
||||
double *endAngle;
|
||||
Point start;
|
||||
Point end;
|
||||
// interface helpers
|
||||
// interface helpers
|
||||
virtual int PushOwnParams(VEC_pD &pvec);
|
||||
virtual void ReconstructOnNewPvec (VEC_pD &pvec, int &cnt);
|
||||
virtual ArcOfHyperbola* Copy();
|
||||
|
@ -261,12 +261,12 @@ namespace GCS
|
|||
public:
|
||||
ArcOfParabola(){startAngle=0;endAngle=0;}
|
||||
virtual ~ArcOfParabola(){}
|
||||
// parameters
|
||||
// parameters
|
||||
double *startAngle;
|
||||
double *endAngle;
|
||||
Point start;
|
||||
Point end;
|
||||
// interface helpers
|
||||
// interface helpers
|
||||
virtual int PushOwnParams(VEC_pD &pvec);
|
||||
virtual void ReconstructOnNewPvec (VEC_pD &pvec, int &cnt);
|
||||
virtual ArcOfParabola* Copy();
|
||||
|
@ -277,21 +277,21 @@ namespace GCS
|
|||
public:
|
||||
BSpline(){periodic=false;degree=2;}
|
||||
virtual ~BSpline(){}
|
||||
// parameters
|
||||
VEC_P poles;
|
||||
VEC_pD weights;
|
||||
VEC_pD knots;
|
||||
// dependent parameters (depends on previous parameters,
|
||||
// but an "arcrules" constraint alike would be required to gain the commodity of simple coincident
|
||||
// with endpoint constraints)
|
||||
// parameters
|
||||
VEC_P poles;
|
||||
VEC_pD weights;
|
||||
VEC_pD knots;
|
||||
// dependent parameters (depends on previous parameters,
|
||||
// but an "arcrules" constraint alike would be required to gain the commodity of simple coincident
|
||||
// with endpoint constraints)
|
||||
Point start;
|
||||
Point end;
|
||||
// not solver parameters
|
||||
VEC_I mult;
|
||||
int degree;
|
||||
bool periodic;
|
||||
// interface helpers
|
||||
DeriVector2 CalculateNormal(Point &p, double* derivparam = 0);
|
||||
// not solver parameters
|
||||
VEC_I mult;
|
||||
int degree;
|
||||
bool periodic;
|
||||
// interface helpers
|
||||
DeriVector2 CalculateNormal(Point &p, double* derivparam = 0);
|
||||
virtual DeriVector2 Value(double u, double du, double* derivparam = 0);
|
||||
virtual int PushOwnParams(VEC_pD &pvec);
|
||||
virtual void ReconstructOnNewPvec (VEC_pD &pvec, int &cnt);
|
||||
|
|
|
@ -3078,8 +3078,8 @@ void CmdSketcherConstrainTangent::activated(int iMsg)
|
|||
geom1 = Obj->getGeometry(GeoId1);
|
||||
geom2 = Obj->getGeometry(GeoId2);
|
||||
|
||||
if( geom2->getTypeId() == Part::GeomArcOfParabola::getClassTypeId() ||
|
||||
geom2->getTypeId() == Part::GeomArcOfHyperbola::getClassTypeId() ||
|
||||
if (geom2->getTypeId() == Part::GeomArcOfParabola::getClassTypeId() ||
|
||||
geom2->getTypeId() == Part::GeomArcOfHyperbola::getClassTypeId() ||
|
||||
geom2->getTypeId() == Part::GeomArcOfEllipse::getClassTypeId() ||
|
||||
geom2->getTypeId() == Part::GeomCircle::getClassTypeId() ||
|
||||
geom2->getTypeId() == Part::GeomArcOfCircle::getClassTypeId() ||
|
||||
|
|
|
@ -4388,7 +4388,6 @@ public:
|
|||
CurrentConstraint++;
|
||||
}
|
||||
else if (Mode == STATUS_SEEK_ADDITIONAL_CONTROLPOINTS) {
|
||||
|
||||
EditCurve[EditCurve.size()-1] = onSketchPos;
|
||||
|
||||
// finish adding controlpoints on double click
|
||||
|
@ -4413,23 +4412,23 @@ public:
|
|||
unsetCursor();
|
||||
resetPositionText();
|
||||
|
||||
std::stringstream stream;
|
||||
std::stringstream stream;
|
||||
|
||||
for (std::vector<Base::Vector2d>::const_iterator it=EditCurve.begin();
|
||||
it != EditCurve.end(); ++it) {
|
||||
stream << "App.Vector(" << (*it).x << "," << (*it).y << "),";
|
||||
}
|
||||
for (std::vector<Base::Vector2d>::const_iterator it=EditCurve.begin();
|
||||
it != EditCurve.end(); ++it) {
|
||||
stream << "App.Vector(" << (*it).x << "," << (*it).y << "),";
|
||||
}
|
||||
|
||||
std::string controlpoints = stream.str();
|
||||
std::string controlpoints = stream.str();
|
||||
|
||||
// remove last comma and add brackets
|
||||
int index = controlpoints.rfind(',');
|
||||
controlpoints.resize(index);
|
||||
// remove last comma and add brackets
|
||||
int index = controlpoints.rfind(',');
|
||||
controlpoints.resize(index);
|
||||
|
||||
controlpoints.insert(0,1,'[');
|
||||
controlpoints.append(1,']');
|
||||
controlpoints.insert(0,1,'[');
|
||||
controlpoints.append(1,']');
|
||||
|
||||
int currentgeoid = getHighestCurveIndex();
|
||||
int currentgeoid = getHighestCurveIndex();
|
||||
|
||||
try {
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/***************************************************************************
|
||||
* Copyright (c) 2014 Abdullah Tahiri <abdullah.tahiri.yo@gmail.com *
|
||||
* Copyright (c) 2014 Abdullah Tahiri <abdullah.tahiri.yo@gmail.com *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
|
@ -136,7 +136,7 @@ void CmdSketcherCloseShape::activated(int iMsg)
|
|||
for (unsigned int i=0; i<(SubNames.size()-1); i++ ) {
|
||||
// only handle edges
|
||||
if (SubNames[i].size() > 4 && SubNames[i].substr(0,4) == "Edge" &&
|
||||
SubNames[i+1].size() > 4 && SubNames[i+1].substr(0,4) == "Edge" ) {
|
||||
SubNames[i+1].size() > 4 && SubNames[i+1].substr(0,4) == "Edge") {
|
||||
|
||||
int GeoId1 = std::atoi(SubNames[i].substr(4,4000).c_str()) - 1;
|
||||
int GeoId2 = std::atoi(SubNames[i+1].substr(4,4000).c_str()) - 1;
|
||||
|
@ -149,9 +149,9 @@ void CmdSketcherCloseShape::activated(int iMsg)
|
|||
const Part::Geometry *geo1 = Obj->getGeometry(GeoId1);
|
||||
const Part::Geometry *geo2 = Obj->getGeometry(GeoId2);
|
||||
if ((geo1->getTypeId() != Part::GeomLineSegment::getClassTypeId() &&
|
||||
geo1->getTypeId() != Part::GeomArcOfCircle::getClassTypeId() ) ||
|
||||
geo1->getTypeId() != Part::GeomArcOfCircle::getClassTypeId()) ||
|
||||
(geo2->getTypeId() != Part::GeomLineSegment::getClassTypeId() &&
|
||||
geo2->getTypeId() != Part::GeomArcOfCircle::getClassTypeId()) ) {
|
||||
geo2->getTypeId() != Part::GeomArcOfCircle::getClassTypeId())) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Impossible constraint"),
|
||||
QObject::tr("One selected edge is not connectable"));
|
||||
abortCommand();
|
||||
|
@ -244,7 +244,7 @@ void CmdSketcherConnect::activated(int iMsg)
|
|||
for (unsigned int i=0; i<(SubNames.size()-1); i++ ) {
|
||||
// only handle edges
|
||||
if (SubNames[i].size() > 4 && SubNames[i].substr(0,4) == "Edge" &&
|
||||
SubNames[i+1].size() > 4 && SubNames[i+1].substr(0,4) == "Edge" ) {
|
||||
SubNames[i+1].size() > 4 && SubNames[i+1].substr(0,4) == "Edge") {
|
||||
|
||||
int GeoId1 = std::atoi(SubNames[i].substr(4,4000).c_str()) - 1;
|
||||
int GeoId2 = std::atoi(SubNames[i+1].substr(4,4000).c_str()) - 1;
|
||||
|
@ -762,58 +762,56 @@ void CmdSketcherRestoreInternalAlignmentGeometry::activated(int iMsg)
|
|||
|
||||
const Part::Geometry *geo = Obj->getGeometry(GeoId);
|
||||
// Only for supported types
|
||||
if( geo->getTypeId() == Part::GeomEllipse::getClassTypeId() ||
|
||||
geo->getTypeId() == Part::GeomArcOfEllipse::getClassTypeId() ||
|
||||
geo->getTypeId() == Part::GeomArcOfHyperbola::getClassTypeId() ||
|
||||
geo->getTypeId() == Part::GeomArcOfParabola::getClassTypeId() ||
|
||||
geo->getTypeId() == Part::GeomBSplineCurve::getClassTypeId() ) {
|
||||
if (geo->getTypeId() == Part::GeomEllipse::getClassTypeId() ||
|
||||
geo->getTypeId() == Part::GeomArcOfEllipse::getClassTypeId() ||
|
||||
geo->getTypeId() == Part::GeomArcOfHyperbola::getClassTypeId() ||
|
||||
geo->getTypeId() == Part::GeomArcOfParabola::getClassTypeId() ||
|
||||
geo->getTypeId() == Part::GeomBSplineCurve::getClassTypeId() ) {
|
||||
|
||||
int currentgeoid = Obj->getHighestCurveIndex();
|
||||
int currentgeoid = Obj->getHighestCurveIndex();
|
||||
|
||||
try {
|
||||
Gui::Command::openCommand("Exposing Internal Geometry");
|
||||
try {
|
||||
Gui::Command::openCommand("Exposing Internal Geometry");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.ExposeInternalGeometry(%d)",
|
||||
Obj->getNameInDocument(),
|
||||
GeoId);
|
||||
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.ExposeInternalGeometry(%d)",
|
||||
Obj->getNameInDocument(),
|
||||
GeoId);
|
||||
|
||||
int aftergeoid = Obj->getHighestCurveIndex();
|
||||
|
||||
if(aftergeoid == currentgeoid) { // if we did not expose anything, deleteunused
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.DeleteUnusedInternalGeometry(%d)",
|
||||
Obj->getNameInDocument(),
|
||||
GeoId);
|
||||
}
|
||||
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("%s\n", e.what());
|
||||
Gui::Command::abortCommand();
|
||||
int aftergeoid = Obj->getHighestCurveIndex();
|
||||
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
|
||||
bool autoRecompute = hGrp->GetBool("AutoRecompute",false);
|
||||
|
||||
if(autoRecompute)
|
||||
Gui::Command::updateActive();
|
||||
else
|
||||
static_cast<Sketcher::SketchObject *>(Obj)->solve();
|
||||
if(aftergeoid == currentgeoid) { // if we did not expose anything, deleteunused
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.DeleteUnusedInternalGeometry(%d)",
|
||||
Obj->getNameInDocument(),
|
||||
GeoId);
|
||||
}
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("%s\n", e.what());
|
||||
Gui::Command::abortCommand();
|
||||
|
||||
return;
|
||||
}
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
|
||||
bool autoRecompute = hGrp->GetBool("AutoRecompute",false);
|
||||
|
||||
Gui::Command::commitCommand();
|
||||
if(autoRecompute)
|
||||
Gui::Command::updateActive();
|
||||
else
|
||||
static_cast<Sketcher::SketchObject *>(Obj)->solve();
|
||||
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
|
||||
bool autoRecompute = hGrp->GetBool("AutoRecompute",false);
|
||||
|
||||
if(autoRecompute)
|
||||
Gui::Command::updateActive();
|
||||
else
|
||||
static_cast<Sketcher::SketchObject *>(Obj)->solve();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Gui::Command::commitCommand();
|
||||
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
|
||||
bool autoRecompute = hGrp->GetBool("AutoRecompute",false);
|
||||
|
||||
if (autoRecompute)
|
||||
Gui::Command::updateActive();
|
||||
else
|
||||
static_cast<Sketcher::SketchObject *>(Obj)->solve();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -910,7 +908,7 @@ void CmdSketcherSymmetry::activated(int iMsg)
|
|||
|
||||
// points to make symmetric
|
||||
if(LastGeoId>=0) {
|
||||
geoids++;
|
||||
geoids++;
|
||||
stream << LastGeoId << ",";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -781,7 +781,7 @@ bool ViewProviderSketch::mouseButtonPressed(int Button, bool pressed, const SbVe
|
|||
geo->getTypeId() == Part::GeomArcOfEllipse::getClassTypeId()||
|
||||
geo->getTypeId() == Part::GeomArcOfParabola::getClassTypeId()||
|
||||
geo->getTypeId() == Part::GeomArcOfHyperbola::getClassTypeId()||
|
||||
geo->getTypeId() == Part::GeomBSplineCurve::getClassTypeId()) {
|
||||
geo->getTypeId() == Part::GeomBSplineCurve::getClassTypeId()) {
|
||||
Gui::Command::openCommand("Drag Curve");
|
||||
try {
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.movePoint(%i,%i,App.Vector(%f,%f,0),%i)"
|
||||
|
@ -2324,8 +2324,8 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s &
|
|||
int countSegments = std::max(2, int(12.0 * range / (2 * M_PI)));
|
||||
|
||||
float segment = float(range) / countSegments;
|
||||
//In local coordinate system, value() of parabola is:
|
||||
//P(U) = O + U*U/(4.*F)*XDir + U*YDir
|
||||
//In local coordinate system, value() of parabola is:
|
||||
//P(U) = O + U*U/(4.*F)*XDir + U*YDir
|
||||
// circumscribed polygon radius
|
||||
float focal = float(aop->getFocal()) / cos(segment/2);
|
||||
float phi = float(aop->getAngleXU());
|
||||
|
@ -3406,7 +3406,7 @@ void ViewProviderSketch::draw(bool temp)
|
|||
gp_Pnt end = curve->Value(last);
|
||||
Coords.push_back(Base::Vector3d(end.X(), end.Y(), end.Z()));
|
||||
|
||||
// abdullah: Poles thought as internal geometry
|
||||
// abdullah: Poles thought as internal geometry
|
||||
/*std::vector<Base::Vector3d> poles = spline->getPoles();
|
||||
for (std::vector<Base::Vector3d>::iterator it = poles.begin(); it != poles.end(); ++it) {
|
||||
Points.push_back(*it);
|
||||
|
|
|
@ -82,8 +82,8 @@ Gui::MenuItem* Workbench::setupMenuBar() const
|
|||
|
||||
addSketcherWorkbenchSketchActions( *sketch );
|
||||
*sketch << geom
|
||||
<< cons
|
||||
<< consaccel;
|
||||
<< cons
|
||||
<< consaccel;
|
||||
|
||||
return root;
|
||||
}
|
||||
|
@ -241,21 +241,20 @@ inline void SketcherAddWorkbenchTools(T& consaccel);
|
|||
|
||||
template <>
|
||||
inline void SketcherAddWorkbenchTools<Gui::MenuItem>(Gui::MenuItem& consaccel){
|
||||
consaccel << "Sketcher_CloseShape"
|
||||
<< "Sketcher_ConnectLines"
|
||||
<< "Sketcher_SelectConstraints"
|
||||
<< "Sketcher_SelectOrigin"
|
||||
<< "Sketcher_SelectVerticalAxis"
|
||||
<< "Sketcher_SelectHorizontalAxis"
|
||||
<< "Sketcher_SelectRedundantConstraints"
|
||||
<< "Sketcher_SelectConflictingConstraints"
|
||||
<< "Sketcher_SelectElementsAssociatedWithConstraints"
|
||||
<< "Sketcher_RestoreInternalAlignmentGeometry"
|
||||
<< "Sketcher_Symmetry"
|
||||
<< "Sketcher_Clone"
|
||||
<< "Sketcher_Copy"
|
||||
<< "Sketcher_RectangularArray";
|
||||
|
||||
consaccel << "Sketcher_CloseShape"
|
||||
<< "Sketcher_ConnectLines"
|
||||
<< "Sketcher_SelectConstraints"
|
||||
<< "Sketcher_SelectOrigin"
|
||||
<< "Sketcher_SelectVerticalAxis"
|
||||
<< "Sketcher_SelectHorizontalAxis"
|
||||
<< "Sketcher_SelectRedundantConstraints"
|
||||
<< "Sketcher_SelectConflictingConstraints"
|
||||
<< "Sketcher_SelectElementsAssociatedWithConstraints"
|
||||
<< "Sketcher_RestoreInternalAlignmentGeometry"
|
||||
<< "Sketcher_Symmetry"
|
||||
<< "Sketcher_Clone"
|
||||
<< "Sketcher_Copy"
|
||||
<< "Sketcher_RectangularArray";
|
||||
}
|
||||
template <>
|
||||
inline void SketcherAddWorkbenchTools<Gui::ToolBarItem>(Gui::ToolBarItem& consaccel){
|
||||
|
|
Loading…
Reference in New Issue
Block a user