How can I get the size of a block and the width of a Mtext? #277
Replies: 2 comments 1 reply
-
I assume that by size you mean the bounding box of the entity in CAD coordinates? getting the size of arbitrary entities (which would be required for getting the bounding box of a block) is challenging and requires about as much work as actually drawing the entity. I would suggest that you use the matplotlib backend to draw (only) the entity that you want to measure then get the bounding box of the data present in the axes after drawing. If you want a tighter bounding box you can iterate over the artists in the axes and do whatever you like with them. Getting the size of text requires knowledge of what font being used and the measurements of that font. Again the simplest way is to render the text and measure it afterwards. Instead if you just want to get the width of a line of text (not taking the placement of the text such as rotation and scaling) you can use If you wanted a more performant approach you could implement your own rendering backend which simply keeps track of a bounding box containing any entities which have been drawn rather than actually drawing them. This would be more work but would be a nice clean approach. I don't know how to add tables with ezdxf so I can't help there I'm afraid |
Beta Was this translation helpful? Give feedback.
-
ACAD_TABLE is not yet supported by ezdxf. Maybe support will be added in the future. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi mozman,
I have three questions when using ezdxf.
Thank you! And it's really a useful package!!!
Best regards,
Gu
Beta Was this translation helpful? Give feedback.
All reactions