Added Reversed button to Pocket UI if the sketch plane is a datum plane

This commit is contained in:
jrheinlaender
2013-05-11 20:17:49 +04:30
committed by Stefan Tröger
parent 6915d8b734
commit 0bcdb0511f
8 changed files with 40 additions and 6 deletions

View File

@@ -34,8 +34,10 @@
#include <Base/Exception.h>
#include "App/Document.h"
#include "App/Plane.h"
#include "Body.h"
#include "Feature.h"
#include "Mod/Part/App/DatumFeature.h"
#include <Base/Console.h>
@@ -106,4 +108,10 @@ const TopoDS_Shape& Feature::getBaseShape() const {
return result;
}
bool Feature::isDatum(const App::DocumentObject* feature)
{
return feature->getTypeId().isDerivedFrom(App::Plane::getClassTypeId()) ||
feature->getTypeId().isDerivedFrom(Part::Datum::getClassTypeId());
}
}

View File

@@ -64,6 +64,8 @@ protected:
/// Grab any point from the given face
static const gp_Pnt getPointFromFace(const TopoDS_Face& f);
/// Check whether the given feature is a datum feature
static bool isDatum(const App::DocumentObject* feature);
};
} //namespace PartDesign

View File

@@ -145,6 +145,9 @@ App::DocumentObjectExecReturn *Pocket::execute(void)
TopoDS_Face supportface = getSupportFace();
supportface.Move(invObjLoc);
if (Reversed.getValue())
dir.Reverse();
// Find a valid face to extrude up to
TopoDS_Face upToFace;
if (method == "UpToFace") {

View File

@@ -930,6 +930,14 @@ bool SketchBased::isParallelPlane(const TopoDS_Shape& s1, const TopoDS_Shape& s2
return false;
}
bool SketchBased::isSupportDatum() const
{
Part::Feature* SupportObject = getSupport();
if (SupportObject == NULL)
throw Base::Exception("No support in Sketch!");
return isDatum(SupportObject);
}
TopoDS_Shape SketchBased::refineShapeIfActive(const TopoDS_Shape& oldShape) const
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()

View File

@@ -73,15 +73,17 @@ public:
Part::Feature* getSupport() const;
/// Returns the sketch support shape (if any)
const TopoDS_Shape& getSupportShape() const;
/// Check whether the sketch support is a datum plane
bool isSupportDatum() const;
/// retrieves the number of axes in the linked sketch (defined as construction lines)
int getSketchAxisCount(void) const;
int getSketchAxisCount(void) const;
protected:
void onChanged(const App::Property* prop);
TopoDS_Face validateFace(const TopoDS_Face&) const;
TopoDS_Shape makeFace(const std::vector<TopoDS_Wire>&) const;
TopoDS_Shape makeFace(std::list<TopoDS_Wire>&) const; // for internal use only
TopoDS_Shape makeFace(std::list<TopoDS_Wire>&) const; // for internal use only
bool isInside(const TopoDS_Wire&, const TopoDS_Wire&) const;
bool isParallelPlane(const TopoDS_Shape&, const TopoDS_Shape&) const;
bool isEqualGeometry(const TopoDS_Shape&, const TopoDS_Shape&) const;