-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlayers.py
More file actions
27 lines (23 loc) · 742 Bytes
/
Copy pathlayers.py
File metadata and controls
27 lines (23 loc) · 742 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""
layers.py
ezdxf 图层初始化与管理模块
"""
from ezdxf.document import Drawing
from config import LAYER_CONFIGS
def setup_layers(doc: Drawing) -> None:
"""初始化 DXF 文档的标准图层与自定义线型"""
if "CENTER" not in doc.linetypes:
doc.linetypes.add(
name="CENTER",
pattern="A, 1.25, -0.25, 0.25, -0.25",
description="Center ____ _ ____ _ ____",
)
for layer_name, cfg in LAYER_CONFIGS.items():
if layer_name not in doc.layers:
doc.layers.new(
name=layer_name,
dxfattribs={
'color': cfg["color"],
'linetype': cfg["linetype"],
},
)