简体   繁体   中英

Copy an INSERT entity from one dxf file to another dxf file using ezdxf?

I have a dxf file blocks.dxf containing multiple block entities. I have another dxf file in.dxf into which I need to import the block entities of the previous dxf file blocks.dxf .

How do I copy the block entities from one file to another using ezdxf Python module so that the copied blocks can be inserted anywhere in the in.dxf file?

For people still looking for an answer on how to copy block definitions:

#generate list of blocks to import
list_of_blocks = df_uni_temp[mask].RefNo2.tolist()

doc_blocks = ezdxf.readfile('blocks.dxf')
doc = ezdxf.readfile('in.dxf')
importer = Importer(doc_blocks, doc)
#iterate through list of blocks
for b in list_of_blocks :
    print(b)
    importer.import_block(b)
importer.finalize()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM