BUG: DXF Import (generated by deepnest)

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
Post Reply
MRx
Posts: 319
Joined: Wed Jul 08, 2020 5:59 am
Location: Tainan / Taiwan

BUG: DXF Import (generated by deepnest)

Post by MRx »

The attached object should show up 3 parts in FreeCAD, however it only shows up one.


FreeCAD (original):
4GfeJm.png
4GfeJm.png (33.66 KiB) Viewed 2914 times
LibreCAD:
QvlB0u.png
QvlB0u.png (6.12 KiB) Viewed 2914 times
Solution:

I keep updating this thread during my investigation.

the commands after SEQEND seem to be handled wrong, if I remove 8 / 0 and only leave 0 after SEQEND the next POLYLINE will load. So the parameter "8" whatever that is seems to be the issue.

Code: Select all

 1512 SEQEND
 1513  8
 1514 0 
 1515   0
ok 8 could be an identifier for "Layer name (fixed)"
Now the DXF importer ignores 8.

It reads the following 0 and expects a command section afterwards, however the following 0 (directly after 8) doesn't match and misaligned the import stream for the state machine so everything just dies off there.

A fix would be:

Code: Select all

                else if(!strcmp(m_str, "0"))
                {
                        //get_line();
                        while(!((*m_ifs).eof())) {
                                if (m_str[0]>='0' && m_str[0]<='9')
                                        get_line();
                                else
                                        break;
                        }
it will still jump into it when it gets the unknown identifier but it will strictly expect an "entity type".
FreeCAD-git/src/Mod/Import/App/dxf.cpp

Pull Request:
https://github.com/FreeCAD/FreeCAD/pull/6924

there are so many other values not handled, it's better to try to re-align for now.

Text string indicating the entity type (fixed)
http://docs.autodesk.com/ACD/2011/ENU/f ... 9-7a62.htm

Fixed:
ujetdD.png
ujetdD.png (11.43 KiB) Viewed 2853 times

Code: Select all

===== Could not solve system ====== 
CDxfRead::ReadLayer() - no layer name
CDxfRead::DoRead() Failed to read layer
This function will be deprecated. Please use 'convert_draft_texts'.
----------------
Convert Draft texts
CDxfRead::ReadLayer() - no layer name
CDxfRead::DoRead() Failed to read layer
This function will be deprecated. Please use 'convert_draft_texts'.
----------------
Convert Draft texts
CDxfRead::ReadLayer() - no layer name
CDxfRead::DoRead() Failed to read layer
This function will be deprecated. Please use 'convert_draft_texts'.
----------------
Convert Draft texts
This function will be deprecated. Please use 'convert_draft_texts'.
----------------
Convert Draft texts
dxfbug.dxf
(49.16 KiB) Downloaded 97 times
OS: macOS 10.15
Word size of FreeCAD: 64-bit
Version: 0.20.26556 (Git)
Build type: Release
Branch: adaptive_dicretize_bugfix
Hash: 4357816c94ff4938b778eb9f8aba8fe0e1c917dc
Python version: 3.9.0
Qt version: 5.15.2
Coin version: 4.0.0
OCC version: 7.5.0
Locale: English/Germany (en_DE)
heda
Veteran
Posts: 1348
Joined: Sat Dec 12, 2015 5:49 pm

Re: BUG: DXF Import (generated by deepnest)

Post by heda »

kudos for finding out where it stalled and doing something about it - thumbs up.

btw, the import appears to work as is with the legacy importer
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: BUG: DXF Import (generated by deepnest)

Post by Kunda1 »

Indeed I echo @heda's sentiments. Thanks for the sleuthing and PR!
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Post Reply