[TD]corrupt dim reference detect and correct

This commit is contained in:
wandererfan
2023-03-13 19:01:31 -04:00
committed by WandererFan
parent 45743d4fbd
commit 8a11528a7e
16 changed files with 859 additions and 64 deletions

View File

@@ -74,13 +74,18 @@
#include <Base/Reader.h>
#include <Base/Writer.h>
#include <Mod/Part/App/Geometry.h>
#include <Mod/Part/App/TopoShape.h>
#include "Geometry.h"
#include "GeometryObject.h"
#include "DrawUtil.h"
using namespace TechDraw;
using namespace Part;
using namespace std;
using DU = DrawUtil;
#if OCC_VERSION_HEX >= 0x070600
using BRepAdaptor_HCurve = BRepAdaptor_Curve;
@@ -704,6 +709,14 @@ void BaseGeom::intersectionCC(TechDraw::BaseGeomPtr geom1,
}
}
TopoShape BaseGeom::asTopoShape(double scale)
{
// Base::Console().Message("BG::asTopoShape(%.3f) - dump: %s\n", scale, dump().c_str());
TopoDS_Shape unscaledShape = TechDraw::scaleShape(getOCCEdge(), 1.0 / scale);
TopoDS_Edge unscaledEdge = TopoDS::Edge(unscaledShape);
return unscaledEdge;
}
Ellipse::Ellipse(const TopoDS_Edge &e)
{
geomType = ELLIPSE;
@@ -1496,6 +1509,14 @@ void Vertex::dump(const char* title)
cosmeticTag.c_str());
}
TopoShape Vertex::asTopoShape(double scale)
{
Base::Vector3d point = DU::toVector3d(BRep_Tool::Pnt(getOCCVertex()));
point = point / scale;
BRepBuilderAPI_MakeVertex mkVert(DU::togp_Pnt(point));
return TopoShape(mkVert.Vertex());
}
/*static*/
BaseGeomPtrVector GeometryUtils::chainGeoms(BaseGeomPtrVector geoms)