why won't this error trap work?

Discussion in 'AutoCAD' started by kemp, Jul 23, 2004.

  1. kemp

    kemp Guest

    I'm still trying to learn how to use the error trapping functions in
    vlisp, here is my code:

    (vl-catch-all-error-p (vl-catch-all-apply (vla-item *layers* layName)))

    Right now (vla-item *layers* layName) returns "Automation Error. Key not
    found" if the layer does not exist, but it works fine if the layer does
    exist.

    What am I doing wrong? Am I way off base with this?

    Thanks,

    kemp
     
    kemp, Jul 23, 2004
    #1
  2. (vl-catch-all-error-p (vl-catch-all-apply 'vla-item (list *layers*
    layName)))

    Of course, it is probably unneeded when you consider that the Add method
    does *not* throw an error if the layer already exists. So you can simply use
    the Add method to either set/retrieve the desired Layer object.

    --
    R. Robert Bell


    I'm still trying to learn how to use the error trapping functions in
    vlisp, here is my code:

    (vl-catch-all-error-p (vl-catch-all-apply (vla-item *layers* layName)))

    Right now (vla-item *layers* layName) returns "Automation Error. Key not
    found" if the layer does not exist, but it works fine if the layer does
    exist.

    What am I doing wrong? Am I way off base with this?

    Thanks,

    kemp
     
    R. Robert Bell, Jul 23, 2004
    #2
  3. kemp

    kemp Guest

    Ah, yes, this worked simple enough. Thanks!

    kemp
     
    kemp, Jul 23, 2004
    #3
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.