Author Topic: how to know if a command exists  (Read 1536 times)

0 Members and 1 Guest are viewing this topic.

TopoWAR

  • Newt
  • Posts: 135
how to know if a command exists
« on: November 03, 2020, 01:14:24 PM »
good friends, here asking for your help, how can we know if there is a command in autocad, using lisp, for example: _MAP2SDF, as we all know there are commands that are only civil, thanks



I tried to use this method but it returns T, I want something that returns nil if the command does not exist, it seems that this difficult right ???
(vl-cmdf "_test")
« Last Edit: November 03, 2020, 06:03:12 PM by TopoWAR »
Thanks for help

Grrr1337

  • Swamp Rat
  • Posts: 812
Re: how to know if a command exists
« Reply #1 on: November 03, 2020, 06:06:11 PM »
hints:
vl-some
atoms-family
(apply ''((a b c)(a b c))
  '(
    (( f L ) (apply 'strcat (f L)))
    (( L ) (if L (cons (chr (car L)) (f (cdr L)))))
    (72 101 108 108 111 32 87 111 114 108 100)
  )
)
vevo.bg

TopoWAR

  • Newt
  • Posts: 135
Re: how to know if a command exists
« Reply #2 on: November 03, 2020, 06:45:48 PM »
Grrr1337,  this code has an error    :sick: :sick:
Thanks for help

BIGAL

  • Swamp Rat
  • Posts: 1411
  • 40 + years of using Autocad
Re: how to know if a command exists
« Reply #3 on: November 04, 2020, 11:30:14 PM »
it was a HINT

(atoms-family 1)
A man who never made a mistake never made anything

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1453
  • Marco
Re: how to know if a command exists
« Reply #4 on: November 05, 2020, 01:27:59 AM »
(Getcname "foo")

Edit:
Retrieves the localized or English name of an AutoCAD command  Supported Platforms: Windows and Mac OS Signature (getcname cname)

cname Type: String

The localized or underscored English command name; must be 64 characters or less in length.

Return Values
If cname is not preceded by an underscore (assumed to be the localized command name), getcname returns the underscored English command name. If cname is preceded by an underscore, getcname returns the localized command name. This function returns nil if cname is not a valid command name.

Examples
In a French version of AutoCAD, the following is True.

(getcname "ETIRER")
"_STRETCH"
 
(getcname "_STRETCH")
"ETIRER"