make origin lines usable in revolution

This commit is contained in:
Stefan Tröger
2015-05-22 17:58:38 +02:00
parent c5ae4530ab
commit ec125cf9f2
3 changed files with 109 additions and 21 deletions

View File

@@ -71,6 +71,8 @@
#include <Base/Exception.h>
#include <Base/Parameter.h>
#include <App/Application.h>
#include <App/Line.h>
#include <App/Part.h>
#include <Mod/Part/App/modelRefine.h>
#include "FeatureSketchBased.h"
#include "DatumPlane.h"
@@ -1042,7 +1044,22 @@ void SketchBased::getAxis(const App::DocumentObject *pcReferenceAxis, const std:
// 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");
} else if (pcReferenceAxis->getTypeId().isDerivedFrom(PartDesign::Feature::getClassTypeId())) {
}
else if (pcReferenceAxis->getTypeId().isDerivedFrom(App::Line::getClassTypeId())) {
const App::Line* line = static_cast<const App::Line*>(pcReferenceAxis);
base = Base::Vector3d(0,0,0);
if( strcmp(line->getNameInDocument(), App::Part::BaselineTypes[0]) == 0)
dir = Base::Vector3d(1,0,0);
else if( strcmp(line->getNameInDocument(), App::Part::BaselineTypes[1]) == 0)
dir = Base::Vector3d(0,1,0);
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");
}
else if (pcReferenceAxis->getTypeId().isDerivedFrom(PartDesign::Feature::getClassTypeId())) {
if (subReferenceAxis[0].empty())
throw Base::Exception("No rotation axis reference specified");
const Part::Feature* refFeature = static_cast<const Part::Feature*>(pcReferenceAxis);