Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Automation error. Key not found.

0 REPLIES 0
Reply
Message 1 of 1
john.uhden
617 Views, 0 Replies

Automation error. Key not found.

After setting 'layers to the layers object, I stupidly assumed that (vla-item layers <name>) would return nil if the <name> layer didn't exist.

WRONG, you get the Automation error.

Simple fix...

(setq name "whatever")
(and
  (tblsearch "layer" name)
  (setq layobj (vla-item layers name))
  ;; continue
)

because (tblsearch) will return nil if the named layer does not exist, and will cease further evaluation within the (and ...).

Yes, you could use the catch-all approach instead.

John F. Uhden

0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report