【问题标题】:How to extract entity wise color, transparency, linewidth of AutoCAD dxf file using ezdxf python package?如何使用ezdxf python包提取AutoCAD dxf文件的实体颜色、透明度、线宽?
【发布时间】:2022-10-05 13:16:21
【问题描述】:

我在 python 中使用 ezdxf 包来读取 AutoCAD .dxf 文件。谁能告诉我如何提取模型空间中存在的每个实体的线宽、透明度和颜色信息?

我尝试了以下代码:

doc = ezdxf.readfile('test.dxf')
model_space = doc.modelspace()
如果模型空间中的实体:
打印(实体.dxf.color)

输出将是 0、256 或 257,表示 (0-BYBLOCK 256-按层 第257章

我需要获取有关每个实体的信息。任何人都可以帮忙吗?

【问题讨论】:

    标签: python autocad dxf ezdxf


    【解决方案1】:
    # iterate over all entities in modelspace
    for e in doc.modelspace():
        print(f"layer: {e.dxf.layer}
    ")
        print(f"ACI: {e.dxf.color}
    ")
        ...
    

    另请参阅:Tutorial for getting data from DXF files

    【讨论】:

      猜你喜欢
      • 2019-08-28
      • 2014-12-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-08-05
      • 2012-10-09
      • 1970-01-01
      • 2014-07-09
      相关资源
      最近更新 更多