+ 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
This commit is contained in:
logari81 2011-12-13 07:17:09 +00:00
parent 0c7de56369
commit f6ce9caf79
4 changed files with 22 additions and 6 deletions

View File

@ -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) {

View File

@ -41,5 +41,11 @@ DressUp::DressUp()
ADD_PROPERTY(Base,(0));
}
void DressUp::positionByBase(void)
{
Part::Feature *base = static_cast<Part::Feature*>(Base.getValue());
if (base && base->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId()))
this->Placement.setValue(base->Placement.getValue());
}
}
}

View File

@ -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

View File

@ -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) {