It looks like you're new here. If you want to get involved, click one of these buttons!
I have a code to convert dxf to png
def process_images(input_dxf_file, output_dxf_file):
layout = db.Layout()
layout.read(input_dxf_file)
layout_view = lay.LayoutView()
layout_view.max_hier()
layout_view.max_hier()
top_cell = layout.top_cell()
layout_view.active_cellview().cell = top_cell
box = layout.top_cell().bbox()
roi = top_cell.dbbox()
layout_view.save_image_with_options(output_dxf_file, box.width()//10, box.height()//10, 0, 0, 0, roi, False)
Can I using mutilthread to convert mutil file DXF to PNG at the same time?
And Could this time process is less than time process one by one file ?
Comments
Hi @hieund,
Many years ago, before the KLayout standalone Python package existed,
I wrote an
OASIS --> PNG converter
that calls theklayout executable
, as shown below.The contents of
koas2png.py
are very similar to your code.The program is not a multi-threaded tool, but a multi-process tool with the interface shown below.
Suppose we have seven OASIS files to convert.
Let's compare sequential and parallel conversions.
1. Sequential Conversion
2. Multi-process Conversion
I think you can do something similar with the KLayout standalone Python package.
Good luck with that.
Kazzz-S
Mr @sekigawa, this is pretty good idea thanks for your help.
Very good. Thanks for this discussion.
I favor the multi-process way as there is little overhead except that you basically need two times the memory for the layout because you load it into each process. But on the plus side you can parallelize across multiple machines (not only cores).
Kind regards,
Matthias