Implement R12 version of Polyline

This commit is contained in:
wandererfan
2018-05-31 12:51:57 -04:00
committed by wmayer
parent e2e1617c74
commit fff608663d
4 changed files with 159 additions and 73 deletions

View File

@@ -364,14 +364,22 @@ void ImpExpDxfWrite::exportShape(const TopoDS_Shape input)
gp_Pnt s = adapt.Value(f);
gp_Pnt e = adapt.Value(l);
if (fabs(l-f) > 1.0 && s.SquareDistance(e) < 0.001) {
exportEllipse(adapt);
if (optionPolyLine) {
exportPolyline(adapt);
} else {
exportEllipse(adapt);
}
} else {
exportEllipseArc(adapt);
if (optionPolyLine) {
exportPolyline(adapt);
} else {
exportEllipseArc(adapt);
}
}
} else if (adapt.GetType() == GeomAbs_BSplineCurve) {
if (optionPolyLine) {
exportLWPoly(adapt);
exportPolyline(adapt);
} else {
exportBSpline(adapt);
}
@@ -634,6 +642,31 @@ void ImpExpDxfWrite::exportLWPoly(BRepAdaptor_Curve c)
}
}
void ImpExpDxfWrite::exportPolyline(BRepAdaptor_Curve c)
{
LWPolyDataOut pd;
pd.Flag = c.IsClosed();
pd.Elev = 0.0;
pd.Thick = 0.0;
pd.Extr.x = 0.0;
pd.Extr.y = 0.0;
pd.Extr.z = 1.0;
pd.nVert = 0;
GCPnts_UniformAbscissa discretizer;
discretizer.Initialize (c, optionMaxLength);
std::vector<point3D> points;
if (discretizer.IsDone () && discretizer.NbPoints () > 0) {
int nbPoints = discretizer.NbPoints ();
for (int i=1; i<=nbPoints; i++) {
gp_Pnt p = c.Value (discretizer.Parameter (i));
pd.Verts.push_back(gPntTopoint3D(p));
}
pd.nVert = discretizer.NbPoints ();
WritePolyline(pd,getLayerName().c_str());
}
}
void ImpExpDxfWrite::exportText(const char* text, Base::Vector3d position1, Base::Vector3d position2, double size, int just)
{
double location1[3] = {0,0,0};