make origin lines usable in groove

This commit is contained in:
Stefan Tröger
2015-05-22 18:37:37 +02:00
parent ec125cf9f2
commit d8a0e398a9
3 changed files with 100 additions and 27 deletions

View File

@@ -1041,9 +1041,9 @@ void SketchBased::getAxis(const App::DocumentObject *pcReferenceAxis, const std:
base = line->getBasePoint();
dir = line->getDirection();
// Check that axis is co-planar with sketch plane!
if (!sketchplane.Contains(gp_Lin(gp_Pnt(base.x, base.y, base.z), gp_Dir(dir.x, dir.y, dir.z)), Precision::Confusion(), Precision::Confusion()))
throw Base::Exception("Rotation axis must be coplanar with the sketch plane");
// 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");
}
else if (pcReferenceAxis->getTypeId().isDerivedFrom(App::Line::getClassTypeId())) {
const App::Line* line = static_cast<const App::Line*>(pcReferenceAxis);
@@ -1055,9 +1055,9 @@ void SketchBased::getAxis(const App::DocumentObject *pcReferenceAxis, const std:
else if( strcmp(line->getNameInDocument(), App::Part::BaselineTypes[2]) == 0)
dir = Base::Vector3d(0,0,1);
// Check that axis is co-planar with sketch plane!
if (!sketchplane.Contains(gp_Lin(gp_Pnt(base.x, base.y, base.z), gp_Dir(dir.x, dir.y, dir.z)), Precision::Confusion(), Precision::Confusion()))
throw Base::Exception("Rotation axis must be coplanar with the sketch plane");
// 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");
}
else if (pcReferenceAxis->getTypeId().isDerivedFrom(PartDesign::Feature::getClassTypeId())) {
if (subReferenceAxis[0].empty())
@@ -1079,8 +1079,9 @@ void SketchBased::getAxis(const App::DocumentObject *pcReferenceAxis, const std:
gp_Dir d = adapt.Line().Direction();
dir = Base::Vector3d(d.X(), d.Y(), d.Z());
// Check that axis is co-planar with sketch plane!
if (!sketchplane.Contains(adapt.Line(), Precision::Confusion(), Precision::Confusion()))
throw Base::Exception("Rotation axis must be coplanar with the sketch plane");
// Check that axis is perpendicular with sketch plane!
if (sketchplane.Axis().Direction().Angle(d) < Precision::Angular())
throw Base::Exception("Rotation axis must not be perpendicular with the sketch plane");
} else {
throw Base::Exception("Rotation reference must be an edge");
}