Sketcher: Add circle to circle distance constraint
This commit is contained in:
committed by
abdullahtahiriyo
parent
0e64e76514
commit
21c2eb6014
@@ -1797,6 +1797,20 @@ int Sketch::addConstraint(const Constraint *constraint)
|
||||
constraint->Second,constraint->SecondPos,
|
||||
c.value,c.driving);
|
||||
}
|
||||
else if (constraint->FirstPos == PointPos::none &&
|
||||
constraint->SecondPos == PointPos::none &&
|
||||
constraint->Second != GeoEnum::GeoUndef &&
|
||||
constraint->Third == GeoEnum::GeoUndef) { // circle to circle, circle to arc, etc.
|
||||
|
||||
c.value = new double(constraint->getValue());
|
||||
if(c.driving)
|
||||
FixParameters.push_back(c.value);
|
||||
else {
|
||||
Parameters.push_back(c.value);
|
||||
DrivenParameters.push_back(c.value);
|
||||
}
|
||||
rtn = addDistanceConstraint(constraint->First, constraint->Second,c.value,c.driving);
|
||||
}
|
||||
else if (constraint->Second != GeoEnum::GeoUndef) {
|
||||
if (constraint->FirstPos != PointPos::none) { // point to line distance
|
||||
c.value = new double(constraint->getValue());
|
||||
@@ -1806,8 +1820,7 @@ int Sketch::addConstraint(const Constraint *constraint)
|
||||
Parameters.push_back(c.value);
|
||||
DrivenParameters.push_back(c.value);
|
||||
}
|
||||
rtn = addDistanceConstraint(constraint->First,constraint->FirstPos,
|
||||
constraint->Second,c.value,c.driving);
|
||||
rtn = addDistanceConstraint(constraint->First,constraint->FirstPos,constraint->Second,c.value,c.driving);
|
||||
}
|
||||
}
|
||||
else {// line length
|
||||
@@ -2740,6 +2753,19 @@ int Sketch::addDistanceConstraint(int geoId1, PointPos pos1, int geoId2, PointPo
|
||||
return -1;
|
||||
}
|
||||
|
||||
// circle-circle offset distance constraint
|
||||
int Sketch::addDistanceConstraint(int geoId1, int geoId2, double * value, bool driving)
|
||||
{
|
||||
if ((Geoms[geoId1].type == Circle) && (Geoms[geoId2].type == Circle)) {
|
||||
GCS::Circle &c1 = Circles[Geoms[geoId1].index];
|
||||
GCS::Circle &c2 = Circles[Geoms[geoId2].index];
|
||||
int tag = ++ConstraintsCounter;
|
||||
GCSsys.addConstraintC2CDistance(c1, c2, value, tag, driving);
|
||||
return ConstraintsCounter;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int Sketch::addRadiusConstraint(int geoId, double * value, bool driving)
|
||||
{
|
||||
geoId = checkGeoId(geoId);
|
||||
|
||||
Reference in New Issue
Block a user