[Sketcher] Support splitting arcs of conics
This commit also squashes: [Sketcher] Remove redundant geometry type check (Arc of) a circle is (an arc of) a conic.
This commit is contained in:
committed by
abdullahtahiriyo
parent
947d34f01d
commit
19f9c94389
@@ -3117,8 +3117,8 @@ int SketchObject::split(int GeoId, const Base::Vector3d &point)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (geo->getTypeId() == Part::GeomArcOfEllipse::getClassTypeId()) {
|
||||
const Part::GeomArcOfEllipse *arc = static_cast<const Part::GeomArcOfEllipse *>(geo);
|
||||
else if (geo->isDerivedFrom(Part::GeomArcOfConic::getClassTypeId())) {
|
||||
const Part::GeomArcOfConic *arc = static_cast<const Part::GeomArcOfConic *>(geo);
|
||||
|
||||
startPoint = arc->getStartPoint();
|
||||
endPoint = arc->getEndPoint();
|
||||
@@ -3128,13 +3128,13 @@ int SketchObject::split(int GeoId, const Base::Vector3d &point)
|
||||
startParam = arc->getFirstParameter();
|
||||
endParam = arc->getLastParameter();
|
||||
// TODO: Using parameter difference as a poor substitute of length.
|
||||
// Computing length of an arc of an ellipse would be expensive.
|
||||
// Computing length of an arc of a generic conic would be expensive.
|
||||
if (endParam - splitParam > splitParam - startParam) {
|
||||
longestPart = 1;
|
||||
}
|
||||
|
||||
// create new arcs
|
||||
auto newArc = static_cast<Part::GeomArcOfEllipse *>(arc->clone());
|
||||
auto newArc = static_cast<Part::GeomArcOfConic *>(arc->clone());
|
||||
int newId(GeoEnum::GeoUndef);
|
||||
newGeometries.push_back(newArc);
|
||||
newArc->setRange(startParam, splitParam, /*emulateCCW=*/true);
|
||||
@@ -3145,7 +3145,7 @@ int SketchObject::split(int GeoId, const Base::Vector3d &point)
|
||||
exposeInternalGeometry(newId);
|
||||
|
||||
// the "second" half
|
||||
auto newArc2 = static_cast<Part::GeomArcOfEllipse *>(arc->clone());
|
||||
auto newArc2 = static_cast<Part::GeomArcOfConic *>(arc->clone());
|
||||
int newId2(GeoEnum::GeoUndef);
|
||||
newArc2->setRange(splitParam, endParam, /*emulateCCW=*/true);
|
||||
newId2 = addGeometry(newArc2);
|
||||
|
||||
@@ -52,8 +52,7 @@ public:
|
||||
const Part::Geometry *geom = Sketch->getGeometry(GeoId);
|
||||
if (geom->getTypeId() == Part::GeomLineSegment::getClassTypeId()
|
||||
|| geom->getTypeId() == Part::GeomCircle::getClassTypeId()
|
||||
|| geom->getTypeId() == Part::GeomArcOfCircle::getClassTypeId()
|
||||
|| geom->getTypeId() == Part::GeomArcOfEllipse::getClassTypeId()
|
||||
|| geom->isDerivedFrom(Part::GeomArcOfConic::getClassTypeId())
|
||||
|| geom->getTypeId() == Part::GeomBSplineCurve::getClassTypeId()) {
|
||||
return true;
|
||||
}
|
||||
@@ -90,8 +89,7 @@ public:
|
||||
const Part::Geometry *geom = sketchgui->getSketchObject()->getGeometry(GeoId);
|
||||
if (geom->getTypeId() == Part::GeomLineSegment::getClassTypeId()
|
||||
|| geom->getTypeId() == Part::GeomCircle::getClassTypeId()
|
||||
|| geom->getTypeId() == Part::GeomArcOfCircle::getClassTypeId()
|
||||
|| geom->getTypeId() == Part::GeomArcOfEllipse::getClassTypeId()
|
||||
|| geom->isDerivedFrom(Part::GeomArcOfConic::getClassTypeId())
|
||||
|| geom->getTypeId() == Part::GeomBSplineCurve::getClassTypeId()) {
|
||||
try {
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Split edge"));
|
||||
|
||||
Reference in New Issue
Block a user