Author Topic: Available commands  (Read 2382 times)

0 Members and 1 Guest are viewing this topic.

pkohut

  • Guest
Available commands
« on: February 08, 2010, 05:19:45 PM »
Is there a method to retrieve a list of available Autocad commands at runtime?
I can get ones for ARX, and .Net easily (I think), lisp commands shouldn't be to
difficult, alias' is simple, but what about built in Autocad commands?

I know I can go under the hood the info, but that would require version specific
hacks.

TIA.


JohnK

  • Administrator
  • Seagull
  • Posts: 10660
Re: Available commands
« Reply #1 on: February 09, 2010, 01:42:50 PM »
well... I have two ideas:

You can use: atoms-family to a symbols list
-e.g. (atoms-family 0)
or
(progn
 (setq fn (open "C:\\ATOMS-FAMILY.txt" "w"))
 (mapcar '(lambda (x) (write-line x fn)) (atoms-family 1))
  (close fn)
 )

Quote
Returns a list of the currently defined symbols
(atoms-family format [symlist])

Arguments format

An integer value of 0 or 1 that determines the format in which atoms-family returns the symbol names:

0 Return the symbol names as a list
1 Return the symbol names as a list of strings

symlist

A list of strings that specify the symbol names you want atoms-family to search for.

Return Values

A list of symbols. If you specify symlist, then atoms-family returns the specified symbols that are currently defined, and returns nil for those symbols that are not defined.

Examples

Command: (atoms-family 0)


Or if all you wanted was a list of  default *commands* you can just parse the acad.pgp file found in
c:\\Docs and settings\\<username>\\<ACADsomthingorother>\\enu\\support\\acad.pgp
The file's syntax is simple enough, but...

Problems I see:
atoms family will return symbols not *commands* so-to-speak (global vars included)
acad.pgp is just a list of built-ins and could not be accurate to what the user has cooking in the background.


EDIT: forgot to close the file (close fn)
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Available commands
« Reply #2 on: February 09, 2010, 01:50:18 PM »
atoms-family doesn't return built in commands.  That was my first thought, but I made a list of atoms, and then  printed out the ' L ' ones, and line was not printed.

Quote
Command: (foreach i (atoms-family 1) (if (= (strcase (substr i 1 1)) "L") (print i)))(princ)

"LISPED"
"LOG"
"LAYERSTATE-IMPORT"
"LAYERSTATE-EXPORT"
"LASTSIGDIGIT"
"LAYERSTATE-ADDLAYERS"
"LAYERSTATE-IMPORTFROMDB"
"LENGTH"
"LOAD"
"LAYERSTATE-HAS"
"LAYERSTATE-GETNAMES"
"LISTP"
"LOGIOR"
"LAMBDA"
"LISPCOUNTCALLBACK"
"LOGAND"
"LAYERSTATE-GETLAYERS"
"LIST"
"LAST"
"LAYOUTLIST"
"LOAD_DIALOG"
"LAYERSTATE-DELETE"
"LIST->VARIANT"
"LAYERSTATE-RESTORE"
"LOADEDP"
"LAYERSTATE-REMOVELAYERS"
"LAYERSTATE-SAVE"
"LAYERSTATE-COMPARE"
"LSH"
"LAYERSTATE-GETLASTRESTORED"
"LAYERSTATE-RENAME"
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

JohnK

  • Administrator
  • Seagull
  • Posts: 10660
Re: Available commands
« Reply #3 on: February 09, 2010, 03:58:44 PM »
I know (I said that) but i was thinking of cobbling together the results from both. It would get him a step closer to what he has now; nothing.

I can start on a .pgp file parser if need be.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

pkohut

  • Guest
Re: Available commands
« Reply #4 on: February 09, 2010, 05:08:19 PM »
him a step closer to what he has now; nothing.

 can start on a .pgp file parser if need be.

 :-D
Thanks.  I just thought of the project 2 days ago and am putting together a little
prototype framework.  For now I can get by with the commands defined in the ARX
modules.  However, since commands can have modifiers associated with them, ie. layer
and -layer, I may need to use an external list of commands.

That all said and it being a prototype, if the UI is too clumsy, or interferes with the user
then I'll stop work on it.

Thanks again.

JohnK

  • Administrator
  • Seagull
  • Posts: 10660
Re: Available commands
« Reply #5 on: February 09, 2010, 09:00:12 PM »
*lol* glad you got a kick out of my humor.

no prob.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

pkohut

  • Guest
Re: Available commands
« Reply #6 on: February 19, 2010, 10:54:46 PM »
I've been brain storming ideas for the last week and have a pretty awesome application
built (in my head  :roll: ).  Also thought of a pretty cool application name, and registered
the domain.

For now bring on the straight jackets, cause I should be committed for taking on this
project.

Project name and site will be revealed at a later date.

pkohut

  • Guest
Re: Available commands
« Reply #7 on: February 19, 2010, 10:57:45 PM »
Oh ya, and if this doesn't pan out, the app/domain name can be reused for a pretty cool iPhone game title.  :-D

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Available commands
« Reply #8 on: February 20, 2010, 07:27:32 AM »
Got my curiosity up, keep us posted. 8-)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

LE3

  • Guest
Re: Available commands
« Reply #9 on: February 20, 2010, 02:41:55 PM »
Is there a method to retrieve a list of available Autocad commands at runtime?
I can get ones for ARX, and .Net easily (I think), lisp commands shouldn't be to
difficult, alias' is simple, but what about built in Autocad commands?

I know I can go under the hood the info, but that would require version specific
hacks.

TIA.

Some info I have that guess don't help:
The AcEdCommandStack stores pointers to ARX objects and functions, but there is no access to the function pointers of native AutoCAD commands.