skip error message when open dxf failed?

Discussion in 'AutoCAD' started by zhangyi, Mar 21, 2005.

  1. zhangyi

    zhangyi Guest

    Hi, would anyone let me know how to skip the error message when open dxf failed? I have an automation running in AutoCAD to open several files one by one automatically. The problem is: when a dxf file can not be opened for some reason, autoCAD says: "Invalid or incomplete DXF input -- drawing discarded. press ENTER to continue:", and I have to manually click "ENTER" to let it continue. Is there workaround for this? I tried to set ShowWarningMessages = false and that does not help. Thanks a lot.
     
    zhangyi, Mar 21, 2005
    #1
  2. zhangyi

    W.H.O. Guest

    Hi there,
    I made a routine that inserts dxf's, it's started with a .bat file and runs in SDI. The .bat starts up acad with a script-file that calls the lisp. I modified the error handler so that it puts an entry in a log-file whenever an error occurs and then continues with the script, which starts a new template-based drawing and starts the lisp. Works fine, when a bad dxf is present the routine keeps on going (also works when opening dxf-files).
    I think all you have to do is modify the error handler so the program continues.
    Hopefully this will help.
     
    W.H.O., Mar 22, 2005
    #2
  3. zhangyi

    zhangyi Guest

    This seems to be the right thing to do. Now, I am using VB to write an ActiveX control to start AutoCAD, and everything is in my VB program. I know in Lisp the error function can be redefined. But how can I define the error event in a VB program? Thanks.
     
    zhangyi, Mar 22, 2005
    #3
  4. zhangyi

    zhangyi Guest

    OK, it seems that I can make it. DXF is different from DWG so that it should be IMPORT instead of OPEN. For DWG, the error can be caught by documents.open(filename); for DXF, the error can be caught by document.import(filename) (the document should be created by documents.new(name) first).
     
    zhangyi, Mar 23, 2005
    #4
  5. zhangyi

    W.H.O. Guest

    hi zhangyi,
    sorry I didn't respond sooner, am not much online.
    Don't know much about VB yet so I can't help you there but you seem to be getting somewhere...
    I'm using ACAD 2004 (and 2004 MAP), the displayed message with an illegal dxf is the same. My error-handler is as always defined in the first part of the lisp, from this place I call a subroutine for creating a log-entry and then switch to running my script-file.
    success with the error-catching, good hunting.
     
    W.H.O., Mar 24, 2005
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.