def bind_xref_3(doc): #一级深度绑定 doc_load(doc) xref_lst = get_lv1_xref(doc) if xref_lst: find_path = doc.Path for (name, path) in xref_lst: fpath = find_file(path, find_path) fpath = set_write(fpath) if fpath: doc2 = Autocad().app.documents.open(fpath) if bind_xref_1(doc2): doc2.close(True) elif binf_xref_2(doc2): doc2.close(True) else: print("Can not bind xref: " + doc2.name) doc2.close(False) if bind_xref_1(doc): return True elif bind_xref_2(doc): return True else: print("bind_xref_3 failed") return False