[TD]prevent bleed through on angled details

This commit is contained in:
wandererfan
2019-10-23 09:25:59 -04:00
committed by WandererFan
parent 346fe1caeb
commit bf6050e575
2 changed files with 36 additions and 31 deletions

View File

@@ -27,38 +27,39 @@
# include <sstream>
#include <Bnd_Box.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <BRepAlgoAPI_Common.hxx>
#include <BRepAlgoAPI_Cut.hxx>
#include <BRepBndLib.hxx>
#include <BRepBuilderAPI_Copy.hxx>
#include <BRepAlgoAPI_Cut.hxx>
#include <BRepPrimAPI_MakePrism.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRepAdaptor_Surface.hxx>
# include <BRep_Builder.hxx>
#include <BRepPrimAPI_MakeCylinder.hxx>
#include <BRepPrim_Cylinder.hxx>
#include <BRepBuilderAPI_MakeSolid.hxx>
#include <BRepAlgoAPI_Common.hxx>
#include <BRepBuilderAPI_Transform.hxx>
#include <BRep_Builder.hxx>
#include <BRepPrimAPI_MakeCylinder.hxx>
#include <BRepPrimAPI_MakePrism.hxx>
#include <BRepPrim_Cylinder.hxx>
#include <BRepTools.hxx>
#include <Geom_Plane.hxx>
#include <gp_Ax1.hxx>
#include <gp_Ax2.hxx>
#include <gp_Ax3.hxx>
#include <gp_Pnt.hxx>
#include <gp_Pln.hxx>
#include <gp_Dir.hxx>
#include <Geom_Plane.hxx>
#include <HLRBRep_Algo.hxx>
#include <gp_Pln.hxx>
#include <gp_Pnt.hxx>
#include <HLRAlgo_Projector.hxx>
#include <HLRBRep_Algo.hxx>
#include <HLRBRep_HLRToShape.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Solid.hxx>
#include <TopoDS_Shell.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopExp.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS_Solid.hxx>
#include <TopoDS_Vertex.hxx>
#endif
@@ -221,9 +222,9 @@ App::DocumentObjectExecReturn *DrawViewDetail::execute(void)
double scale = getScale();
BRepBuilderAPI_Copy BuilderCopy(shape);
TopoDS_Shape myShape = BuilderCopy.Shape();
TopoDS_Shape copyShape = BuilderCopy.Shape();
gp_Pnt gpCenter = TechDraw::findCentroid(myShape,
gp_Pnt gpCenter = TechDraw::findCentroid(copyShape,
dirDetail);
Base::Vector3d shapeCenter = Base::Vector3d(gpCenter.X(),gpCenter.Y(),gpCenter.Z());
@@ -231,15 +232,15 @@ App::DocumentObjectExecReturn *DrawViewDetail::execute(void)
gp_Ax2 vaBase;
viewAxis = dvp->getViewAxis(shapeCenter, dirDetail, true);
myShape = TechDraw::moveShape(myShape, //centre on origin
copyShape = TechDraw::moveShape(copyShape, //centre on origin
-shapeCenter);
gpCenter = TechDraw::findCentroid(myShape, //sb origin!
gpCenter = TechDraw::findCentroid(copyShape, //sb origin!
dirDetail);
shapeCenter = Base::Vector3d(gpCenter.X(),gpCenter.Y(),gpCenter.Z());
Bnd_Box bbxSource;
bbxSource.SetGap(0.0);
BRepBndLib::Add(myShape, bbxSource);
BRepBndLib::Add(copyShape, bbxSource);
double diag = sqrt(bbxSource.SquareExtent());
Base::Vector3d extentFar,extentNear;
@@ -269,7 +270,7 @@ App::DocumentObjectExecReturn *DrawViewDetail::execute(void)
gp_Vec extrudeDir(extrudeVec.x,extrudeVec.y,extrudeVec.z);
TopoDS_Shape tool = BRepPrimAPI_MakePrism(aProjFace, extrudeDir, false, true).Shape();
BRepAlgoAPI_Common mkCommon(myShape,tool);
BRepAlgoAPI_Common mkCommon(copyShape,tool);
if (!mkCommon.IsDone()) {
Base::Console().Log("DVD::execute - mkCommon not done\n");
return new App::DocumentObjectExecReturn("DVD::execute - mkCommon not done");
@@ -286,6 +287,11 @@ App::DocumentObjectExecReturn *DrawViewDetail::execute(void)
Base::Console().Warning("DVD::execute - mkCommon.Shape is not a solid!\n");
}
TopoDS_Shape detail = mkCommon.Shape();
// BRepTools::Write(tool, "DVDTool.brep"); //debug
// BRepTools::Write(copyShape, "DVDCopy.brep"); //debug
// BRepTools::Write(detail, "DVDdetail.brep"); //debug
Bnd_Box testBox;
testBox.SetGap(0.0);
BRepBndLib::Add(detail, testBox);
@@ -305,7 +311,7 @@ App::DocumentObjectExecReturn *DrawViewDetail::execute(void)
// TopoDS_Compound Comp;
// builder.MakeCompound(Comp);
// builder.Add(Comp, tool);
// builder.Add(Comp, myShape);
// builder.Add(Comp, copyShape);
gp_Pnt inputCenter;
try {