Why does this Dxf file fail importing?

Anonymous

Why does this Dxf file fail importing?

Anonymous
Not applicable

I am writting a python program that generates the attached dxf file. When it didn't have text labels it worked fine but now that I added the texts autocad says "Press enter to continue" and it fails importing it. Pressing F2 shows the error:

Customization file loaded successfully. Customization Group: ACAD
Customization file loaded successfully. Customization Group: CUSTOM
Customization file loaded successfully. Customization Group: AUTODESKSEEK
Customization file loaded successfully. Customization Group: MODELDOC
Customization file loaded successfully. Customization Group: EXPRESS
Customization file loaded successfully. Customization Group: APPMANAGER
Customization file loaded successfully. Customization Group: FEATUREDAPPS
The following error was encountered while reading
in TEXT starting at line 6234:
Invalid DXF data.
Invalid or incomplete DXF input -- drawing discarded.

Looking up the indicated line, I have:

 

(......)
11204.187099999999
20
623.359200000000
0
TEXT    --> line 6234
5
4D
100
AcDbEntity
8
0
6
ByLayer
62
256
100
AcDbText
10
0.000000000000
20
629.860900000000
30
0.000000000000
40
5
1
0  V0
50
0.0
41
1
51
0
7

71
0
210
0
220
0
230
1
100
AcDbText
0
LWPOLYLINE
5
1705412245488
330
1F
100
AcDbEntity
8
None
62
255
100
AcDbPolyline
90
2
70
0
43
0.0
10
0.000000000000
20
649.860900000000
10
0.000000000000
20
609.860900000000
0
TEXT
5
4D
100
AcDbEntity

(.....)

If I open this same file with LibreCad and save it, the resulting file opens perfectly with AutoCad. So what is exactly wrong with this file?

 

 

 

 

0 Likes
Reply
Accepted solutions (1)
2,308 Views
9 Replies
Replies (9)

ed57gmc
Mentor
Mentor

When I try to open your dxf, it crashes acad. If I try to open it in Notepad, its missing a lot of carriage returns. If I start a dwg from acad.dwt and add a TEXT entity, then save as dxf, it seems that compared to your section, you are missing some group codes.

 

Also, you might want to check out this repository on github. It is a reader/writer for python.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes

artc2
Autodesk
Autodesk
The problem is that the text style name (the line after group code 7) is blank:

7

71
0

This causes an error when AutoCAD tries to find that empty name string in the TextStyle table.

There are two other text entities further on that have the same problem. If you remove the line with the 7 and the empty line after it in the problem text entities, that will fix those problems (the text will use the default style).

With those fixed, I'm still seeing a problem at the end of the entities section. That problem doesn't have an obvious cause and I don't have time right now to debug it. I'll try to look at that issue later today.

If you could post up the dxf file that was saved from LibreCad, I'd like to look at it to see how it differs from the problem dxf file.
0 Likes

artc2
Autodesk
Autodesk
Accepted solution
Ok, the other problem is that all of your text entities have the same handle "4D". Every object in the dxf file must have its own unique handle value.
0 Likes

Anonymous
Not applicable

This is the Librecad Generated file. I just had to drag the file to librecad and it already displayed it correctly. Then I went to to File-> Save as to generate the file apent on this message. It works on AutoCad.

0 Likes

Anonymous
Not applicable

Oh... I might be a bit late for that last reply. I think that will help, thanks!

0 Likes

artc2
Autodesk
Autodesk
The LibreCad file changed the handles of pretty much all of the objects, and it changed the empty text style name to "STANDARD" in the problem text entities.
0 Likes

Milt-Fitz
Advocate
Advocate

To All...

I'm having similar issues with importing a DXF file, (refer to PDF attachment).

I've even tried opening the file in Navisworks, just to view the floor plan.

Any help would be appreciated.

Thanks in advance,

Milt

Milt Fitzgerald (a.k.a. Drafter1981)
Siemens Industries (Full-Time Office Position)
Fitz’ Digital Cad Service L.L.C. (Consulting Business)
https://sites.google.com/site/fitzdigitalcadservice/
0 Likes

cadffm
Consultant
Consultant

Impossible to open your PDF as a DXF in AutoCAD 😉

We need the file you talk about..

Sebastian

0 Likes

cadffm
Consultant
Consultant

And did you read the answer above? Librecad helps for many DXF-issues (corrupt data information) from non-Autodesk products.

Sebastian