-
Notifications
You must be signed in to change notification settings - Fork 200
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
ELLIPSE should accept an axis ratio as small as 1e-10 #800
Comments
I did some tests with DWG Trueview 2021 and the valid range for the axis-ratio also expands into the negative side and the lower limit of 1e-10 is also new to me: -1.0 ... -1e-10 and +1e-10 ... +1.0 EDIT: the valid negative range is also documented in my source code 😄 |
@dmkh1984 I'm not sure if this is really the solution, so the sample file would still be appreciated. |
Fun fact, after I delete all "sensitive" info, it works just fine. So, it seems that it got corrupted object. I will try to find this obj on |
@dmkh1984 The problem is clearly the import ezdxf
doc = ezdxf.readfile("your.dxf")
for e in doc.entitydb.values():
if e.dxftype() == "ELLIPSE":
print(f"Ellipse axis-ratio: {e.dxf.ratio}") Please post the output of this script here. |
I slightly update script: import ezdxf
doc = ezdxf.readfile("Delete_Target.dxf")
print("Work start")
for e in doc.entitydb.values():
if e.dxftype() == "ELLIPSE":
print(f"Ellipse #{e} axis-ratio: {e.dxf.ratio}")
print("Work end") That I get it's a lot, so I save output to file (attached) |
Thank you - it was really the lower bound of 1e-6 for the axis-ratio which caused the issue and this is fixed now. |
Discussed in #799
Originally posted by dmkh1984 December 15, 2022
Good day.
I open document (try DXF2018 and DXF2010/2013 formats, works same), delete some entities with paperspace.delete_entity(entity) and try to save document with doc.save() and got broken file and this:
`Traceback (most recent call last):
File "F:\Scipts\Delete\Delete.py", line 35, in
doc.save()
File "C:\Users\PyDev\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\ezdxf\document.py", line 543, in save
self.write(fp, fmt=fmt) # type: ignore
File "C:\Users\PyDev\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\ezdxf\document.py", line 601, in write
self.export_sections(tagwriter)
File "C:\Users\PyDev\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\ezdxf\document.py", line 620, in export_sections
self.entities.export_dxf(tagwriter)
File "C:\Users\PyDev\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\ezdxf\sections\entities.py", line 111, in export_dxf
layouts.modelspace().entity_space.export_dxf(tagwriter)
File "C:\Users\PyDev\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\ezdxf\entitydb.py", line 391, in export_dxf
entity.export_dxf(tagwriter)
File "C:\Users\PyDev\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\ezdxf\entities\dxfentity.py", line 686, in export_dxf
self.export_entity(tagwriter)
File "C:\Users\PyDev\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\ezdxf\entities\ellipse.py", line 126, in export_entity
assert is_valid_ratio(self.dxf.ratio)
AssertionError`
Overall, great package, big thanks.
The text was updated successfully, but these errors were encountered: