Closed shine-flower closed 2 years ago
1st Q: this depends on the font design and on the rendering by the Matplotlib
package, but you can scale the paths to a uniform height. Detect the bounding box of the paths by the function bbox = ezdxf.path.bbox()
and add a Matrix44.scale(heigth/bbox.size.y)
operation to the transform_paths
call, this scales all paths to the same final absolute height, but this is only useful for the same text.
2nd Q: this depends on the CAD application/DXF viewer - in AutoCAD/BricsCAD enter the command REGEN
to get smoother curves
第一个问题:这取决于字体设计和
Matplotlib
包的渲染,但您可以将路径缩放到统一的高度。通过函数检测路径的边界框bbox = ezdxf.path.bbox()
并在调用中添加一个Matrix44.scale(heigth/bbox.size.y)
操作transform_paths
,这会将所有路径缩放到相同的最终绝对高度,但这仅对相同的文本有用。第二个问题:这取决于 CAD 应用程序/DXF 查看器 - 在 AutoCAD/BricsCAD 中输入命令
REGEN
以获得更平滑的曲线Q2: I added the following code. It is OK!
zoom.extents(msp)
Question 1
Text2path is the same height, some fonts are actually bigger. such as: Microsoft YaHei (I'm using height 1).
Question 2
The same code generated out of DXF files, different software to open, the smoothness of the line is very different, and autocad performance is not too friendly.