Skip to content
Discussion options

You must be logged in to vote

The DXF format is not designed to preserve the text layout across CAD applications. If you've ever imported a DXF drawing into any other CAD application, you will know that no other CAD application renders the text and dimensions in the same way as AutoCAD, although BricsCAD comes very close. Perhaps the DXF format and ezdxf are not the right tools for this task.

You can use the text2path add-on to get the text bounding box in drawing units for a single TEXT entity:

import ezdxf.path
from ezdxf.addons import text2path

doc = ezdxf.readfile("your.dxf")
msp = doc.modelspace()

for text in msp.query("TEXT"):
    bbox = ezdxf.path.bbox(text2path.make_paths_from_entity(text))
    print(f"width={

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by konradmalik
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #449 on May 28, 2021 02:53.