简体   繁体   中英

How to remove layer tag from vertex in dxf generated using dxfwrite ,Polyline

I am trying to create dxf exporter. I am using dxfwrite in python. When I add vertex it adds some extra fields as layer information automatically. But I want to remove the layer information from VERTEX in DXF file.

For example : in python I wrote the following code:

from dxfwrite import DXFEngine as dxf

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

It results in following data under POLYLINE Field in dxf file:

VERTEX
8
0
10
0
20
20
30
0
0
VERTEX
8
0
10
3
20
20
30
0
0
VERTEX
8
0
10
6
20
23
30
0
0
VERTEX
8
0
10
9
20
23
30
0
0

But it should be like :

VERTEX
10
0
20
20
30
0
0
VERTEX
10
3
20
20
30
0
0
VERTEX
10
6
20
23
30
0
0
VERTEX
10
9
20
23
30
0
0

According to the DXF standard the VERTEX entity is a graphical entity, all graphical entities supports a set of common group codes:

From the DXF R12 Reference:

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.

Therefore the layer tag is mandatory, but applications can also ignores the group code 8, because all vertices should be on the same layer as the POLYLINE entity.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM