DXF writing

edited December 2010 in General
I've just updated to version 21 (windows 32 bit ) as I was particularly interested in the .dxf conversion offered in this new version. Version 20 and previous have been working flawlessly so I had high expectations. However I've encountered a problem. Although I am able to save files out as .dxf and re-open them in Klayout I am unable to open them in my other .dxf viewers. Autodesk's DWG TrueView gives an error message, the same for all 3 files I tried, "Table flags missing on line 22. Invalid or incomplete dxf input. Drawing discarded" . The Brava viewer from Informative Graphics also refuses to open the files but provides no helpful error message.
(I saved the files with the default options, do I need to change something?).
I'm hoping to use Klayout to convert .gds files from an i.c. design to .dxf for use by colleagues designing packages and probe cards who would like an AutoCad format.

Thanks

Ray

Comments

  • edited November -1

    Hi Ray,

    It looks like I was dropping too much from the DXF files - namely the layer flags. From the documentation I understood that almost everything is optional in DXF, but obviously that is not the case.

    I have enhanced the writer and right now I am able to write DXF which can be read by SolidWorks eDrawings viewer for example. I am preparing a new release 0.21.1 which will feature some more bug fixes and add the new writer to that version.

    Thanks an best regards,

    Matthias

  • edited November -1
    Thanks Matthias

    I'll keep an eye open for the updated release and try it out. If it's OK in my viewers I'll pass a .dxf to one of my AutoCad-user colleagues for them to try too.

    Ray
  • edited November -1
    Hi Matthias

    Thanks for release 0.21.1, I've tried it out and it is an improvement on the previous release but I'm still having a few issues. I still can't open .dxf files in the Autocad DWG Trueview viewer (100% cpu usage for several minutes on a small 300kB file) but the Brava Viewer will open files without protest. However there still seems to be some issue with the layer mapping. If I select a single layer using the 'visible layers only' option in the save as dxf window of KLayout and also tick the box to save only non empty cells I get a nice compact .dxf file which opens quickly in the Brava viewer but the data is in layer 0 whereas the source layer was 9. this would not be an issue except that if I add a couple of additional layers, simple boundary boxes, they are also output into the same layer 0. Reopening the .dxf in KLayout also shows all the data in a single layer named 1/0@1. I haven't asked my colleagues to try the files on AutoCad yet as I'm guessing it will have the same problems as DWG Trueview.

    Thanks for all your work on this, even without the .dxf export I find KLayout is a very useful tool.

    Ray
  • edited November -1

    Hi Ray,

    I found the bug in the "save visible only" feature. It also applied to CIF writing. Thanks for reporting that issue. I'll put the fix in the next minor release (0.21.2).

    I have not installed TrueView yet to track down the reading issue. But I am somewhat confident that there are no major bugs in the file I am writing.

    Best regards,

    Matthias

  • edited November -1
    Hi Matthias

    I sent one of the .dxf files created by KLayout 0.21.1 to a colleage with AutoCAD.
    (The file was one saved with the visible layers only setting but it opened correctly in the Brava viewer and not in DWGTrueView.)
    Unfortunately he was not able to open it in AutoCAD (he tried 2 versions).
    However he did get an error message which may be some help.
    "Improper table entry name on line 22.
    Invalid or incomplete DXF input -- drawing discarded"
    It seems AutoDesk products are far more fussy about the format of .dxf files than other viewers.

    I hope the error message is of some use to you.

    Ray
  • edited November -1

    Hi Ray,

    line 22 is always the first entry in the layer table. More precisely that is the layer name (as the message says).

    When I export GDS (or another format using numbers for layers) to DXF I create layer names of the form LxDy where x is the layer number and y is the datatype. Is there some rule in AutoCAD that layer names must not contain digits? Or is there a minimum required length for a DXF layer name?

    Meanwhile I have installed TrueView but it get's stuck at other files as well (ones that are not exported by KLayout).

    Best regards,

    Matthias

  • edited November -1
    Hi Matthias

    Thanks for the reply. I don't use Trueview from choice as I find it large and very slow!, the Brava viewer seems much better however I reasoned that TrueView may share more characteristics withAutoCAD which is why I tried using it to open your .dxf files.

    I don't know a lot about .dxf file naming rules but I found an old drawing which I beleieve was generated by an earlier release of AutoCad (file has a 2006 date) and which opens correctly in both viewers. This has some layer names which are text only (e.g. wafer) and others of the form Layer1 Layer2 etc. So numbers seem to be allowed but not required and names as short as 5 characters are certainly permitted. This file also appears to contain a layer with the name 0 so it appears that there may be no minimum limit but I'm not completely convinced of this. The only other rule I might guess at is that perhaps names should not contain spaces.

    If it would help I could send you this file as I don't think it contains any commercially sensitive information. Is there a way to do this through the forum?

    Best regards

    Ray
  • edited November -1

    Hi Ray,

    meanwhile I made some experiments with TrueView myself. You're right that it's somewhat more picky than other viewers. Since it delivers some meaningful error messages I was able to change the DXF writer accordingly. Right now, I don't have an example that TrueView cannot read. I have put the code changes into the 0.21.2 which I just released.

    I have not seen issues with the layer names, at least not with TrueView. That was probably a misinterpretation on mine.

    Hopefully that helps.

    Best regards,

    Matthias

  • edited November -1
    Hi Matthias

    Thanks, the changes made in version 0.21.2 seem to have solved the problem.

    I exported a .dxf file from one of our .gds files and was able to open it in both viewers. I then sent a copy to my colleague and he was able to open it in AutoCAD with no problems.

    I did still find that I got best results by exporting visible layers only and ticking the box to not export empty cells but that would seem the obvious set of options for my requirement in any case.

    I've just realised that as I can now open .dxf files in KLayout I don't need the other viewers any more so that's another benefit of the new version!

    Thanks again for your work creating this very useful piece of software.

    Best regards

    Ray
  • edited November -1
    I having problems to read a very simple design exported to DXF in Adobe Illustrator CS5. The file is simply a single square box in a single layer. When I export that to DXF and try to read it in Illustrator it treats the file as a text file, instead of a DXF file, so what I get is the text of the file. It looks like Illustrator does that when it doesn't recognize the filetype.

    I don't know exactly why it fails. It doesn't give any error message, actually.
  • edited February 2012

    Hi,

    KLayout uses a very simple form of DXF. The start of the file looks like this:

    0
    SECTION
    2
    HEADER
    0
    ENDSEC
    0
    SECTION
    2
    TABLES
    0
    TABLE
    2
    LAYER
    ...
    

    i.e. the header is empty. Maybe that is the reason why Adobe does not recognize it.

    Since other tools including AutoCAD accept this kind of file, I assume that is a valid although minimalistic approach. It's hard to tell why Adobe does not like that file.

    Although that is not a particular requirement according to the spec, some other tools use to write the record code right-aligned to 3 characters, i.e.

      0
    SECTION
      2
    HEADER
      0
    ENDSEC
      0
    SECTION
      2
    TABLES
      0
    TABLE
      2
    LAYER
    ...
    

    Maybe you can edit the first couple of lines manually and check if after doing so Adobe recognizes the format. If this makes the difference it's easy to adjust KLayout accordingly.

    Best regards,

    Matthias

  • edited November -1
    Indeed, changing the header from

    0
    SECTION
    2
    HEADER

    to...

    0
    SECTION
    2
    HEADER
    9
    $ACADVER
    1
    AC1006

    causes Illustrator CS5 to recognize the file as DXF (rather than text). Not sure if these are the optimal version numbers, etc... just something I found in a different forum.

    /Daniel
  • edited November -1

    Hi Daniel,

    thank you for that hint. I'll add that to the header in the next minor release. I reckon that AC1006 means something like AutoCAD 2010 - since the output format is not quite specific, I guess it does not matter much what version to use.

    Regards,

    Matthias

  • edited November -1
    Hi,
    I have some problem with converting to dxf file.
    I cannot open the DXF file in AutoCAD.
    First I did Selection>Merge Shapes
    Then I saved the GDS file with about 2000 vertices
    Then I saved it and opened it in AutoCAD. The file has a layer named L1D0 with no shape. I can open it in KLayout, but I cannot open it in AutoCAD. The file is somewhat complicated and easier to edit in AutoCAD.
    I would be thankful if you help me to convert it to dxf properly. I can send you the gds file to examine.
    Thanks,
    Geev
  • edited November -1
    An Update!
    I could open the DXF file in SolidWorks, and save it again, and the it was opened in AutoCAD.
    Regards,
    Geev
  • edited November -1

    Hi Geev,

    is there any error message in AutoCAD which could be helpful? The documentation of the DXF format is extremely poor. Specifically there is no information about what records are actually required and which aren't. KLayout writes a subset of the DXF records and only those I have some understanding of. If AutoCAD requires more, I need to know which ones.

    I was testing the DXF output on a variety of viewers and figuring out what is going on is always some game of trial and error. Lacking an AutoCAD installation I am not able to do the same with that one. I'll have a look at the test case you sent me, but I can't promise much.

    Matthias

  • edited November -1
    Hi Matthias,
    I think I found What the issue was. AutoCAD saves last viewing window when it saves the file and opens it at exact same view. But apparently the DXF file saved by KLayout does not have that information and AutoCAd opens the file while the origin located at left bottom of the window. Also it does not recognizes the unit of the file saved by KLayout. That's why it causes the difficulty of finding the structure, unless the origin is a point of the design.
    So, What I'll do is to open a very simple file generated by KLayout in AutoCAD, and Only change its unit and save it again, and send both files to you, plus a pdf file which have a two column table of both file for comparison. I saw both files, but the file saved by AutoCAD has a lot detail. I could not immediately figure out what is important and relevant. I hope it will help.
    Best,
    Geev
Sign In or Register to comment.