Author Topic: Menu for lisp commands  (Read 5235 times)

0 Members and 1 Guest are viewing this topic.

BREZI

  • Guest
Menu for lisp commands
« on: November 05, 2004, 06:25:01 AM »
Im trying to create a pull down menu to load lisp routines.

Here is the line of programming, im doing something stupid and can't see it, anybody help out there?

The lisp routine is called 2dap.

ID_TRUNKING_SECTION_0 [Trunking Section]^C^C-appload;2dap;;;

Thanks

MikePerry

  • Guest
Menu for lisp commands
« Reply #1 on: November 05, 2004, 06:31:08 AM »
Hi

Have a browse of the following thread (also take note any links within) -

loading lisp

Have a good one, Mike

Mark

  • Custom Title
  • Seagull
  • Posts: 28683
Re: Menu for lisp commands
« Reply #2 on: November 05, 2004, 08:33:50 AM »
Quote from: BREZI
Im trying to create a pull down menu to load lisp routines.

Here is the line of programming, im doing something stupid and can't see it, anybody help out there?

The lisp routine is called 2dap.

ID_TRUNKING_SECTION_0 [Trunking Section]^C^C-appload;2dap;;;

Thanks

ID_TRUNKING_SECTION_0 [Trunking Section]^C^C(load "2dap")2dap;

without testing
TheSwamp.org  (serving the CAD community since 2003)

BREZI

  • Guest
Menu for lisp commands
« Reply #3 on: November 05, 2004, 10:16:50 AM »
THANKS

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Re: Menu for lisp commands
« Reply #4 on: November 05, 2004, 10:43:20 AM »
I've always been fond of this type:
Code: [Select]
ID_TRUNKING_SECTION_0 [Trunking Section]^C^C^C(if (not c:2dap)(load "2dap"));2dap;

ML

  • Guest
Menu for lisp commands
« Reply #5 on: November 05, 2004, 04:15:33 PM »
I also use ^C^C(load "filename.lsp") to load lisp routines from my pulldown

The below example loads both a VBA Module and Lisp routine from the same macro. Some, I do -vbaload;filename;-vbarun;filename
This loads and runs The Module. It is really cool stuff, you can acheive so much with so little work

Mark


^C^C-vbaload;pvd;^C^C(load "pvd.lsp")

Mark

  • Custom Title
  • Seagull
  • Posts: 28683
Re: Menu for lisp commands
« Reply #6 on: November 05, 2004, 04:54:22 PM »
Quote from: Dommy2Hotty
I've always been fond of this type:
Code: [Select]
ID_TRUNKING_SECTION_0 [Trunking Section]^C^C^C(if (not c:2dap)(load "2dap"));2dap;

That would be the correct method, thanks for pointing that out Dommy.
TheSwamp.org  (serving the CAD community since 2003)

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Re: Menu for lisp commands
« Reply #7 on: November 05, 2004, 05:18:36 PM »
Quote from: Mark Thomas
Quote from: Dommy2Hotty
I've always been fond of this type:
Code: [Select]
ID_TRUNKING_SECTION_0 [Trunking Section]^C^C^C(if (not c:2dap)(load "2dap"));2dap;

That would be the correct method, thanks for pointing that out Dommy.


 :D

daron

  • Guest
Menu for lisp commands
« Reply #8 on: November 08, 2004, 04:14:38 PM »
I can't see where this thread belongs in vba. It barely belongs in autolisp. Being that it is a macro question, I'm moving it to cad general.


*We now switch you back to your regular programming.

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Menu for lisp commands
« Reply #9 on: November 08, 2004, 04:21:18 PM »
Quote from: Daron
I can't see where this thread belongs in vba. It barely belongs in autolisp. Being that it is a macro question, I'm moving it to cad general.


*We now switch you back to your regular programming.


I don't even look at what section posts are under...just see what's new from the last time I was here and see if I can help out...but, correct filing should be maintained...

PDJ

  • Guest
Menu for lisp commands
« Reply #10 on: November 08, 2004, 06:33:17 PM »
For those of you that load lisp routines all the time from the command line or you're tired of the Tools, Appload or whatever it is, here's a simple ditty I wrote about 13 years ago and I've used it ever since:

Code: [Select]
(DEFUN C:LD(/ L2L)
(SETQ L2L(GETSTRING"\nProgram to Load: "))
(LOAD L2L)
)


I guess you could add the start command for the routine as another variable but, I've never bothered with it because some of these routines have multiple commands in them.

BREZI

  • Guest
Menu for lisp commands
« Reply #11 on: November 18, 2004, 09:19:44 AM »
THANKS FOR ALL THE HELP CHAPS!

:O)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10369
Menu for lisp commands
« Reply #12 on: November 18, 2004, 10:05:57 AM »
I don't see why you would not use autoload?
Quote
Predefines command names to load an associated AutoLISP file
(autoload filename cmdlist)

The first time a user enters a command specified in cmdlist, AutoCAD loads the application specified in filename, then continues the command.

Arguments

filename

A string specifying the .lsp file to be loaded when one of the commands defined by the cmdlist argument is entered at the Command prompt. If you omit the path from filename, AutoCAD looks for the file in the Support File Search Path.

cmdlist

A list of strings.

Return Values

nil

If you associate a command with filename and that command is not defined in the specified file, AutoCAD alerts you with an error message when you enter the command.

Examples

The following causes AutoCAD to load the bonusapp.lsp file the first time the APP1, APP2, or APP3 commands are entered at the Command prompt:

(autoload "BONUSAPP" '("APP1" "APP2" "APP3"))
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.

PDJ

  • Guest
Menu for lisp commands
« Reply #13 on: November 18, 2004, 12:40:46 PM »
To use the autoload feature, you have to KNOW what the lisp routines do CAB.. How many times have you gone looking for a seldom used command only to go thru 10 or 13 different programs looking for the right one?  With these library programs, it not only has the name of the lisp routine, but, also a short description of what it actually does..

I wrote this routine years ago when a friend/co-worker wanted to know what my shortcut commands were that I use all the time.  Feel free to slice and dice as you like.  This is a very old version and I probably have twice as many routines I use now.

Code: [Select]
 (DEFUN C:LAZY () ; give a paged list of the macros in this file
      (TEXTSCR)
      (Prompt "\n                                                            ")
      (Prompt "\n                 LIST OF KEYBOARD MACROS IN ACAD.LSP        ")
      (Prompt "\n                                                            ")
      (Prompt "\n A.............AREA               AE............ATTEDIT         ")
      (Prompt "\n ANSI31........ANSI31 HATCH       ARC...........ARC         ")
      (Prompt "\n ARCC..........ARC CEN TO CEN     ARY...........ARRAY           ")
      (Prompt "\n BL............BLOCK              BR............BREAK           ")
      (Prompt "\n BRAT..........BREAK AT           BR1P..........BREAK & ERASE   ")
      (Prompt "\n BR2P..........BREAK & ERASE 2    BRK...........BREAK INTS. ")
      (Prompt "\n C.............COPY               CH............CHANGE          ")
      (Prompt "\n CHST..........CHANGE STYLE       CC............COPY CROSSING   ")
      (Prompt "\n CI............CIRCLE             CL............COPY LAST       ")
      (Prompt "\n CON...........CONCRETE HATCH     CP............COPY PREVIOUS   ")
      (Prompt "\n CTC...........CHANGE TO CUR LAY  CW............COPY WINDOW     ")
      (Prompt "\n DB............DBLIST             DI............DISTANCE        ")
      (Prompt "\n DET...........INSERT DET BLOCK   DO............DONUT           ")
      (Prompt "\n DT............DTEXT              EARTH.........EARTH HATCH     ")
      (Prompt "\n EARTH45.......EARTH HATCH AT 45  EC............ERASE CROSSING  ")
      (Prompt "\n EL............ERASE LAST         ELL...........ELLIPSE         ")
      (Prompt "\n EP............ERASE PREVIOUS     ER............ERASE           ")
      (Prompt "\n EX............EXPLODE            EXT...........EXTEND          ")
      (Prompt "\n FL............FILLET             GYP...........GYPSUM HATCH ")
      (Prompt "\n HA............HATCH              I.............INSERT          ")
      (Prompt "\n IL............ISOPLANE LEFT      IR............ISOPLANE RIGHT  ")
      (Prompt "\n IX............ISOPLANE TOP       LA............LAYER           ")

(setq temp (getstring "\nPress Enter to Continue:                            "))
      (Prompt "\n LI............LIST               LIC...........LINE CENTER     ")
      (Prompt "\n LIM...........LINE MID           LIN...........LINE NEAR       ")
      (Prompt "\n LIQ...........LINE QUAD          LIQQ..........LINE QUA TO QUA ")
      (Prompt "\n LLQQ..........LEADER QUA TO QUA  LL............LEADER LINE     ")
      (Prompt "\n LLE...........LDR LINE END       LLI...........LDR LINE INT    ")
      (Prompt "\n LLN...........LDR LINE NEAR      LNT...........LINE INT        ")
      (Prompt "\n LOOP..........DIMBLK TO LOOP     MC............MOVE CROSSING   ")
      (Prompt "\n MI............MIRROR             ML............MOVE LAST       ")
      (Prompt "\n M.............MOVE               MP............MOVE PREVIOUS   ")
      (Prompt "\n MW............MOVE WINDOW        OFS...........OFFSET          ")
      (Prompt "\n OS............OSNAP              P.............PAN             ")
      (Prompt "\n PG............POLYGON            PL............POLYLINE        ")
      (Prompt "\n PLYV..........PLYWOOD HATCH      PNT...........POINT           ")
      (Prompt "\n QS............QUICK SAVE         QT............QTEXT           ")
      (Prompt "\n QU............QUIT               RE............REDRAW          ")
      (Prompt "\n RECT..........RECTANGLE          RO............ROTATE          ")
      (Prompt "\n SA............SAVE               SC............SCALE           ")
      (Prompt "\n ST............STRETCH            STA...........STATUS          ")
      (Prompt "\n TE............TEXT               TR............TRIM            ")
      (Prompt "\n U.............UNDO               UN............UNITS           ")
      (Prompt "\n WB............WBLOCK             ZA............ZOOM ALL        ")
      (Prompt "\n ZD............ZOOM DYNAMIC       ZE............ZOOM EXTENTS    ")
      (Prompt "\n ZP............ZOOM PREVIOUS      ZQ............ZOOM PREVIOUS   ")
      (Prompt "\n ZW............ZOOM WINDOW                                      ")

      (setq temp (getstring "\nPress Enter to Return:                        "))
      (graphscr)
   )                                
   (DEFUN C:LISP () ; LOAD THE SPECIFIED LISP PROGRAM - I love this one!
      (SETQ LISPNAME (GETSTRING "Enter LISP Routine name: "))
      (LOAD LISPNAME)
)
(princ "\nLazy.LSP -- Loaded.  Type lazy to execute.  ")
(princ)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10369
Menu for lisp commands
« Reply #14 on: November 18, 2004, 01:14:03 PM »
Paul,
I'm not sugesting giving up the buttons, just loading the routines through 'autoload'
This is the start of my 'AlansAutoLoad.lsp'
Code: [Select]
;;; ===============================================
;;;    Lisp Routine Loader
;;;    AUTOLOAD only loads the routine when needed
;;; ===============================================
(AUTOLOAD "AreaPrt" '("AreaPrt")) ; Print the Area of "POLYLINE"  "LWPOLYLINE" "CIRCLE" "ELLIPSE"
(AUTOLOAD "arrow line" '("arw")) ; draw a arrow line on stairs, plan view
(AUTOLOAD "Block UnmirrorCAB" '("bum")) ; Unmirror blocks picked
(AUTOLOAD "BrAt" '("brat")) ; Break Line @


The 'AlansAutoLoad.lsp' is added to my startup Suite.

Now any time I issue a call to the routine weather it be from a button, command line or another lisp
the routine is loaded and I don't need to know the name of the lisp, only the command name.

Button ^C^Carw or Command: arw will load the 'Arrow Line.lsp'

Your short cut helper is a good idea for my short memory.

If you use a button like this ^C^C^C(if (not c:2dap)(load "2dap"));2dap;
you can not issue 2dap from the command line without first loading it.


PS
If you have a lisp file with several routines in it using autoload will work.

(autoload "SteelLines" '("S1" "S2" "S3"))

So entering any one of them will load the lisp file.
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.