TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: andrew_nao on July 17, 2014, 01:44:57 PM

Title: hello experts! need a little help
Post by: andrew_nao on July 17, 2014, 01:44:57 PM
ok here is the situation.
4 workstations, 1 with acad 2015, 3 with acad 2014.

company has its own custom ddedit command for text and attributes editing. its uses odcl.
in the code, it uses the "command" function.

in case anyone didnt already know this, in 2015 anything that used (command "..") will not work. you have to have (command-s "..")
anyway, I need a way to make the code recognize what version it needs to work for.

for example
i tried to get it change the "command" function based on the login name

Code: [Select]
(if (= getvar "loginname") "andrew")
(command-s "chprop" ent "" "C" newval "")
(command "chprop" ent "" "C" newval "")
)

but this didnt work.

does anyone have any suggestions on other ways i can try to change the "command" to "command-s" with either the version being used or based on the user, without making a new file?


Title: Re: hello experts! need a little help
Post by: kpblc on July 17, 2014, 02:09:20 PM
Perhaps this:
Code: [Select]
(defun tt ()
  (if (>= (atof (getvar "acadver")) 20.0)
    (command-s "_chprop" ent "" "_C" newval "")
    (command "_chprop" ent "" "_C" newval "")
  )
)
Title: Re: hello experts! need a little help
Post by: Tharwat on July 17, 2014, 02:20:11 PM
I have read around that the command call does not work anymore in AutoCAD 2015 but after I installed this latest version of Cad and wanted to check that out , I have it working without any fails at all .

But it does not work with your version , I think to replace the command with vl-cmdf will be enough . me thinks.
Title: Re: hello experts! need a little help
Post by: andrew_nao on July 17, 2014, 02:28:45 PM
Perhaps this:
Code: [Select]
(defun tt ()
  (if (>= (atof (getvar "acadver")) 20.0)
    (command-s "_chprop" ent "" "_C" newval "")
    (command "_chprop" ent "" "_C" newval "")
  )
)

acadver.. i didnt even think of this..

thanks this works perfectly
Title: Re: hello experts! need a little help
Post by: andrew_nao on July 17, 2014, 02:40:28 PM
I have read around that the command call does not work anymore in AutoCAD 2015 but after I installed this latest version of Cad and wanted to check that out , I have it working without any fails at all .

But it does not work with your version , I think to replace the command with vl-cmdf will be enough . me thinks.

thanks for the reply.
the vl-cmdf might work inplace of command with just lisp code. but when using it with open dcl, vl-cmdf errors out as if it was command

Title: Re: hello experts! need a little help
Post by: owenwengerd on July 17, 2014, 11:20:33 PM
Is your event invoked as Asynchronous? It should work fine in an asynchronous event.
Title: Re: hello experts! need a little help
Post by: dgorsman on July 18, 2014, 10:19:03 AM
Also discussed here: http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Vlisp-What-to-do-with-command-s/m-p/5058168

In short, since (command-s ...) isn't in earlier versions test for the presence of it.

And try to get everybody on the same version.  Its more important than ever.