问题标签 [ezdxf]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
187 浏览

python-3.x - 如何使用ezdxf在新的dxf文件中为图层编写注释

我正在使用 ezdxf 为工具生成 DXF 文件。此工具需要在 dxf 中包含包含每一层信息的注释。评论必须以特定方式格式化。

有没有办法创建评论并用 ezdxf 保存

注意:目前我使用“脏”钩子来做到这一点

我为每一层创建了一个带有 MYAPP ID 的 XDATA:

然后我保存 dxf 文件

在使用 python 脚本后,我删除1001 \ nMYAPP_DATA \ n了 dxf 文件中的所有匹配项以仅保留 999 个标签(否则 autocadLT 无法读取文件……其他工具(如 nanocad 或 babacad 可以但不是 autocadLT)

0 投票
1 回答
551 浏览

python - 使用 ezdxf 从 dxf 文件中的 BLOCK REFERENCES 中提取 HATCH 详细信息

我尝试使用 INSERT 标签提取 HATCH 实体及其模式类型,这些实体作为 BLOCK REFERENCES 插入图纸中。dxf 图纸是https://drive.google.com/open?id=1SnGDaIh8XiMe0QKAQy1RXzpT-rLNcLk7

我在 python-3.6 上使用更新包 ezdxf-0.12 使用以下代码

该代码未打印具有 ANSI31 模式的 HATCH 实体。dxf 文件中有 2 个,可以在 Autocad 中查看(甚至可以使用常规文本编辑器查找)。可以注意到,在给定的 dxf 文件中具有 SOLID 模式的 HATCH 实体照常打印。

代码或包更新中是否有任何错误?

0 投票
1 回答
392 浏览

dxf - 如何获取 DXF 文件中每个实体的图纸空间?

我想知道 DXF 文件中的每个实体将位于哪个图纸空间。我试图通过下面的代码找到它,但我得到的布局名称对于每个实体总是相同的,而 DXF 文件中有多个图纸空间。如何获取 DXF 文件中每个实体的图纸空间?

在此处输入图像描述

0 投票
1 回答
259 浏览

python - ezdxf python mtext设置位置

我想在我的 dxf 中放置一些简单的文本,如下所示:

我想将此文本插入到我的 dxf 中的x=1位置y=1

这是我尝试过的:

但我得到错误:

解决此问题的任何帮助表示赞赏。

编辑:

使用单行文本时,例如:

一切正常,但我仍然需要编写多行文本。

0 投票
2 回答
457 浏览

python - 有没有办法改变ezdxf中的背景颜色?

我想更改照片的背景颜色,因为不清楚我试图更改matplotlib背景图,但它不起作用

图片

0 投票
1 回答
793 浏览

dxf - DXF generation using ezdxf: polyline containing spline fit points

I am developing a program, and one of the requirements is to take DXF as input. The input is limited to 2D case only. The program itself is in C++/Qt, but to test it I need some sample DXF input. The spline import is already implemented, the next step is polyline with spline fit points or control points added. I decided to use Python/ezdxf to generate such polyline, as I don't have Autocad.

My first approach was to create a spline from fit points utilizing add_spline_control_frame, then convert it to polyline. The problem is there turned out to be no conversion from spline to polyline (although I think I saw it in the docs, but cannot find it anymore).

The current approach is to make polyline by add_polyline2d(points), making each point to be with DXF flag field equal 8 (spline vertex created by spline-fitting). The problem is points need to be of type DXFVertex (docs state Vertex, but it is absent), and that type is private for ezdxf.

Please share your approaches either to the problems I've faced with ezdxf, or to the initial problem.

P.S. I tried to use LibreCAD to generate such a polyline, but it's hardly possible to make a closed polyline from spline fit points there.

0 投票
0 回答
160 浏览

python - 通过 ezdxf 使用自定义字体

我想使用 ezdxf 在 dxf 上编写带有自定义 ttf 的文本。

我尝试使用doc.styles.new('custom_font', dxfattribs={'font' : 'myFont.ttf'})加载 ttf 文件(与我的脚本位于同一文件夹中),但它不起作用。

我的代码:

0 投票
1 回答
359 浏览

python - 使用 ezdxf 0.14.1 和 Python 3.8 获取动态块中的属性

我使用 auotcad 作为附件制作了一个动态块,里面有几个属性,即“RXXX”、“COOR”。 https://drive.google.com/file/d/1c8WdeAql1U5edFBKEK7coupx9ilX_Ga6/view?usp=sharing

我想按照 ezdxf 文档中的指导提取下面包装块的属性,但没有运气。 https://ezdxf.readthedocs.io/en/stable/tutorials/blocks.html?highlight=wrapped#evaluate-wrapped-block-references

如果有人对如何提取动态块内的属性有任何想法,谢谢。

0 投票
0 回答
73 浏览

python - 如何将布局从一个 dxf 复制到另一个 dxf?

我有一个带有布局的 dxf 文件 file1.dxf(布局 F11、布局 F12、布局 F13) 我有另一个带有布局的 dxf 文件 file2.dxf(布局 F21、布局 F22) 我想将布局从 file1 复制到 file2 我该怎么做使用ezdxf 做到这一点吗?现在,我通过在 CAD 上打开 file2 手动复制它们,并通过“单击从模板”导入 file1 图层,但复制太多布局很烦人。

0 投票
0 回答
80 浏览

python - 在方形影线之间执行减法运算

我能够使用可以生成正方形的 Python ezdxf 函数编写 dxf 文件。但我想画另一个更小的正方形,并想从更大的正方形中减去它以获得一个圆环。如何使用 ezdxf 函数做到这一点?

这是我的代码,它可以使用 ezdxf 生成方形阴影并将其写入 DXF 文件。