Author Topic: display or inspect all defined commands inside AutoCAD session  (Read 10977 times)

0 Members and 1 Guest are viewing this topic.

huiz

  • Swamp Rat
  • Posts: 917
  • Certified Prof C3D
Re: display or inspect all defined commands inside AutoCAD session
« Reply #15 on: March 07, 2018, 03:26:14 PM »
Cool  :mrgreen:
The conclusion is justified that the initialization of the development of critical subsystem optimizes the probability of success to the development of the technical behavior over a given period.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: display or inspect all defined commands inside AutoCAD session
« Reply #16 on: March 07, 2018, 08:13:39 PM »
Thanks guys!  :-)

PS: Both updated (why in code comments).
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Grrr1337

  • Swamp Rat
  • Posts: 812
(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

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: display or inspect all defined commands inside AutoCAD session
« Reply #18 on: March 08, 2018, 06:45:56 PM »
If you like c:vars may like what i did to abuse it in version 2.02.

(not posted yet)

O.o
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: display or inspect all defined commands inside AutoCAD session
« Reply #19 on: March 08, 2018, 07:00:12 PM »
Quote from: Mae West
Of all the long things I've every tried --

-- this is the most recent.

Too long to post; attached.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

GDF

  • Water Moccasin
  • Posts: 2081
Re: display or inspect all defined commands inside AutoCAD session
« Reply #20 on: March 28, 2018, 08:23:15 AM »
Quote from: Mae West
Of all the long things I've every tried --

-- this is the most recent.

Too long to post; attached.

Awesome

Could this be modified to get only global setq vars?
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

GDF

  • Water Moccasin
  • Posts: 2081
Re: display or inspect all defined commands inside AutoCAD session
« Reply #21 on: March 28, 2018, 09:32:22 AM »
Got this to work...

Code: [Select]
(defun VARLISTIT  ()
  (textpage)
  (foreach
         n  '(ARCH#LOGO ARCH#YEAR ARCH#LTYP ARCH#UNIT ARCH#DECI ARCH#DDEC ARCH#ALDR ARCH#SYMS
              ARCH#ANNO ARCH#TEXT ARCH#PROJ ARCH#DIAL ARCH#CMDN ARCH#POSX ARCH#POSY ARCH#DIAP
              ARCH#LOOP ARCH#CLAY ARCH#LREA ARCH#MECH ARCH#CIVL ARCH#_CMM ACAD#PATH ARCH#BROW
              ARCH#DIRL ARCH#CUSN ARCH#LOGF ARCH#CUSF ARCH#MASF ARCH#CSTF ARCH#BLKF ARCH#FONF
              ARCH#HELF ARCH#IMAF ARCH#PATF ARCH#PROF ARCH#SUPF ARCH#FILF ARCH#LAYF ARCH#DRAF
              ARCH#BLOF ARCH#DIMF ARCH#SYMF ARCH#ANNF ARCH#UTIF ARCH#SCAL ARCH#SCID ARCH#SCDS
              ARCH#SLTS ARCH#LTSD ARCH#PLTS ARCH#UNID ARCH#LUID ARCH#_SCF ARCH#SFIL ARCH#SLAY
              ARCH#SDRA ARCH#SBLO ARCH#SDIM ARCH#SSYM ARCH#SANN ARCH#SUTI ARCH#SARC ARCH#SSTR
              ARCH#SMEC ARCH#SELE ARCH#SCIV ARCH_XDPC ARCH#XDCN ARCH#XDAD ARCH#XDTP ARCH#XDWW
              ARCH#XDPR ARCH#PIDF ARCH#DPRE ARCH#FMSG ARCH#LMSG ARCH#WMSG ARCH#BMSG ARCH#DMSG
              ARCH#LMSG ARCH#AMSG ARCH#UMSG ARCH#NLAY ARCH#NPLT ARCH#LAYL ARCH#LAYR ARCH#IWID
              ARCH#PWID ARCH#ENTL ARCH#ENTN ARCH#HPSC ARCH#HPGP ARCH#HFAC ARCH#VHAT ARCH#PHAT
              ARCH#UNIT ARCH#CLAY ARCH#LTSS ARCH#DDEC ARCH#DECI ARCH#LTYP ARCH#LOOP ARCH#ALDR
              ARCH#TEXT ARCH#ANNO ARCH#SYMS ARCH#LREA ARCH#TXSD ARCH#TXSN ARCH#TXST ARCH#TXSS
              ARCH#TXSC ARCH#TXSA ARCH#TXNW ARCH#TXTW ARCH#TXNH ARCH#TXTH ARCH#TXTS ARCH#TXVS
              ARCH#TXFD ARCH#TXFN ARCH#TXFT ARCH#TXFS ARCH#TXFC ARCH#TXFA ARCH#SIZE ARCH#ANGL
              ARCH#JAMB ARCH#SILL ARCH#RPDX ARCH#WWID ARCH#CPNT ARCH#GPNT ARCH#STEP ARCH#SRIS
              ARCH#STRD ARCH#SCNT ARCH#SJST ARCH#SREQ ARCH#STEQ ARCH#STPT ARCH#DECK ARCH#CABW
              ARCH#BLKX ARCH#RDPX ARCH#F_ID ARCH#F_OD ARCH#DTLN ARCH#SHTN ARCH#REV# ARCH#LINI
              ARCH#LIBF ARCH#LCMD ARCH#LSLD ARCH#LACT ARCH#LCLR ARCH#_ADC ARCH#DVAR ARCH#PAUS
              ARCH#TEMP ARCH#TNUM ARCH#DOSD ARCH#DSNP ARCH#DBRK ARCH#DECP ARCH#DSTP ARCH#DALN
              ARCH#DSTP ARCH#_NIC ARCH#SSET ARCH#ELVH ARCH#ELVW ARCH#BORD ARCH#BLKN ARCH#STRG
              ARCH#UDLR ARCH#VIEW ARCH#RTOS ARCH#_STR ARCH#_DIS ARCH#_NB_ ARCH#_VH_ ARCH#NVAL
              ARCH#PROJ ARCH#PNAM ARCH#DATE ARCH#PNUM)   
    (progn (print n) (princ (eval n)))))
(VARLISTIT)
(princ)
[code/]
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: display or inspect all defined commands inside AutoCAD session
« Reply #22 on: March 28, 2018, 12:03:54 PM »
atoms-family != sysvars

That said perhaps this ...

Code: [Select]
(defun c:Globals ( / :varz :get-var-spec :get-val-spec :pad :matching-vars :matching-vals :setvars :ntos :substr :main )

    ;;==========================================================================
    ;;  Globals.lsp
    ;;--------------------------------------------------------------------------
    ;;  \|//  1.01 2018-03-28
    ;;  |Oo|  © 2018 Michael Puckett Some Rights Reserved.
    ;;  |- |  mp@cadanalyst.org
    ;;--------------------------------------------------------------------------
    ;;  1.01  2018-03-28. MP. Initial code.
    ;;--------------------------------------------------------------------------

    (defun :globals ( )
        (vl-sort (atoms-family 1) '<)
    )

    (defun :get-var-spec ( / spec )
        (if
            (eq ""
                (setq spec
                    (strcase
                        (getstring "\nEnter variable NAME search pattern <*>: ")
                    )
                )
            )
            "*"
            spec
        )
    )
   
    (defun :get-val-spec ( / spec )
        (if
            (eq ""
                (setq spec
                    (strcase
                        (getstring "\nEnter variable VALUE search pattern <*>: ")
                    )
                )
            )
            "*"
            spec
        )
    )

    (defun :pad ( text len )
        (while (< (strlen text) len)
            (setq text (strcat text " "))
        )
        text
    )   
   
    (defun :matching-vars ( spec )
        (vl-remove-if-not
            (function (lambda (x) (wcmatch x spec)))
            (:globals)
        )
    )
   
    (defun :matching-vals ( vars spec )
        (vl-remove-if-not
            (function (lambda (p) (wcmatch (strcase (cadr p)) spec)))
            (mapcar
                (function
                    (lambda ( v / v$ v! )
                        (list v
                            (vl-prin1-to-string
                                (if (member
                                        (setq v! (type (setq v$ (eval (read v)))))
                                       '(exrxsubr file pagetb subr usubr vla-object)
                                    )
                                    v!
                                    v$
                                )
                            )
                        )
                    )
                )
                vars       
            )
        )
    )
   
    (defun :setvars ( lst )
        ;;  Pass the function a cons-pair or a list of cons-pairs:
        ;;  >> (setq restore (:setvars '((CMDECHO . 0)(REGENMODE 0))))
        ;;  Returns original values in the same construct:
        ;;  >> ((CMDECHO . 1) (REGENMODE . 1))
        ;;  So you can do this later:
        ;;  >> (:setvars restore)
        (mapcar
            (function
                (lambda ( p / k r )
                    (setq r (cons (setq k (car p)) (vl-catch-all-apply 'getvar (list k))))
                    (vl-catch-all-apply 'setvar (list k (cdr p)))
                    r
                )
            )
            (if (vl-list-length lst)
                lst
                (list lst)
            )
        )
    )
   
    (defun :ntos ( x / r s )
        (setq
            r (:setvars '((dimzin . 8)))
            s (if (eq 'real (type x)) (rtos x 2 15) (itoa x))
            r (:setvars r)
        )
        s   
    )
   
    (defun :substr ( text a b / result n )
        (setq result (substr text a b))
        (cond
            (   (not (< (setq n (strlen result)) (strlen (substr text a))))
                result
            )
            (   (wcmatch (substr text a) "(*)")
                (strcat (substr result 1 (- n 5)) " ..." (chr 41))
            )
            (
                (strcat (substr result 1 (- n 4)) " ...")
            )
        )
    )

    (defun :main ( / restore var-spec val-spec vars-vals var val len name handle )

        (cond

            (   (null (setq vars (:matching-vars (setq var-spec (:get-var-spec)))))
                (princ (strcat "\nNo variables matched pattern '" var-spec "'."))
            )
           
            (   (null (setq vars-vals (:matching-vals vars (setq val-spec (:get-val-spec)))))
                (princ (strcat "\nNo values matched pattern '" val-spec "'."))
            )

            (   (setq
                    restore (:setvars '((dimzin . 0)(luprec . 8)(auprec . 8)))
                    len     (1+ (apply 'max (mapcar 'strlen (mapcar 'car vars-vals))))
                    name    (vl-filename-mktemp "vars.txt")
                    handle  (open name "w")
                )
               
                (princ
                    (strcat
                        "ACADVER: " (rtos (atof (getvar 'acadver)) 2 1)
                        ": Global variables matching (name|value) pattern ('" var-spec "'|'" val-spec "'):\n\n"
                    )
                    handle
                )
               
                (foreach lst vars-vals
                    (princ
                        (strcat
                            (:pad (setq var (car lst)) len)
                            (cond
                                ((null (setq val (eval (read var)))) "nil")
                                ((numberp val) (:ntos val))
                                ((:substr (cadr lst) 1 80))
                            )
                            "\n"
                        )
                        handle
                    )
                )
               
                (:setvars restore)

                (close handle)

                (startapp "notepad.exe" name)

            )

        )

        (princ)

    )
   
    (:main)
   
)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

GDF

  • Water Moccasin
  • Posts: 2081
Re: display or inspect all defined commands inside AutoCAD session
« Reply #23 on: March 28, 2018, 12:37:54 PM »
Thanks
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: display or inspect all defined commands inside AutoCAD session
« Reply #24 on: March 28, 2018, 03:45:37 PM »
ur welcome
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Grrr1337

  • Swamp Rat
  • Posts: 812
Re: display or inspect all defined commands inside AutoCAD session
« Reply #25 on: March 29, 2018, 05:48:27 AM »
atoms-family != sysvars

That said perhaps this ...


(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

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: display or inspect all defined commands inside AutoCAD session
« Reply #26 on: April 14, 2018, 03:09:00 AM »
Hanhphuc @cadtutor.net has come up with a different, more direct way, to retrieve these 'ARX' commands:
http://www.cadtutor.net/forum/showthread.php?103760-AutoCAD-built-in-command-list-with-AutoLISP&p=701145&viewfull=1#post701145

The code does not work on BricsCAD BTW. But I notice that not all commands are listed. So 'inspecting all defined commands', as per the tittle of this topic, is not possible with this approach it seems.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: display or inspect all defined commands inside AutoCAD session
« Reply #27 on: April 14, 2018, 12:28:00 PM »
Thanks, interesting thread too.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst