[TD]Include CosmeticLines in Dxf

This commit is contained in:
Wanderer Fan
2022-06-26 16:21:39 -04:00
committed by WandererFan
parent bf83aedd2f
commit 75486e930b
3 changed files with 28 additions and 0 deletions

View File

@@ -612,6 +612,20 @@ private:
s = mkTrf.Shape();
writer.exportShape(s);
}
//add the cosmetic edges also
std::vector<TechDraw::BaseGeomPtr> geoms = dvp->getEdgeGeometry();
std::vector<TopoDS_Edge> cosmeticEdges;
for (auto& g: geoms) {
if (g->hlrVisible && g->cosmetic) {
cosmeticEdges.push_back(g->occEdge);
}
}
if (!cosmeticEdges.empty()) {
s = TechDraw::mirrorShape(DrawUtil::vectorToCompound(cosmeticEdges));
mkTrf.Perform(s);
s = mkTrf.Shape();
writer.exportShape(s);
}
}
Py::Object writeDXFView(const Py::Tuple& args)

View File

@@ -801,6 +801,17 @@ bool DrawUtil::isCrazy(TopoDS_Edge e)
return result;
}
//construct a compound shape from a list of edges
TopoDS_Shape DrawUtil::vectorToCompound(std::vector<TopoDS_Edge> vecIn)
{
BRep_Builder builder;
TopoDS_Compound compOut;
builder.MakeCompound(compOut);
for (auto& v : vecIn) {
builder.Add(compOut, v);
}
return compOut;
}
//get 3d position of a face's center
Base::Vector3d DrawUtil::getFaceCenter(TopoDS_Face f)
{

View File

@@ -79,6 +79,9 @@ class TechDrawExport DrawUtil {
double xRange,
double yRange) ;
static Base::Vector3d vertex2Vector(const TopoDS_Vertex& v);
static TopoDS_Shape vectorToCompound(std::vector<TopoDS_Edge> vecIn);
static std::string formatVector(const Base::Vector3d& v);
static std::string formatVector(const gp_Dir& v);
static std::string formatVector(const gp_Dir2d& v);