PDN: Check both parallel and antiparallel cases before trying Revolve
This commit is contained in:
@@ -103,7 +103,11 @@ App::DocumentObjectExecReturn *Revolution::execute(void)
|
||||
}
|
||||
|
||||
// update Axis from ReferenceAxis
|
||||
updateAxis();
|
||||
try {
|
||||
updateAxis();
|
||||
} catch (const Base::Exception& e) {
|
||||
return new App::DocumentObjectExecReturn(e.what());
|
||||
}
|
||||
|
||||
// get revolve axis
|
||||
Base::Vector3d b = Base.getValue();
|
||||
|
||||
@@ -971,19 +971,19 @@ void ProfileBased::getAxis(const App::DocumentObject *pcReferenceAxis, const std
|
||||
dir = line->getDirection();
|
||||
|
||||
// Check that axis is perpendicular with sketch plane!
|
||||
if (sketchplane.Axis().Direction().Angle(gp_Dir(dir.x, dir.y, dir.z))< Precision::Angular())
|
||||
throw Base::Exception("Rotation axis must not be perpendicular with the sketch plane");
|
||||
if (sketchplane.Axis().Direction().IsParallel(gp_Dir(dir.x, dir.y, dir.z), Precision::Angular()))
|
||||
throw Base::Exception("Rotation axis must not be perpendicular with the sketch plane");
|
||||
return;
|
||||
}
|
||||
|
||||
if (pcReferenceAxis->getTypeId().isDerivedFrom(App::Line::getClassTypeId())) {
|
||||
const App::Line* line = static_cast<const App::Line*>(pcReferenceAxis);
|
||||
base = Base::Vector3d(0,0,0);
|
||||
line->Placement.getValue().multVec (Base::Vector3d (1,0,0), dir);
|
||||
line->Placement.getValue().multVec(Base::Vector3d (1,0,0), dir);
|
||||
|
||||
// Check that axis is perpendicular with sketch plane!
|
||||
if (sketchplane.Axis().Direction().Angle(gp_Dir(dir.x, dir.y, dir.z)) < Precision::Angular())
|
||||
throw Base::Exception("Rotation axis must not be perpendicular with the sketch plane");
|
||||
if (sketchplane.Axis().Direction().IsParallel(gp_Dir(dir.x, dir.y, dir.z), Precision::Angular()))
|
||||
throw Base::Exception("Rotation axis must not be perpendicular with the sketch plane");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1008,7 +1008,7 @@ void ProfileBased::getAxis(const App::DocumentObject *pcReferenceAxis, const std
|
||||
dir = Base::Vector3d(d.X(), d.Y(), d.Z());
|
||||
// Check that axis is co-planar with sketch plane!
|
||||
// Check that axis is perpendicular with sketch plane!
|
||||
if (sketchplane.Axis().Direction().Angle(d) < Precision::Angular())
|
||||
if (sketchplane.Axis().Direction().IsParallel(d, Precision::Angular()))
|
||||
throw Base::Exception("Rotation axis must not be perpendicular with the sketch plane");
|
||||
return;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user