Added Reversed button to Pocket UI if the sketch plane is a datum plane
This commit is contained in:
committed by
Stefan Tröger
parent
6915d8b734
commit
0bcdb0511f
@@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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") {
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user