dxf file cannot be opened by autoCAD after been edited by KLayout

edited October 2016 in File Formats
I use the following code to do boolean operation to some layers in the dxf file:
# create the layout
layout = RBA::Layout::new
layout.read($input)
cell = layout.cell("TOP")

processor = RBA::ShapeProcessor.new
layer_a = layout.layer('aSi Reverse')
layer_b = layout.layer('aSi')
layer_out = layout.layer('aSi')
processor.boolean(layout, cell, layer_a, layout, cell, layer_b, cell.shapes(layer_out), RBA::EdgeProcessor::mode_anotb, false, false, false)
layout.delete_layer(layer_a)

layer_a = layout.layer('Al Top Layer Reverse')
layer_b = layout.layer('Al Top Layer')
layer_out = layout.layer('Al Top Layer')
processor.boolean(layout, cell, layer_a, layout, cell, layer_b, cell.shapes(layer_out), RBA::EdgeProcessor::mode_anotb, false, false, false)
layout.delete_layer(layer_a)
layout.write($output)


After this, I can use KLayout to view the layout, and it works correctly. However when I try to open the dxf file with autoCAD, it fails. Does anyone know the reason? Thanks.

Comments

  • edited November -1

    Hi,

    please give some more details. What is $output? Is this a file name ending with ".dxf"? Did you take a look into the file? Is it really DXF?

    Does AutoCAD report any error? How does it fail?

    Will AutoCAD read the file if you don't modify it? Can you pinpoint the modification that makes AutoCAD fail?

    Matthias

  • edited November -1
    Hi Matthias,

    Thanks for your quick response. The $output is definitely ending with '.dxf', and I believe it's really DXF file.
    Later I did the following test to debug:

    layout = RBA::Layout::new
    layout.read('test_input.dxf')
    cell = layout.cell("TOP")
    layout.write('test_output.dxf')

    As can be seen, this code just opens the dxf file and save it to another dxf file.
    When I use a simple test_input.dxf file, this is OK; However when I use the complicated dxf file I used before, it failed: The autoCAD screen is black, the command line has a prompt: "Press ENTER to continue:", and when I press ENTER, the autoCAD tab for this file closed. No error message.
  • edited November -1

    Hi,

    that's very difficult to debug then. I am not aware of similar issues, but it is likely to be related to the way polygons are written. Maybe switching to other polygon modes (like SOLID/HATCH/LWPOLYLINE) helps.

    Could you send a testcase to the mail address listed on the contact page?

    Thanks,

    Matthias

  • edited November -1
    Hi Matthias,

    I consulted my colleague and he told me he encountered this kind of thing before. However he told me all I need is GDSII file for fabrication, so it doesn't matter if I cannot open the dxf file in autoCAD. So I decided not to dig into this problem anymore and move on. Anyway thanks for your help, I really appreciate it!

    Best,
    Youpeng
  • Hi,

    I'm running into this same problem.
    As a test I

    • created a new file with only a box
    • saved it as DXF with file name test.dxf and 'Write POLYLINE entity' as writer option. I tried all others too, they don't work.
    • uploaded it to https://viewer.autodesk.com/

    This results in the following error:
    TranslationWorker-InternalFailure Unrecoverable exit code from extractor: -1073741831
    AutoCAD-InvalidFile Sorry, the drawing file is invalid and cannot be viewed. - Please try to recover the file in AutoCAD, and upload it again to view.

    Best,
    Stijn

  • Hi,
    I resolved this by installing LibreCAD, opening and saving the file in there resolved the problem.
    Best,
    Stijn

  • Hi Stijn,

    can you check if this problem is gone again with 0.27.3? For the details please see this discussion: https://www.klayout.de/forum/discussion/1883/version-0-27-1-writes-dxf-with-ac1014#latest

    Matthias

  • Dear Matthias,
    I tested with 0.27.7 and it worked with POLYLINE.
    Thanks a lot for your work!!
    Best,
    Stijn

Sign In or Register to comment.