DXF file import

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
ike
Reply | Threaded
Open this post in threaded view
|

DXF file import

ike
Long time ago I built routine to import dxf files. It was done in vb6. Worked good but it does not read dimensions and splines.

There is a lot people dealing with DXF, and it would be nice if you can build DXF routines as separate library.
with wrapper in C, so other programming languages like python, freebasic, D ... can link it

and for some easy use a function that translate DXf into txt file that is even human readable:

translate("a.dxf", "a.txt")

A.TXT sample
LAYER_START nameofthelayer
BLOCK_START
LINE x1=10.222 y1=22.44 x2=44.67 y2=76.77 colorRGB=128,0,0 width=2 style=DASHDOT
POLYLINE_START colorRGB=128,0,0 width=2 style=DASHDOT
LINE x1=10.222 y1=22.44 x2=44.67 y2=76.77
LINE x1=44.67 y1=76.77 x2=144.67 y2=176.77
POLYLINE_END
BLOCK_END
LAYER_END

And also I think you should have LibreCAD native format as binary LCB and text LCT

Regards,

IKE







Reply | Threaded
Open this post in threaded view
|

Re: DXF file import

dxli
I prefer XML based text formats over simple text formats.

In this sense, SVG format is a good start point, and we should only extend stuff not supported by SVG.

This first step towards this goal is a design document. With detailed specification, the actual implementation is much easier.

For scripting support, Ries is adding Lua support in early support of LibreCAD V3.

Any help is welcome.

Thanks!

ike wrote
Long time ago I built routine to import dxf files. It was done in vb6. Worked good but it does not read dimensions and splines.

There is a lot people dealing with DXF, and it would be nice if you can build DXF routines as separate library.
with wrapper in C, so other programming languages like python, freebasic, D ... can link it

and for some easy use a function that translate DXf into txt file that is even human readable:

translate("a.dxf", "a.txt")

A.TXT sample
LAYER_START nameofthelayer
BLOCK_START
LINE x1=10.222 y1=22.44 x2=44.67 y2=76.77 colorRGB=128,0,0 width=2 style=DASHDOT
POLYLINE_START colorRGB=128,0,0 width=2 style=DASHDOT
LINE x1=10.222 y1=22.44 x2=44.67 y2=76.77
LINE x1=44.67 y1=76.77 x2=144.67 y2=176.77
POLYLINE_END
BLOCK_END
LAYER_END

And also I think you should have LibreCAD native format as binary LCB and text LCT

Regards,

IKE