Author Topic: Lisps in Menu files....  (Read 5412 times)

0 Members and 1 Guest are viewing this topic.

hudster

  • Gator
  • Posts: 2848
Lisps in Menu files....
« on: July 20, 2004, 10:27:23 AM »
I have a custom menu, called "CUSTOM MENU", creative or what?

I have refernced a few lisp files in it, but what I want to know is how can I get it to auto load the lisps, rather than me having to get it to load each one prior to using it.

Cheers for any help.
Revit BDS 2017, 2016, 2015, 2014, AutoCAD 2017, 2016, Navisworks 2017, 2016, BIM360 Glue

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Lisps in Menu files....
« Reply #1 on: July 20, 2004, 10:29:58 AM »
Do you have a "custom.mnl" file? How about the "startup suite". Or maybe even an "acad.lsp". You can load your .lsp files from any of those.
TheSwamp.org  (serving the CAD community since 2003)

hudster

  • Gator
  • Posts: 2848
Lisps in Menu files....
« Reply #2 on: July 20, 2004, 10:32:35 AM »
I have a custom mnl file, so do i just paste the lisp in that?
Revit BDS 2017, 2016, 2015, 2014, AutoCAD 2017, 2016, Navisworks 2017, 2016, BIM360 Glue

M-dub

  • Guest
Lisps in Menu files....
« Reply #3 on: July 20, 2004, 10:37:40 AM »
Mark posted the best idea, but for the routines you don't use very often and would rather they didn't load EVERY time, you might want to preceed your Macro command for that lisp with the load command...

^C^C(load"C:/temp/MR.lsp");MR;

I'm not sure if that's good practice, but it seems to work fine for me...

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Lisps in Menu files....
« Reply #4 on: July 20, 2004, 10:46:04 AM »
There are a bunch of ways to do this, here's just one of them. Add the following to your .mnl file.
Code: [Select]

(defun lisp-loader (/ file_lst)
                     ;; put your file names in here
  (setq file_lst (list "cut.lsp" "df.lsp" "ds.lsp" "notno.lsp"))

  (foreach lsp file_lst
(princ "\n")
(load lsp (strcat "Could not load -> " lsp))
)
  )
(lisp-loader)
TheSwamp.org  (serving the CAD community since 2003)

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Lisps in Menu files....
« Reply #5 on: July 20, 2004, 11:20:45 AM »
NICE LISP...
Civil3D 2020

diarmuid

  • Bull Frog
  • Posts: 417
Lisps in Menu files....
« Reply #6 on: July 20, 2004, 12:05:32 PM »
LOOK AT THE LISPS ON THAT!! :lol:
If you want to win something run the 100m, if you want to experience something run a marathon

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Lisps in Menu files....
« Reply #7 on: July 20, 2004, 12:29:26 PM »
I use another approach.
Create a file called ACADDOC.LSP if it doesn't exist & make sure it
is in the acad search path. It will be loaded with every drawing.

I added this to it.
Code: [Select]
(load "AlansAutoLoad.lsp")
(princ)

and then createded in the same directory AlansAutoLoad.lsp, which has this:
Code: [Select]
(AUTOLOAD "AreaPrt" '("AreaPrt")) ; Print the Area of "PLINEs" "CIRCLE" "ELLIPSE"
(AUTOLOAD "arrow line" '("arw")) ; draw a arrow line on stairs, plan view
(AUTOLOAD "BrAt" '("brat")) ; Break Line @
(AUTOLOAD "BrkDbl" '("DZ")) ; Double Break Symbol
(AUTOLOAD "BrkSym2" '("BRK")) ; Single Break Symbol
(AUTOLOAD "CopyRotate" '("CopyR")) ; Copy, Repeat paste w/rotate
(AUTOLOAD "DoorLbl" '("DoorLbl")) ; label an ArchT door
(AUTOLOAD "DoorLblLine" '("DoorLblLn")) ; label a line on the door leaf
(AUTOLOAD "DrawOffset" '("DrawO")) ; Draw a pline offset from pick points
(AUTOLOAD "DoubLeader" '("DoubLeader")) ; draw double Leader
(AUTOLOAD "ElevationLines" '("LnRay")) ; draw lines from pick points to referance line
(AUTOLOAD "Flat" '("Flat")) ; flatten all Z coordenats
(AUTOLOAD "GetDimOrTxt" '("TDS")) ; change dim or text & layer current from pick
(AUTOLOAD "HipTruss" '("HipTruss")) ; Draw Hip Trusses
(AUTOLOAD "Insul2" '("Insul")) ; Draw Wall Insulation plan view
(AUTOLOAD "LayoutLineScale" '("LayoutLineScale"))  ; Set PSLTSCALE to 0 in all layouts
(AUTOLOAD "Leader Fat" '("FatL")) ; Tapered Arc Leader Routine
(AUTOLOAD "LeaderArcCAB2" '("ArcL")) ; draw a arc leader with arrow head from dim
(AUTOLOAD "LintelLable" '("Lintel"))
(AUTOLOAD "MyCogo" '("Cogo")) ; Draw lines from survey data
(AUTOLOAD "OffsetObjects" '("oos")) ; array routine, compute offsets
(AUTOLOAD "osnapsToggle" '("ostoggle" "os:off" "os:on" "OsnapDisable" "OsnapEnable"))
(AUTOLOAD "PL2Cloud" '("PL2Cloud")) ; Draw Revision Cloud from Pline
(AUTOLOAD "PlotTabs3" '("PlotTabs")) ;
(AUTOLOAD "PrePlot" '("PrePlot")) ; setup variables neede to plot
(AUTOLOAD "RmSize" '("RmSize")) ; create a label from picking points on walls
(AUTOLOAD "Rotate180" '("R180"))
(AUTOLOAD "RoofTile" '("RfTile")) ; display roof edge on barrel tile
(AUTOLOAD "rrAng" '("rrAng")) ; Repeat Rotate w/ user angle
(AUTOLOAD "rft" '("rft"))  ;  roof tile hatch with offset pick point
(AUTOLOAD "Shelf" '("Shelf")) ; draw shelf w/ hanger line
(AUTOLOAD "Shutter" '("Shutter"))
(AUTOLOAD "ss" '("ss"))  ; Set Snaps
(AUTOLOAD "SysVarDlg" '("SysVars")) ; Search for system var names & sets them
(AUTOLOAD "TextInsertDCL" '("TIns")) ; Text Insert Routine
(AUTOLOAD "TrussOffset" '("TrussO")) ; Array Trusses Routine
(AUTOLOAD "Text 2 PS CAB" '("pstext")) ; Place text in all tabs in PS
(AUTOLOAD "Text 2 PS CAB" '("pstext-edit")) ; Edit text in all tabs in PS
(AUTOLOAD "TmmCAB" '("Tmm")); Repeat fience trim
(AUTOLOAD "TrussLabel" '("TL"))
(AUTOLOAD "TrussUCS" '("Truss")) ; Draw main Trusses
(AUTOLOAD "StepSym" '("StepSym")) ; Insert a step symbol
(AUTOLOAD "VPF CAB" '("vpf")); freeze layer in all viewports
(AUTOLOAD "vp lock-unlock" '("vpLockAll")); freeze layer in all viewports
(AUTOLOAD "vp lock-unlock" '("vpUnLockAll")); freeze layer in all viewports
(AUTOLOAD "WallHatchLintels" '("WL2")) ; Lintel Wall hatch (1&2) 2 point pick
(AUTOLOAD "WallHatchLintels" '("WL4")) ; Lintel Wall hatch (1&2) 4 point pick
(AUTOLOAD "WallHatch" '("WallH")) ; hatch from 4 pick points
(AUTOLOAD "WallHatch" '("WallH2")) ; hatch from 2 parallel lines
(AUTOLOAD "WallHatchBearing" '("WallHb")) ; harch 4 pick points with hatch origen
(AUTOLOAD "Window" '("Win"))
(AUTOLOAD "wSill" '("wSill")) ; draw a window sill, plan view

;(AUTOLOAD "OsnapsToggle" '("SetOsnaps")) ; toggle Osnaps 0=off 1=on (SetOsnaps 1)
(load "OffsetCAB.lsp")
(load "vl-SubRoutines.lsp")
(load "SlideDisplay")
(load "ACADSet_Variables") ; loads & runs

(defun C:DOB() (setq ss (ssget)) (command "DRAWORDER" ss "" "B") (princ) )
(defun C:DOF() (setq ss (ssget)) (command "DRAWORDER" ss "" "F") (princ) )
(defun C:DOA() (setq ss (ssget)) (command "DRAWORDER" ss "" "A") (princ) )
(defun C:DOU() (setq ss (ssget)) (command "DRAWORDER" ss "" "U") (princ) )
(princ)

AUTOLOAD only loads the routine when needed
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.

t-bear

  • Guest
Lisps in Menu files....
« Reply #8 on: July 20, 2004, 12:55:45 PM »
Dog-gone!  It'd take me three WEEKS to type all that.....(sloooooowww typist).  What the hey...I got nuttin else to do...........
Thanx guys.

PDJ

  • Guest
Lisps in Menu files....
« Reply #9 on: July 20, 2004, 01:02:29 PM »
and here's yet another way of gettin things loaded..

Add this little ditty to your acad.lsp file or whatever you have loading up in your startup suite:

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


Now, when you need to load a lisp routine that you don't use all the time, just type ld at the command prompt, then a return, then the name of the file..  It basically keeps you from having to type out that (load"XYZ") stuff alla time..  I was always missin the ""'s or the ()'s when I tried typing that to load a routine..

okie dokie, that's that about that..

t-bear

  • Guest
Lisps in Menu files....
« Reply #10 on: July 20, 2004, 01:05:33 PM »
KEWL!  OK guys, the donuts is on PDJ!!!

M-dub

  • Guest
Lisps in Menu files....
« Reply #11 on: July 21, 2004, 01:02:39 PM »
Quote from: CAB
AUTOLOAD only loads the routine when needed


Thanks a lot, CAB...
This sounds even better than the Startup Suite!  Are you saying that this won't actually load all of my routines, but I can type in the command that calls them and they'll work as if they were loaded, perhaps by loading the command only or something???

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Lisps in Menu files....
« Reply #12 on: July 21, 2004, 01:09:02 PM »
Autoload works by defining a small routine, typically a single line or two, with the same name of the command you want to run... when you type the command name in, it loads the lisp you specified, then runs itself again (this time the redefined command)
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

M-dub

  • Guest
Lisps in Menu files....
« Reply #13 on: July 21, 2004, 01:17:16 PM »
Right...That's kinda what I thought and was trying to put into words...

>perhaps by loading the command only or something???

Thanks Keith!
I used acaddoc.lsp and acaddoc2000.lsp for R14 and 2000, but when I discovered the Startup Suite, I started using that exclusively, not knowing better.  Some routines are good to have in the startup suite, but some are just too big and don't get used that often...
Right on, eh!  ;)
:lol: