FriendsOfCADability/CADability

Spline is not imported correctly

Closed this issue · 0 comments

The attached spline is not imported correctly.

2 final_neu.zip

Result now:
grafik

In the old Cadability this drawing is imported as a path and looks a lot better:
grafik

The reason for this, is this check:

for (int i = 0; i < poles.Length; ++i)
{
    poles[i] = GeoPoint(controlPoints[i]);
    //OdGePoint3d ctrlpnt = new OdGePoint3d();
    //spline.getControlPointAt(i, ref ctrlpnt);
    //GeoPoint dbg = GeoPoint(controlPoints[i]);
    if (i > 0 && (poles[i] | poles[i - 1]) < Precision.eps)
    {   // doppelte pole sind i.A. knickstellen und am Anfang oder Ende singulär.
        // wenn wir hier null liefern, dann wird ein Polygon draus gemacht (cat1.dxf)
        return null;
    }
}

I tried the same thing for the new version:

if (i > 0 && (poles[i] | poles[i - 1]) < Precision.eps)
{
    //How to determine the precision that must be used?
    var p2d = spline.ToPolyline2D(spline.ControlPoints.Length + spline.Knots.Length + 1);
    return CreatePolyline2D(p2d);
}

New result:
grafik

The questions are:

  • How to determine the precision (number of knots) that must be used?
  • Is Polyline2D always the right type or could it be Polyline3D?
  • Is there a different way to import this Spline correctly?

Any comments would be appreciated.

Michel