[FIXED] DWG/DXF export fails with "AcDbDictionary" error

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Post Reply
aapo
Posts: 626
Joined: Mon Oct 29, 2018 6:41 pm

[FIXED] DWG/DXF export fails with "AcDbDictionary" error

Post by aapo »

Hi!

It seems that the DWG/DXF export of a part fails with "AcDbDictionary" error when the part gets more complicated, and apparently the dictionary somehow gets overflown. The ODA File Converter fails with the following error:

Code: Select all

OdError thrown during readFile of drawing "20191016-DWG-export-bug.dxf" :
  Object of class AcDbLine can't be cast to AcDbDictionary.
However, I think the problem lies with the DXF export, as some other CAD programs seem to have problems with the DXF files that FreeCAD produces, if the files are "too" complicated. I have attached a file, which has a simple circular plate with some hole sectors made with the polar pattern tool. If I make 10 or less holes, the DWG export works; but 11 or more holes I get an error. It is fairly repeatable by just changing the number of holes in the polar pattern object, and trying to export. The FCStd file showing the problem is attached.

Please note that the FreeCAD DXF export itself does not fail, even with 12 holes. Also, FreeCAD (and, e.g., IrfanView) can open the resulting DXF files fine; but some other programs like ODA File Converter have problems.

20191016-DWG-export-bug-pic1.png
20191016-DWG-export-bug-pic1.png (41.71 KiB) Viewed 1642 times
20191016-DWG-export-bug-pic2.png
20191016-DWG-export-bug-pic2.png (36.18 KiB) Viewed 1642 times

OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.18504 (Git)
Build type: Release
Branch: master
Hash: f66023a646db4b2502bb3637897443b3525ca3c7
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United Kingdom (en_GB)
Attachments
20191016-DWG-export-bug.FCStd
(53.68 KiB) Downloaded 30 times
Last edited by aapo on Fri Oct 25, 2019 5:47 am, edited 1 time in total.
User avatar
wandererfan
Veteran
Posts: 6326
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: [Bug?] DWG/DXF export fails with "AcDbDictionary" error

Post by wandererfan »

aapo wrote: Wed Oct 16, 2019 11:49 am It seems that the DWG/DXF export of a part fails with "AcDbDictionary" error when the part gets more complicated, and apparently the dictionary somehow gets overflown. The ODA File Converter fails with the following error:
Are you using the Draft module ("legacy") exporter or the Import module ("c++" or "new") exporter?

ODA didn't complain about these conversions, but I don't have anything else that reads DWG files. How do they look for you?
Attachments
importModdxfOutR14_12Holes.dwg.txt
(24.16 KiB) Downloaded 31 times
importModDxfOutR14_9Holes.dwg.txt
(20.43 KiB) Downloaded 31 times
importModDxfOutR14_12Holes.dxf
(97.75 KiB) Downloaded 28 times
importModDxfOutR14_9holes.dxf
(62.76 KiB) Downloaded 34 times
UR_
Veteran
Posts: 1355
Joined: Tue Jan 03, 2017 8:42 pm

Re: [Bug?] DWG/DXF export fails with "AcDbDictionary" error

Post by UR_ »

Autodesk TrueView

12 holes - error (recover needed)
Screenshot 002.png
Screenshot 002.png (14.28 KiB) Viewed 1602 times
Screenshot 003.png
Screenshot 003.png (10.26 KiB) Viewed 1602 times

9 holes - no errors
Screenshot 004.png
Screenshot 004.png (47.51 KiB) Viewed 1602 times
User avatar
wandererfan
Veteran
Posts: 6326
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: [Bug?] DWG/DXF export fails with "AcDbDictionary" error

Post by wandererfan »

UR_ wrote: Wed Oct 16, 2019 7:29 pm Autodesk TrueView
Thanks! Try another one?
ADViewer_F00.png
ADViewer_F00.png (58.71 KiB) Viewed 1574 times
Attachments
Import12HoleR14_F00.dxf
(77.18 KiB) Downloaded 44 times
aapo
Posts: 626
Joined: Mon Oct 29, 2018 6:41 pm

Re: [Bug?] DWG/DXF export fails with "AcDbDictionary" error

Post by aapo »

wandererfan wrote: Wed Oct 16, 2019 5:56 pm Are you using the Draft module ("legacy") exporter or the Import module ("c++" or "new") exporter?
Not 100 % sure, but I think I'm using the Import module ("c++" or "new") exporter. I used PartDesign workbench, selected the part, and chose File->Export. I don't think I have the "legacy" dxf exporter installed at all, as I generally don't use the Draft module in my work flow, and as such I haven't installed any draft-related extras.

OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.18504 (Git)
Build type: Release
Branch: master
Hash: f66023a646db4b2502bb3637897443b3525ca3c7
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United Kingdom (en_GB)
User avatar
wandererfan
Veteran
Posts: 6326
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: [Bug?] DWG/DXF export fails with "AcDbDictionary" error

Post by wandererfan »

Should be fixed by git commit 5512d5490c.
aapo
Posts: 626
Joined: Mon Oct 29, 2018 6:41 pm

Re: [Bug?] DWG/DXF export fails with "AcDbDictionary" error

Post by aapo »

wandererfan wrote: Fri Oct 18, 2019 1:59 pm Should be fixed by git commit 5512d5490c.
At long last, today, the Windows Travis builds of v0.19 in Github reached a version 18615, which contains your commit, and I was able to test the bug fix (my Linux build system doesn't have any DWG capability, and on Windows I don't have a build system). Anyway, I can confirm this fixed both the DXF and DWG issues with parts containing multiple holes. Thanks a thousand for the fix, this really helped me to deliver some drawings for steel laser cutting, and hopefully any new users won't need to stumble upon this problem, as the fix is now in the master. :)


OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.18615 (Git)
Build type: Release
Branch: master
Hash: a801ff5a236d9275c2dc184db5a457589b3eabc4
Python version: 3.6.7
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United Kingdom (en_GB)
Post Reply