Author Topic: hello experts! need a little help  (Read 2100 times)

0 Members and 1 Guest are viewing this topic.

andrew_nao

  • Guest
hello experts! need a little help
« 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?



kpblc

  • Bull Frog
  • Posts: 396
Re: hello experts! need a little help
« Reply #1 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 "")
  )
)
Sorry for my English.

Tharwat

  • Swamp Rat
  • Posts: 707
  • Hypersensitive
Re: hello experts! need a little help
« Reply #2 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.

andrew_nao

  • Guest
Re: hello experts! need a little help
« Reply #3 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

andrew_nao

  • Guest
Re: hello experts! need a little help
« Reply #4 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


owenwengerd

  • Bull Frog
  • Posts: 451
Re: hello experts! need a little help
« Reply #5 on: July 17, 2014, 11:20:33 PM »
Is your event invoked as Asynchronous? It should work fine in an asynchronous event.

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: hello experts! need a little help
« Reply #6 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.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}