dxf conversion issues

edited April 23 in File Formats


while trying to convert a photolitography mask made in AutoCAD (.dwg) to a klayout compatible file (.dwg) I stumbled upon some issues already discussed in the forum before. After adjusting the reader options(I tried 1e-06 and 1e-04 for database unit as well), the coordinate overflow error still remains. Are there any alternative approaches that can be tried to repair this?
Link to files: https://easyupload.io/m/bce0kv

Kind regards


  • Hi @dviole,

    Thank you for providing the test data.

    I was able to read this file with these settings:

    You see I have used a DXF unit 1µm - so a DXF dimension of "1" corresponds to 1µm.

    You are using a DXF unit of 1000µm which is 1mm. As your design's coordinates are in the range of ~4000, that would mean you're trying to represent a design which has a dimension of about 4 meters. Is that really true?

    Anyway, this explains the coordinate overflow: with 32 bit coordinates (the standard build) and a database unit of 1e-4 (µm), you can represent a coordinate space of about -200 to 200mm. To represent 4 meters, you have to use a larger database unit (e.g. 0.01).

    I also see that inside the DXF file you are using extreme scale factors like 0.0015578 for the "YOUR_DIE_DESIGN" block. This is rather unusual and leads to rendering issues. Is that intended?


  • Hi @Matthias,

    thank you for the help. The explanation of the units also cleared some things up.
    I did try the suggested settings, but almost all the smaller dimensioned elements get lost, and even some bigger ones get distorted. Is this fixable?
    As for the coordinates, you are right, there were some elements which stood far away from the actually intended design. The whole thing should be less than 200 x 200

    Regarding the extreme scale factors, those are templates with which I have to work, and I may not change them, but thank you for noticing that as well. I will mention it to the people working on them.


  • I think the problem is related to the way, polygons are formed.

    DXF only knows lines, but GDS has polygons. So KLayout needs to stitch together polygons from lines. This is basically very tricky - specifically if the connections are manifold like in your design. You can avoid ambiguities here by drawing polygons as closed POLYLINE or LWPOLYLINE (DXF speak). KLayout can translate such objects into Polygons unambiguously. I don't think this is the case here.

    I noticed that in the test data you sent, the lines are even distributed on different layers (Mask_Coarse, Mask_Fine). This effectively makes it impossible to restore polygons from line data.

    I need to emphasize once again that DXF is not a good format for mask making. It's a matter of luck whether you will be able to translate the results into GDS or any other format suitable for photo mask making. You can stick to certain rules which facilitate this conversion, but extreme scale values and distributing lines among different layers surely are not among those. Don't expect the impossible from the software.


  • Thank you a lot for the explanations. I will look for other possibilities to fix this issue for converting .dwg to .gds.
    Kind regards

Sign In or Register to comment.