mozman / ezdxf

Python interface to DXF

Home Page:https://ezdxf.mozman.at

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error with bbox.extents()

yoriyouriri opened this issue · comments

i'm trying get dxf bounds with bbox.extents():

dxf_doc = ezdxf.readfile('fd1.dxf')
msp = dxf_doc.modelspace()
extents = bbox.extents(msp, fast=True)

but i got error info like this:
1715671759459

fd1.zip

Hi!

You are working with very strange (crappy) DXF files. This one fd1.dxf is broken and AutoCAD cannot open it but BricsCAD can.

First you have to use the ezdxf.recover module to load such files:

from ezdxf import recover, bbox

doc, auditor = recover.readfile("fd1.dxf")
if not auditor.has_errors:
    print(bbox.extents(doc.modelspace()))

This is the short version, read this how to load DXF files from unreliable sources: https://ezdxf.mozman.at/docs/drawing/recover.html

Sadly this doesn't help to load this file, it still contains invalid B-spline definitions which ezdxf can't handle.

ok, i see!
there is another DXF file, and the error info is a little difference from above error, is it also a broken file?
1715676950949

btw, i've tried open it with AutoCAD 2022 successfully
801.zip

ezdxf.recover can open the file fd1.dxf - fixes 1156 issues, mostly missing BLOCK definitions.

The file 801.dxf only requires the recover module to open. (17 fixed issues)

thank u! i'll try add recover to my script