Closed matheusfillipe closed 4 years ago
Hey, I think this is a result of unicode characters in the text, the lines referenced:
Out[26]: ['8', 'TRAÇADOHORIZONTAL_TRAÇADO4', '62', '255']
As a hotfix I'll force text into ASCII. Supporting every encoding flag is a bit more complicated.
Hi @mikedh! before anything, thanks a lot for the efffort!
I applied your patch by replacing the file \trimesh\path\exchange\dxf but unfortunantly it didn't help on nothing.
I also created a thread on AutoCad forums asking why it doesn't open the file (since librecad opens it just fine) and I think you might understand this more than I would be able to:
https://forums.autodesk.com/t5/autocad-forum/why-does-this-dxf-file-fail-importing/m-p/9230549
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).
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.
I hope that can help you!
Thanks that's very helpful! I updated the fix to pass a unique handle to text entities, and make sure we're stripping unicode before exporting.
What about having the standart style name or avoiding the those blank lines that autocad hates? Is it possible to set a style name already?
The way it is now autocad still complains with the same error on the TEXT.
How is it after #686? There should be no unicode or empty lines in the generated files, and every entity has a unique ID... there should at least be a new exciting error message 😄
Well the error is new haha.
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
Error 50 in drawing header on line 208.
Invalid or incomplete DXF input -- drawing discarded.
for the file: test.zip
Well I think it is getting close...
If you look on the thread on the autocad forum for the librecad saved file :
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.
And this is the file that works: https://forums.autodesk.com/autodesk/attachments/autodesk/706/1004864/1/test.zip
Do you have access to AutoCAD? Could you save the working file from AutoCAD in ASCII DXF R14? Then I can just use their verbatim header... IIRC I pulled the current header from a Draftsight export.
Here are some dxf formats I coud export from autocad:
Was that of any help?
Did you forget this issue @mikedh ? :sweat_smile: You were almost there....
Unfortunately I don't have cycles to work on this, and it's kind of tough for me to actually test the results without an AutoCAD license. I may get around to it eventually but super happy to take PR's on it in the meantime though!
I am using trimesh to open and add text labels to a draft dxf like this:
Where "estacas" is a list of points and labels of interest. I am also using this library for other things on my project but getting texts to work is being hard. Only LibreCad opened the dxf sucessfully. Draftsight only shows the last added text and Autodesk's AutoCad doesn't open it at all. Autocad asks for pressing enter and fails importing it if you press. The error reported presing F2 is:
The resulting file is: corrupt.zip
If i just open this file on librecad and save it it gets fixed and works fine on autocad: fixed.zip
Am I missing something or this is really an issue?