Author Topic: (command-s) code example as correct function usage solution  (Read 1392 times)

0 Members and 1 Guest are viewing this topic.

ribarm

  • Gator
  • Posts: 3274
  • Marko Ribar, architect
(command-s) code example as correct function usage solution
« on: October 17, 2017, 09:28:16 AM »
Greetings,
I still have some prejudices about using (command-s) instead of (vl-cmdf) or (command) functions... From my testings discussed here :
https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/fit-arc-lisp-not-working-in-2017/td-p/7399812
I analyzed and adopted a thought that (vl-cmdf) is the best solution of those 3 options... Still I don't quite know how to imagine code example where it's correct option only (command-s)... So if someone has some example showing where (command-s) is needed and neither (vl-cmdf) or (command) functions could be its alternative, I'll be grateful to see correct implementation... I work on A2014 and still I haven't run into such problems like VVC internal errors that may occur when (command) or (vl-cmdf) functions are wraped inside (mapcar '(lambda ( arg1 arg2 ... ) (command/vl-cmdf "cmdname" "token1" "token2" ... "")) lst1 lst2 ...) loop...

I've looked several times into this link :
http://docs.autodesk.com/ACDMAC/2015/ENU/index.html?url=files/GUID-5C9DC003-3DD2-4770-95E7-7E19A4EE19A1.htm,topicNumber=d30e354832
and still I can't really figure it out... It must be some unusual usage where (command-s) is only solution...

Any thoughts are welcomed...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: (command-s) code example as correct function usage solution
« Reply #1 on: October 17, 2017, 10:31:34 AM »
Two things jump immediately to mind... Mac OS and *error*.  There's a third, although I haven't tested it, which is the (command-s ...) evaluates all tokens before execution, so if one of the tokens is borked AutoCAD isn't left halfway through a command call and expecting more inputs.
If you are going to fly by the seat of your pants, expect friction burns.

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

GP

  • Newt
  • Posts: 83
  • Vercelli, Italy
Re: (command-s) code example as correct function usage solution
« Reply #2 on: October 19, 2017, 09:22:42 AM »
My $0.02
I use (command-s) only in the *error* function

Ciao