This project has moved. For the latest updates, please go here.

reading a single closed curve from a dxf document

Nov 12, 2013 at 10:10 PM
Edited Nov 12, 2013 at 10:10 PM
First of all, I want to thank the creators and contributors of this project. Really great stuff here!

So, my application requires the importing of a single closed polygon shape.

Short story: what constraints should I place on a DXF document such that I can extract a single, closed curve/polygon, and how easy is it to evaluate and extract a series of straight line segments from this using NetDXF?

Long story:

A lot of my Apps user base has requested DXF as an import format, but I am unsure as to what is the reasonable set of constraints I should impose on the creator of the DXF file, especially since I'm not very familiar with the drawing creation process.

The importer, one way or another, needs to recognize a single closed shape within the document, and needs to extract a series of vertices (or straight line segments). But my understanding is that a user may create such a shape by stitching together pieces of straight lines, splines, arcs, ellipses, and other mysterious and wonderful ingredients.

It is also my understanding, however, that these various objects can be assembled into a single 'polyline' which is a logical grouping of these objects. So, one constraint I'm considering is: The document must contain a single polyline, which will be evaluated at (user specified number) points and converted to straight line segments.

Some advice or guidance for a NetDxf Newbie would be appreciated!

Nov 14, 2013 at 5:44 PM
Your best option is to choose between polylines (in AutoCad they are called 3d polylines while in the dxf just polylines) and lightweight polylines (in AutoCad they are called polylines while in the dxf LwPolylines). A Polyline is a set of consecutive straight segments defined in 3d coordinates while a LwPolyline can also contain circular arc segments but all their vertex coordinates are restricted to a plane defined by its normal and elevation.

The library at the moment does not support spline fit polyline codes.