【问题标题】:Using ezdxf to extract HATCH details from BLOCK REFERENCES in dxf files使用 ezdxf 从 dxf 文件中的 BLOCK REFERENCES 中提取 HATCH 详细信息
【发布时间】:2020-08-05 05:47:06
【问题描述】:

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

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

import ezdxf
import argparse

# construct the argument parse and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--input", required=True,
    help="path to input dxf file")
args = vars(ap.parse_args())
file = args["input"]    
doc = ezdxf.readfile(file)

msp = doc.modelspace()

for flag_ref in msp.query('INSERT'):
    for entity in flag_ref.virtual_entities():
        if entity.dxftype() == 'HATCH':

            print("HATCH", entity.dxf.pattern_name)

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

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

【问题讨论】:

  • DXF 文件的链接不起作用
  • 我修改了链接。谢谢指出。

标签: python autocad dxf ezdxf


【解决方案1】:

块“TC”的块引用#385和#38E具有非均匀缩放(-1,1,1),ezdxf默认忽略(镜像与非均匀缩放几乎相同的复杂性),你必须通过virtual_entities(non_uniform_scaling=True) 显式激活非均匀缩放。但非均匀缩放会为某些实体产生不正确的结果 - 这仍然是一个实验性功能。 HATCH 实体中还有一个错误,将在 ezdxf 的下一个版本 v0.12.1 中修复。

【讨论】:

  • 你知道ezdxf下一个版本什么时候出来吗?
  • Beta 版已经在 PyPI v0.12.1b0 上,周末最终发布。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-03-22
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多