[TD]fix misaligned PAT hatch on section

This commit is contained in:
wandererfan
2020-07-24 20:02:10 -04:00
committed by WandererFan
parent 83f1c667d4
commit 41380359a8
3 changed files with 33 additions and 3 deletions

View File

@@ -238,11 +238,24 @@ std::vector<LineSet> DrawGeomHatch::getTrimmedLinesSection(DrawViewSection* sou
double scale )
{
std::vector<LineSet> result;
TopoDS_Face tFace = f;
tFace = TopoDS::Face(GeometryObject::invertGeometry(tFace));
gp_Pln p;
Base::Vector3d vfc = DrawUtil::getFaceCenter(f);
gp_Pnt fc(vfc.x, vfc.y, vfc.z);
double dir = -1.0;
if (fc.Z() < 0.0) {
dir = -dir;
}
Base::Vector3d stdZ(0.0, 0.0, 1.0);
Base::Vector3d offset = stdZ * p.Distance(fc) * dir;
//f may be above or below paper plane and must be moved so Common operation in
//getTrimmedLines succeeds
TopoDS_Shape moved = TechDraw::moveShape(f,
offset);
TopoDS_Face fMoved = TopoDS::Face(GeometryObject::invertGeometry(moved));
result = getTrimmedLines(source,
lineSets,
tFace,
fMoved,
scale );
return result;
}