TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: 2e4lite on May 17, 2014, 10:23:19 PM

Title: Invalid option keyword
Post by: 2e4lite on May 17, 2014, 10:23:19 PM
      ...
      (setq ent (ssname ss n))
     ...
      (command "chprop" ent "" "la" lay_chname "")
 
   It runs successfully in cad2004,but in cad2009, prompting Invalid option keyword,why?

Title: Re: Invalid option keyword
Post by: Kerry on May 17, 2014, 10:39:13 PM
Perhaps the command prompt sequence has changed ... if all other things are equal.
Title: Re: Invalid option keyword
Post by: 2e4lite on May 17, 2014, 10:54:56 PM
If I operate  step by step  in  the command line by this sequence,It is also successful
Title: Re: Invalid option keyword
Post by: Lee Mac on May 18, 2014, 06:21:19 AM
Try:
Code: [Select]
(command "_.chprop" ent "" "_layer" lay_chname "")
Title: Re: Invalid option keyword
Post by: 2e4lite on May 18, 2014, 07:35:32 AM
Thanks Kerry and  Lee Mac !
Title: Re: Invalid option keyword
Post by: irneb on May 20, 2014, 06:42:57 AM
      ...
      (setq ent (ssname ss n))
     ...
      (command "chprop" ent "" "la" lay_chname "")
 
   It runs successfully in cad2004,but in cad2009, prompting Invalid option keyword,why?


Try:
Code: [Select]
(command "_.chprop" ent "" "_layer" lay_chname "")
Moral of the story ... never use shortcuts for options when calling them from Lisp (use the full option's name). You can be nearly 100% sure something will change again if any new option is added in a later version, and the chance that that "something" is the shortcut is very high - while the name is much less probable.