Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to read DXF files created in LibreCAD throws an exception #120

Closed
tchrdav opened this issue Apr 5, 2023 · 1 comment · Fixed by #121
Closed

Trying to read DXF files created in LibreCAD throws an exception #120

tchrdav opened this issue Apr 5, 2023 · 1 comment · Fixed by #121
Labels
bug Something isn't working

Comments

@tchrdav
Copy link

tchrdav commented Apr 5, 2023

Describe the bug
I tried to open a DXF files created in LibreCAD and got a CadLib.Exceptions.DxfException

To Reproduce
Download LibreCAD from https://librecad.org
Create any DXF file, and save it on disk. Open with ACadSharp library.

Expected behavior
File must be opened without exceptions.

Additional context
Circle.zip

@tchrdav tchrdav added the bug Something isn't working label Apr 5, 2023
@DomCR
Copy link
Owner

DomCR commented Apr 6, 2023

Hi @tchrdav,

I've checked the dxf, the file doesn't follow the official dxf documentation and seems to have some invalid fields, this is what I've found:

  • For DIMSTYLE the field 340 should be a handle reference pointing to a STYLE but instead is the name of the STYLE, "standard"
    • 340 DIMTXSTY (handle of referenced STYLE)
  • Similar case for DIMSTYLE 341 but in this case is empty which it may cause some errors when mapping the field
    • 341 DIMLDRBLK (handle of referenced BLOCK)

DIMSTYLE documentation

  • The block entity with handle 1C and name *Paper_Space has an invalid owner handle pointing to 1B which is not present in the file, the mapping can be solved using the name but this seems to be incorrect because the object doesn't exist at all.

After this investigation I've noticed that Autocad doesn't seem to be bother for this issues in the file and it can be opened without any problems so I'll open a branch to make the DxfReader more flexible for this irregularities.

Actions:

  • Make sure that the Failsafe in the reader works properly and is able to finish the reading notifying the errors found.
  • Improve the DxfReader to make sure that can handle references using names or handles.

@DomCR DomCR linked a pull request Apr 6, 2023 that will close this issue
3 tasks
@DomCR DomCR mentioned this issue Apr 7, 2023
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants