TheSwamp
CAD Forums => CAD General => Topic started by: BREZI 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
-
Hi
Have a browse of the following thread (also take note any links within) -
loading lisp (http://theswamp.org/phpBB2/viewtopic.php?t=3011)
Have a good one, Mike
-
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
-
THANKS
-
I've always been fond of this type:
ID_TRUNKING_SECTION_0 [Trunking Section]^C^C^C(if (not c:2dap)(load "2dap"));2dap;
-
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")
-
I've always been fond of this type:
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.
-
I've always been fond of this type:
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
-
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 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...
-
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:
(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.
-
THANKS FOR ALL THE HELP CHAPS!
:O)
-
I don't see why you would not use autoload?
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"))
-
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.
(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)
-
Paul,
I'm not sugesting giving up the buttons, just loading the routines through 'autoload'
This is the start of my 'AlansAutoLoad.lsp'
;;; ===============================================
;;; 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.