我一直在使用Autocad API根据(预先确定的)句柄ID填写块属性。这是实现的示例:
frame1 = acad.ActiveDocument.HandleToObject('18CA1')
frame2 = acad.ActiveDocument.HandleToObject('77CE9')
frames = [frame1, frame2]
for i in range(len(frames)):
for attrib in frames[i].GetAttributes():
if attrib.TagString == 'DATE':
attrib.TextString = datasource.date
if attrib.TagString == 'CLIENT_NAME':
attrib.TextString = datasource.client_name
attrib.Update()
现在,我想使用ezdxf库实现相同的功能。我只是无法找到类似于。HandleToObject(“ xxx”)] >>的方法。根据以下代码,我确定句柄ID的确与autocad实现中的相同。
modelspace = dxf.modelspace() for e in modelspace: if e.dxftype()== 'TEXT': print("text: %s\n" % e.dxf.text) print("handle: %s\n" % e.dxf.handle)
在ezdxf中可以吗?我已经列出了需要更改的所有特定句柄的列表,理想情况下,我宁愿遍历该列表,而不必遍历所有实体以检查其句柄。
我一直在使用Autocad API根据(预先确定的)句柄ID填写块属性。这是实现的示例:frame1 = acad.ActiveDocument.HandleToObject('18CA1')...
ezdxf