如何从使用dxfwrite、Polylin生成的dxf中的顶点删除图层标记

2024-04-28 03:57:15 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试创建dxf导出器。我在python中使用dxfwrite。当我添加顶点时,它会自动添加一些额外的字段作为层信息。但是我想删除DXF文件中顶点的图层信息。你知道吗

例如: 在python中,我编写了以下代码:

从dxf写入导入dxf作为dxf

    out = dxf.polyline(linetype='DOT')
    out.add_vertices( [(0,20), (3,20), (6,23), (9,23)] )
    self.drawing.add(out)

它会在dxf文件的多段线字段下产生以下数据:

顶点
8
0
10
0
20
20
30
0
0
顶点
8
0
10
3
20
20
30
0
0
顶点
8
0
10
6
20
23
30
0
0
顶点
8
0
10
9
20
23
30
0
0

但应该是这样的:

顶点
10
0
20
20
30
0
0
顶点
10
3
20
20
30
0
0
顶点
10
6
20
23
30
0
0
顶点
10
9
20
23
30
0
0


Tags: 文件代码self图层add信息dxfout
1条回答
网友
1楼 · 发布于 2024-04-28 03:57:15

根据DXF标准,顶点实体是一个图形实体,所有 图形实体支持一组通用组码:

从DXF R12参考:

Each entity begins with a 0 group identifying the entity type. The names used for the entities are given on the following pages. Every entity contains an 8 group that gives the name of the layer on which the entity resides. Each entity may have elevation, thickness, linetype, or color information associated with it.

因此,图层标记是必需的,但应用程序也可以忽略组码8,因为所有顶点都应与多段线图元位于同一图层上。你知道吗

相关问题 更多 >