simple dxf file

Hi! Can you give one example of "minimum" dxf file? Just one rectangle saved from CorelDraw gives 4 kb of text. And I need only simple features: points, lines, polylines and polygons. Can you write here example of file containing one shape of each type? Thanks!

Reply to
Alex Kachanov
Loading thread data ...

I am not certain, but I think it is more complex than this. A dxf file created in autocad would also have layer and linetype defaults, which would be saved in ( I'm going to call it ) a header of it's own.

Surely there would be other headers for other types of info.

I think a polygon would be a polyline, but not sure of that either.

Do you want to be able to write dxf to import to autocad? I am having trouble conceiving any reason to NOT use autocad to create the types of entities you mention in the first place.

Reply to
roy

For example, here is the text file generated from a 5"X5" square, lines on layer 0, purged. Good reading.

Start of incredibly long, yet desperataly simple text file:

Reply to
Dr Fleau

..............................................

WE HEAR YOU, BUT:

when I want to create a polyline in lisp I code in something like:

(entmake (list (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (cons 8 lyr) (cons 100 "AcDbPolyline") (cons 90 4) (cons 70 oc) ;;;CLOSED POLYLINE (cons 43 0) (cons 38 0) (cons 39 0) (cons 10 a) (cons 40 0) (cons 41 0) (cons 42 0) (cons 10 b) (cons 40 0) (cons 41 0) (cons 42 0) (cons 10 c) (cons 40 0) (cons 41 0) (cons 42 0) (cons 10 d) (cons 40 0) (cons 41 0) (cons 42 0) ) )

where a, b, c and d are points, variables. there are things dear old autcad will assume if you don't specify.

is this the bare essentials. I hate extra work.

:)

I THINK (if you simply must create data outside of dear old autocad) IT WOULD BE EASIER BY FAR TO CREATE AN ASCII FILE AND READ IT IN IN LISP.

but then again, I still assume I don't quite get the reason for the effort, so my solution may be totally ignorant.

Reply to
roy

Alex Kachanov napisal(a):

Here is a simplest dxf file with point, line and polyline. It will work, but it's VERY plain drawing (without any layers, colors, linetype scales, etc.). It's writen in DXF 12 file format, which is much simpler then DXF 13 and later.

0 SECTION 2 ENTITIES 0 POINT 8 0 10 15.0 20 60.0 30 0.0 0 LINE 8 0 10 22.807666863788629 20 44.558355977114253 30 0.0 11 84.996858028638727 21 74.176390323253443 31 0.0 0 POLYLINE 8 0 66 1 10 0.0 20 0.0 30 0.0 0 VERTEX 8 0 10 30.94457034468331 20 117.4419503604917 30 0.0 0 VERTEX 8 0 10 6.5338586179422977 20 88.404661582461031 30 0.0 0 VERTEX 8 0 10 39.662681675662242 20 78.82235625113556 30 0.0 0 VERTEX 8 0 10 87.902895995003036 20 100.3099498777275 30 0.0 0 VERTEX 8 0 10 73.953917865436736 20 127.3146284758714 30 0.0 0 VERTEX 8 0 10 39.662681675662242 20 103.5040518853383 30 0.0 0 SEQEND 8 0 0 POLYLINE 8 0 66 1 10 0.0 20 0.0 30 0.0 70 1 0 VERTEX 8 0 10 8.8586887342223442 20 120.9264251521567 30 0.0 0 VERTEX 8 0 10

-3.4919684496407299 20

142.31839090147309 30 0.0 0 VERTEX 8 0 10

-28.193282817366882 20

142.31839090147321 30 0.0 0 VERTEX 8 0 10

-40.543940001229963 20

120.9264251521567 30 0.0 0 VERTEX 8 0 10

-28.193282817366899 20

99.534459402840412 30 0.0 0 VERTEX 8 0 10

-3.4919684496407499 20

99.534459402840383 30 0.0 0 SEQEND 8 0 0 ENDSEC 0 EOF
Reply to
Szoszon357

Started with the information in

formatting link

and was able to make a headerless, tableless file.dxf\ which succesfully draws two lines

MinTwoLines.dxf ```

0 SECTION 2 ENTITIES 0 LINE 8 DXF_Lines_LayerName 10 0.0 20 0.0 30 0.0 11 1.0 21 0.0 31 0.0 0 LINE 8 DXF_Lines_LayerName 10 1.0 20 0.0 30 0.0 11 1.0 21 0.0 31 2.0 0 ENDSEC 0 EOF ``` a Minimal .dxf with a spline seems to require header and table sections: see\
formatting link
Reply to
teserecter

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.