Ultimate solutions for AutoCAD

  Optimization:

  TotalPurge:

  Debalance.com:

Converting splines and other curves into polylines

TotalPurge features
The terms splines and curves in this context refer to the following non-trivial entity types:
  • Splines (NURBS) derived from the AcDbSpline class.
  • Ellipses (ELLIPSE) derived from the AcDbEllipse class.
  • Polylines (POLYLINE) with the attributes spline-fit and curve-fit, derived from the AcDb2dPolyline class.
TotalPurge implements the feature of converting curves of these types into simple AutoCAD polylines (LWPOLYLINE).
These transformations, in the majority of cases, do not always lead to optimization and reduction of the original drawing file size, and with certain settings the conversion of such objects into polylines often leads to the increase of its size. That is why the conversion of curves into polylines is disabled in the settings by default.

Nevertheless, in a number of tasks, the conversion of splines (ellipses, etc.) into polylines is a necessary condition for the further editing of a drawing. In this case, the implemented feature of conversion of curves into polylines with simultaneous optimization along with other objects appears to be a very useful and efficient option.

To enable the conversion of splines and other curves into polylines, in the application settings (on the "Polylines" tab in the "Settings" window), select the objects to be converted as shown on Fig. 1 (by default, the conversion is enabled only for the so-called "basic objects": lines, arcs, and circles).
Fig. 1
Prior to that, make sure that the "Smart conversion" option is enabled in the settings on the "Polylines" tab (see Fig. 2):
Fig. 2
For more information on the program settings, please see "Settings".
Please remember that with enabled "Optimization of blocks" the program converts objects into polylines within selected blocks.

TotalPurge unique features in the conversion of curves into polylines
Let's review the conversion of a spline shown on Fig. 3 into a polyline:
Fig. 3
Simple conversion of spline
With this conversion method, which is typical to the vast majority of converter programs, the converted spline appears as an approximating polyline with a number of vertices (see Fig. 4):
Fig. 4
The vertices follow the path of the spline with an even step. The smaller the step is, the more vertices the polyline has, and the more precisely the it follows the contour of the original spline. However, the resulting polyline has a major drawback; with a relatively small step, it has a great number of vertices. That, in its turn, increases the size of the drawing.

Optimized conversion of spline
Figure 5 shows an example of an optimized polyline obtained as a result of converting the spline using TotalPurge.
Fig. 5
As we can see it on the figure of the optimized polyline, the vertices are positioned on it with an uneven step. At places where the shape of the contour of the original spline is closer to straight line, the step between the vertices is greater. And vice-versa, at places where the sections have the greatest rate of bending, the polyline vertices are located closer to each other (with a smaller step).
This optimized polyline, due to sparse arrangement of the vertices on its straight sections, takes less space in a drawing.
The value of the minimum approximation step can be set in the "Approximation step" option (see Fig. 1).

Two approximation types
The program implements two approximation methods for converting curves into polylines:
  • Arc approximation.
  • Line approximation.
You can select the approximation method in the program settings on the "Curves" tab (see Fig. 6):
Fig. 6

Figure 7 shows a portion of a curve converted using both mentioned methods (line and arc approximation).
Fig. 7
As we can see it on the figure, in the case when the curve has a great rate of bending, the polyline obtained by arc approximation has smoother paths from vertex to vertex. Furthermore, the number of vertices involved in the creation of the polyline, produced by this method, is two times less than the number produced by line approximation.
Copyright © 2005-2013 DEBALANCE