Merge branch 'PartFaceMakers3_fixup2' of https://github.com/DeepSOIC/FreeCAD-ellipse into f

This commit is contained in:
Yorik van Havre 2016-10-04 17:59:34 -03:00
commit 024fe267f4
2 changed files with 15 additions and 4 deletions

View File

@ -296,10 +296,11 @@ TopoShape Extrusion::extrudeShape(const TopoShape source, Extrusion::ExtrusionPa
//make faces from wires
if (params.solid) {
if (myShape.ShapeType() == TopAbs_FACE && params.faceMakerClass == "Part::FaceMakerExtrusion"){
//legacy exclusion: ignore "solid" if extruding a face.
//test if we need to make faces from wires. If there are faces - we don't.
TopExp_Explorer xp(myShape, TopAbs_FACE);
if (xp.More()){
//source shape has faces. Just extrude as-is.
} else {
//new strict behavior. If solid==True => make faces from wires, and if myShape not wires - fail!
std::unique_ptr<FaceMaker> mkFace = FaceMaker::ConstructFromType(params.faceMakerClass.c_str());
if (myShape.ShapeType() == TopAbs_COMPOUND)

View File

@ -28,6 +28,7 @@
# include <BRepAdaptor_Curve.hxx>
# include <gp_Lin.hxx>
# include <gp_Circ.hxx>
# include <TopExp_Explorer.hxx>
#endif
@ -166,8 +167,15 @@ App::DocumentObjectExecReturn *Revolution::execute(void)
sourceShape.setShape(sourceShape.getShape().Moved(loc));
}
//do it!
//"make solid" processing: make faces from wires.
Standard_Boolean makeSolid = Solid.getValue() ? Standard_True : Standard_False;
if (makeSolid){
//test if we need to make faces from wires. If there are faces - we don't.
TopExp_Explorer xp(sourceShape.getShape(), TopAbs_FACE);
if (xp.More())
//source shape has faces. Just revolve as-is.
makeSolid = Standard_False;
}
if (makeSolid && strlen(this->FaceMakerClass.getValue())>0){
//new facemaking behavior: use facemaker class
std::unique_ptr<FaceMaker> mkFace = FaceMaker::ConstructFromType(this->FaceMakerClass.getValue());
@ -183,6 +191,8 @@ App::DocumentObjectExecReturn *Revolution::execute(void)
makeSolid = Standard_False;//don't ask TopoShape::revolve to make solid, as we've made faces...
}
// actual revolution!
TopoDS_Shape revolve = sourceShape.revolve(revAx, angle, makeSolid);
if (revolve.IsNull())