[TD]Improve section face display
This commit is contained in:
@@ -43,6 +43,7 @@
|
||||
#include <BRepBuilderAPI_MakeWire.hxx>
|
||||
#include <BRepBuilderAPI_MakeFace.hxx>
|
||||
#include <BRepBuilderAPI_Transform.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <Standard_PrimitiveTypes.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
@@ -73,7 +74,9 @@
|
||||
#include "DrawPage.h"
|
||||
#include "DrawViewPart.h"
|
||||
#include "DrawViewSection.h"
|
||||
#include "DrawViewDetail.h"
|
||||
#include "DrawGeomHatch.h"
|
||||
#include "GeometryObject.h"
|
||||
|
||||
#include <Mod/TechDraw/App/DrawGeomHatchPy.h> // generated from DrawGeomHatchPy.xml
|
||||
|
||||
@@ -229,9 +232,38 @@ std::vector<LineSet> DrawGeomHatch::getTrimmedLines(int i) //get the trimmed
|
||||
}
|
||||
|
||||
/* static */
|
||||
std::vector<LineSet> DrawGeomHatch::getTrimmedLinesSection(DrawViewSection* source,
|
||||
std::vector<LineSet> lineSets,
|
||||
TopoDS_Face f,
|
||||
double scale )
|
||||
{
|
||||
std::vector<LineSet> result;
|
||||
TopoDS_Face tFace = f;
|
||||
tFace = TopoDS::Face(GeometryObject::invertGeometry(tFace));
|
||||
result = getTrimmedLines(source,
|
||||
lineSets,
|
||||
tFace,
|
||||
scale );
|
||||
return result;
|
||||
}
|
||||
|
||||
//! get hatch lines trimmed to face outline
|
||||
std::vector<LineSet> DrawGeomHatch::getTrimmedLines(DrawViewPart* source, std::vector<LineSet> lineSets, int iface, double scale )
|
||||
{
|
||||
TopoDS_Face face = extractFace(source,iface);
|
||||
std::vector<LineSet> result = getTrimmedLines(source,
|
||||
lineSets,
|
||||
face,
|
||||
scale );
|
||||
return result;
|
||||
}
|
||||
|
||||
std::vector<LineSet> DrawGeomHatch::getTrimmedLines(DrawViewPart* source,
|
||||
std::vector<LineSet> lineSets,
|
||||
TopoDS_Face f,
|
||||
double scale )
|
||||
{
|
||||
(void)source;
|
||||
std::vector<LineSet> result;
|
||||
|
||||
if (lineSets.empty()) {
|
||||
@@ -239,7 +271,7 @@ std::vector<LineSet> DrawGeomHatch::getTrimmedLines(DrawViewPart* source, std::v
|
||||
return result;
|
||||
}
|
||||
|
||||
TopoDS_Face face = extractFace(source,iface);
|
||||
TopoDS_Face face = f;
|
||||
|
||||
Bnd_Box bBox;
|
||||
BRepBndLib::Add(face, bBox);
|
||||
@@ -251,14 +283,14 @@ std::vector<LineSet> DrawGeomHatch::getTrimmedLines(DrawViewPart* source, std::v
|
||||
|
||||
//make Compound for this linespec
|
||||
BRep_Builder builder;
|
||||
TopoDS_Compound Comp;
|
||||
builder.MakeCompound(Comp);
|
||||
TopoDS_Compound grid;
|
||||
builder.MakeCompound(grid);
|
||||
for (auto& c: candidates) {
|
||||
builder.Add(Comp, c);
|
||||
builder.Add(grid, c);
|
||||
}
|
||||
|
||||
//Common(Compound,Face)
|
||||
BRepAlgoAPI_Common mkCommon(face, Comp);
|
||||
BRepAlgoAPI_Common mkCommon(face, grid);
|
||||
if ((!mkCommon.IsDone()) ||
|
||||
(mkCommon.Shape().IsNull()) ) {
|
||||
Base::Console().Log("INFO - DGH::getTrimmedLines - Common creation failed\n");
|
||||
@@ -302,6 +334,7 @@ std::vector<LineSet> DrawGeomHatch::getTrimmedLines(DrawViewPart* source, std::v
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/* static */
|
||||
std::vector<TopoDS_Edge> DrawGeomHatch::makeEdgeOverlay(PATLineSpec hl, Bnd_Box b, double scale)
|
||||
{
|
||||
@@ -458,19 +491,7 @@ TopoDS_Face DrawGeomHatch::extractFace(DrawViewPart* source, int iface )
|
||||
{
|
||||
TopoDS_Face result;
|
||||
|
||||
//is source a section?
|
||||
DrawViewSection* section = dynamic_cast<DrawViewSection*>(source);
|
||||
bool usingSection = false;
|
||||
if (section != nullptr) {
|
||||
usingSection = true;
|
||||
}
|
||||
|
||||
std::vector<TopoDS_Wire> faceWires;
|
||||
if (usingSection) {
|
||||
faceWires = section->getWireForFace(iface);
|
||||
} else {
|
||||
faceWires = source->getWireForFace(iface);
|
||||
}
|
||||
std::vector<TopoDS_Wire> faceWires = source->getWireForFace(iface);
|
||||
|
||||
//build face(s) from geometry
|
||||
gp_Pnt gOrg(0.0,0.0,0.0);
|
||||
|
||||
Reference in New Issue
Block a user