From f6ce9caf79a4cd8716fb8e037b6acbb264427b4a Mon Sep 17 00:00:00 2001 From: logari81 Date: Tue, 13 Dec 2011 07:17:09 +0000 Subject: [PATCH] + fix Placement of PartDesign/Fillet feature to the Placement of its base git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5289 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d --- src/Mod/PartDesign/App/FeatureChamfer.cpp | 8 ++++++-- src/Mod/PartDesign/App/FeatureDressUp.cpp | 8 +++++++- src/Mod/PartDesign/App/FeatureDressUp.h | 4 +++- src/Mod/PartDesign/App/FeatureFillet.cpp | 8 ++++++-- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/Mod/PartDesign/App/FeatureChamfer.cpp b/src/Mod/PartDesign/App/FeatureChamfer.cpp index 67fc6735d..f984b8c1d 100644 --- a/src/Mod/PartDesign/App/FeatureChamfer.cpp +++ b/src/Mod/PartDesign/App/FeatureChamfer.cpp @@ -45,7 +45,7 @@ Chamfer::Chamfer() short Chamfer::mustExecute() const { - if (Base.isTouched() || Size.isTouched()) + if (Placement.isTouched() || Base.isTouched() || Size.isTouched()) return 1; if (Base.getValue() && Base.getValue()->isTouched()) return 1; @@ -68,6 +68,7 @@ App::DocumentObjectExecReturn *Chamfer::execute(void) float radius = Radius.getValue(); + this->positionByBase(); try { BRepChamferAPI_MakeChamfer mkChamfer(base->Shape.getValue()); @@ -79,7 +80,10 @@ App::DocumentObjectExecReturn *Chamfer::execute(void) TopoDS_Shape shape = mkChamfer.Shape(); if (shape.IsNull()) return new App::DocumentObjectExecReturn("Resulting shape is null"); - this->Shape.setValue(shape); + + Part::TopoShape newShape(shape); + newShape.transformGeometry(this->Placement.getValue().inverse().toMatrix()); + this->Shape.setValue(newShape); return App::DocumentObject::StdReturn; } catch (Standard_Failure) { diff --git a/src/Mod/PartDesign/App/FeatureDressUp.cpp b/src/Mod/PartDesign/App/FeatureDressUp.cpp index d6543bd0d..0fb3bb606 100644 --- a/src/Mod/PartDesign/App/FeatureDressUp.cpp +++ b/src/Mod/PartDesign/App/FeatureDressUp.cpp @@ -41,5 +41,11 @@ DressUp::DressUp() ADD_PROPERTY(Base,(0)); } +void DressUp::positionByBase(void) +{ + Part::Feature *base = static_cast(Base.getValue()); + if (base && base->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) + this->Placement.setValue(base->Placement.getValue()); +} -} \ No newline at end of file +} diff --git a/src/Mod/PartDesign/App/FeatureDressUp.h b/src/Mod/PartDesign/App/FeatureDressUp.h index 3247f907c..f72fc4624 100644 --- a/src/Mod/PartDesign/App/FeatureDressUp.h +++ b/src/Mod/PartDesign/App/FeatureDressUp.h @@ -39,9 +39,11 @@ public: App::PropertyLinkSub Base; + /// updates the Placement property from the Placement of Base + void positionByBase(void); }; } //namespace PartDesign -#endif // PART_DressUp_H +#endif // PARTDESIGN_DressUp_H diff --git a/src/Mod/PartDesign/App/FeatureFillet.cpp b/src/Mod/PartDesign/App/FeatureFillet.cpp index f1525190f..aa69d9a6d 100644 --- a/src/Mod/PartDesign/App/FeatureFillet.cpp +++ b/src/Mod/PartDesign/App/FeatureFillet.cpp @@ -49,7 +49,7 @@ Fillet::Fillet() short Fillet::mustExecute() const { - if (Base.isTouched() || Radius.isTouched()) + if (Placement.isTouched() || Base.isTouched() || Radius.isTouched()) return 1; if (Base.getValue() && Base.getValue()->isTouched()) return 1; @@ -74,6 +74,7 @@ App::DocumentObjectExecReturn *Fillet::execute(void) float radius = Radius.getValue(); + this->positionByBase(); try { BRepFilletAPI_MakeFillet mkFillet(base->Shape.getValue()); @@ -89,7 +90,10 @@ App::DocumentObjectExecReturn *Fillet::execute(void) TopoDS_Shape shape = mkFillet.Shape(); if (shape.IsNull()) return new App::DocumentObjectExecReturn("Resulting shape is null"); - this->Shape.setValue(shape); + + Part::TopoShape newShape(shape); + newShape.transformGeometry(this->Placement.getValue().inverse().toMatrix()); + this->Shape.setValue(newShape); return App::DocumentObject::StdReturn; } catch (Standard_Failure) {