+ fix non-affine placement transformation in PartDesign/Chamfer

+ simplify placement transformations in PartDesign/Fillet
+ revert accidentally canceled change in PartDesign/Pad


git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5301 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
This commit is contained in:
logari81 2011-12-14 16:12:09 +00:00
parent be8f843ce1
commit 8985f085db
3 changed files with 18 additions and 21 deletions

View File

@ -78,16 +78,19 @@ App::DocumentObjectExecReturn *Chamfer::execute(void)
float size = Size.getValue();
this->positionByBase();
// create an untransformed copy of the base shape
Part::TopoShape baseShape(TopShape);
baseShape.setTransform(Base::Matrix4D());
try {
BRepFilletAPI_MakeChamfer mkChamfer(base->Shape.getValue());
BRepFilletAPI_MakeChamfer mkChamfer(baseShape._Shape);
TopTools_IndexedMapOfShape mapOfEdges;
TopTools_IndexedDataMapOfShapeListOfShape mapEdgeFace;
TopExp::MapShapesAndAncestors(base->Shape.getValue(), TopAbs_EDGE, TopAbs_FACE, mapEdgeFace);
TopExp::MapShapes(base->Shape.getValue(), TopAbs_EDGE, mapOfEdges);
TopExp::MapShapesAndAncestors(baseShape._Shape, TopAbs_EDGE, TopAbs_FACE, mapEdgeFace);
TopExp::MapShapes(baseShape._Shape, TopAbs_EDGE, mapOfEdges);
for (std::vector<std::string>::const_iterator it= SubVals.begin();it!=SubVals.end();++it) {
TopoDS_Edge edge = TopoDS::Edge(TopShape.getSubShape(it->c_str()));
for (std::vector<std::string>::const_iterator it=SubVals.begin(); it != SubVals.end(); ++it) {
TopoDS_Edge edge = TopoDS::Edge(baseShape.getSubShape(it->c_str()));
const TopoDS_Face& face = TopoDS::Face(mapEdgeFace.FindFromKey(edge).First());
mkChamfer.Add(size, edge, face);
}
@ -100,9 +103,7 @@ App::DocumentObjectExecReturn *Chamfer::execute(void)
if (shape.IsNull())
return new App::DocumentObjectExecReturn("Resulting shape is null");
Part::TopoShape newShape(shape);
newShape.transformGeometry(this->Placement.getValue().inverse().toMatrix());
this->Shape.setValue(newShape);
this->Shape.setValue(shape);
return App::DocumentObject::StdReturn;
}
catch (Standard_Failure) {

View File

@ -23,7 +23,6 @@
#include "PreCompiled.h"
#ifndef _PreComp_
# include <BRepBuilderAPI_Copy.hxx>
# include <BRepFilletAPI_MakeFillet.hxx>
# include <TopExp_Explorer.hxx>
# include <TopoDS.hxx>
@ -74,18 +73,16 @@ App::DocumentObjectExecReturn *Fillet::execute(void)
return new App::DocumentObjectExecReturn("No edges specified");
float radius = Radius.getValue();
this->positionByBase();
// create an untransformed copy of the base shape
Part::TopoShape baseShape(TopShape);
baseShape.setTransform(Base::Matrix4D());
try {
BRepBuilderAPI_Copy copy(base->Shape.getValue());
TopoDS_Shape myShape = copy.Shape();
TopLoc_Location aLoc;
myShape.Location(aLoc);
Part::TopoShape myTopShape(myShape);
BRepFilletAPI_MakeFillet mkFillet(myShape);
BRepFilletAPI_MakeFillet mkFillet(baseShape._Shape);
for (std::vector<std::string>::const_iterator it= SubVals.begin();it!=SubVals.end();++it) {
TopoDS_Edge edge = TopoDS::Edge(myTopShape.getSubShape(it->c_str()));
for (std::vector<std::string>::const_iterator it=SubVals.begin(); it != SubVals.end(); ++it) {
TopoDS_Edge edge = TopoDS::Edge(baseShape.getSubShape(it->c_str()));
mkFillet.Add(radius, edge);
}
@ -97,8 +94,7 @@ App::DocumentObjectExecReturn *Fillet::execute(void)
if (shape.IsNull())
return new App::DocumentObjectExecReturn("Resulting shape is null");
Part::TopoShape newShape(shape);
this->Shape.setValue(newShape);
this->Shape.setValue(shape);
return App::DocumentObject::StdReturn;
}
catch (Standard_Failure) {

View File

@ -119,7 +119,7 @@ App::DocumentObjectExecReturn *Pad::execute(void)
return new App::DocumentObjectExecReturn("Creating a face from sketch failed");
// lengthen the vector
SketchOrientationVector *= Length.getValue();
SketchOrientationVector *= L;
this->positionBySketch();
TopLoc_Location invObjLoc = this->getLocation().Inverted();