It looks like you're new here. If you want to get involved, click one of these buttons!
That my code :
import pya
from ezdxf.addons import odafc
odafc.unix_exec_path = "file/ODAFileConverter_QT6_lnxX64_8.3dll_25.5.AppImage"
input_file = "data_test/test.dwg"
output_img = "data_test_output/test.png"
doc = odafc.readfile(input_file)
print(f'Document loaded as DXF version: {doc.dxfversion}.')
path_output_dxf = "data_test/test.dxf"
odafc.convert(input_file, path_output_dxf, replace=True)
layout_view = pya.LayoutView()
layout_view.load_layout(path_output_dxf, True)
layout_view.set_config("grid-visible", "false")
layout_view.set_config("background-color", "#000000")
layout_view.max_hier()
layout_view.add_missing_layers()
layout_view.save_image_with_options(output_img, 1500, 1500)
my output:
my expected output is all image of file PDF.
Comments
Hi,
The PDF file seems to have too much information!
Pages 1 and 2 should be enough!
I deleted the file from my PC.
Hi Mr sekigawa, I think that is information of 1 layer in file input. And when I convert online by https://allinpdf.com/dwg-to-pdf, I got my output PDF with all layer.
Hi @hieund,
Pages 3, 4, and 5 seem to be the spec sheets. Is it OK to disclose them? I was just worried.
Kazzz-S
Hi @hieund,
In order to properly debug the issue, the PDF is not good. We would need the DXF file.
Usually these problems come from interpretation issues of POLYLINE entities. KLayout is not made for DXF, it is made for GDS2 and to match this format, it has to derive the filled areas from the lines. It needs to find closed loops for this purpose and there are too many flavors of DXF to have only one way of doing that. You need to try which is the one fitting for you.
The attribute is
LoadLayoutOptions#dxf_polyline_mode=
(https://www.klayout.de/doc-qt5/code/class_LoadLayoutOptions.html#k_50). You use it like this:Matthias