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

MULTILEADERS are missing when converting R2007 DWG files #1077

Open
xbdr419 opened this issue May 10, 2024 · 6 comments
Open

MULTILEADERS are missing when converting R2007 DWG files #1077

xbdr419 opened this issue May 10, 2024 · 6 comments
Labels

Comments

@xbdr419
Copy link

xbdr419 commented May 10, 2024

Hello, after I read a DWG file and save it directly, the dimension elements are lost. Here is the code. I hope to get some optimization. My current version is 1.1.4b2. 感谢。

from ezdxf.addons import odafc
doc = odafc.readfile(r'.\testt\demo.dwg')
odafc.export_dwg(doc, 'demo.dwg', version='R2007', replace=True)

source file:
image

save file:
image

dwg file:

demo.zip

@mozman
Copy link
Owner

mozman commented May 10, 2024

I don't know exactly the problem but it's related to the MULTILEADER entity in R2007 format.

It works when you first convert the DWG to R2013:

import ezdxf
from ezdxf.addons import odafc

def main():
    odafc.convert('demo.dwg', 'demo_R2013.dxf', version="R2013")
    doc = ezdxf.readfile('demo_R2013.dxf')
    odafc.export_dwg(doc, 'demo_out.dwg')
    # odafc.export_dwg(doc, 'demo_out.dwg', version="R2007")  # if you really need R2007

if __name__ == "__main__":
    main()

image

@xbdr419
Copy link
Author

xbdr419 commented May 10, 2024

Thanks, that is indeed the way to go,
my initial aim was to preserve the version information of the source file, which is the R2007 .

@mozman
Copy link
Owner

mozman commented May 10, 2024

Simpler version:

import ezdxf
from ezdxf.addons import odafc

def main():
    # due a bug this requires the odafc version format - fixed in next version
    doc = odafc.readfile('demo.dwg', version="ACAD2013")
    odafc.export_dwg(doc, 'demo_out.dwg')
    # odafc.export_dwg(doc, 'demo_out.dwg', version="R2007")  # if you really need R2007

if __name__ == "__main__":
    main()

@mozman
Copy link
Owner

mozman commented May 10, 2024

There is no hope of solving this problem. When I create a new drawing in R2007 DXF format using MLEADER, there are no problems. i.e. This is a specific problem that may take a lot of time to analyze - but I've already spent far too much time on this unnecessary (for me) and extremely (unnecessarily) complex entity. Therefore not a quick solution.

@mozman mozman changed the title When saving the DWG file, the dimension elements are missing. MULTILEADERS are missing when converting R2007 DWG files May 10, 2024
@xbdr419
Copy link
Author

xbdr419 commented May 11, 2024

Thank you very much, this has been able to solve my problem.

@mozman mozman added the bug label May 12, 2024
@mozman
Copy link
Owner

mozman commented May 12, 2024

This is a bug and the issue stays open even I won't fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants