TheSwamp
CAD Forums => CAD General => Topic started by: andyanderson on June 17, 2004, 05:28:38 AM
-
Hello all:
Just thought I'd throw this out for y'all (a Southern term) :)
I've been using various versions of this lisp routine for quite awhile. What it does is is pop up your own chart/table with a click of a custom button and then it goes away when you do anything else. It just overlays your drawing for reference purposes. I've got several versions for pipe sizes, fractions, tap and drill sizes, sheet metal gages, etc. Beats the heck out of grabbing a book or looking at that chart on the wall.
It's easy to modify for your own purposes. Just rename it to XXX.LSP and then use the 'find and replace' with wordpad using 'replace "PIPE"' with "XXX". Open the routine and it explains it better. If you want my charts, just ask and I'll be glad to send them to you. Works with all Windows versions of AutoCAD :)
Here is my pipe routine:
;; PIPE.LSP Pipe properties chart (c)2001, George Velon
;; Modified by Andy Anderson from the original VSF.lsp
;; PIPE.LSP - Routine to view a slide of a ANSI PIPE chart. ;;
;; This will overlay your drawing and disappear when you click anywhere again or hit any key. ;; ;;
;; When loading use ^C^C(load"XXX") instead of ^C^C_(load"XXX") ;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; VARIABLES listed in the order that they appear: ;;
;; ;;
;; org_err : Store the current *error* handler ;;
;; org_cmdecho : Store the current cmdecho setting ;;
;; CMDECHO : System variable, Autolisp echoing on/off ;;
;; val : Store input data code ;;
;; code : Store input data code ;;
;; code_12 : Store input data code ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; SUB-ROUTINES listed in the order that they appear: ;;
;; ;;
;; PIPE_err : Abort routine ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; EXTERNAL FILES necessary: ;;
;; ;;
;; PIPE.sld : Slide file of a Pipe properties chart. ;;
;; This file must be in AutoCAD's path. ;;
;; PIPE.dwg : Although not necessary to the function of the program, ;;
;; this file is provided for customization purposes of the ;;
;; slide file. Simply edit the PIPE.dwg file for ;;
;; something such as color preference, and then ;;
;; re-create the PIPE.sld file. ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;===========================================================
;; Error Handling
;;===========================================================
(defun
PIPE_ERR (S)
(prompt "\nAn error occurred during the PIPE function.")
;; Print to screen
(if ;; Open if
(/= S "Function canceled")
;; If an error, (such as ESC) occurs
(princ (strcat "\n*** ERROR : " S " "))
;; Strcat and print to screen
) ;_ end of if
;; Close if
(redraw)
;; Clear the screen
(setq ORG_CMDECHO NIL
;; Restore var's to org state
VAL
NIL
CODE_12
NIL
CODE NIL
) ;_ end of setq
(setvar "CMDECHO" ORG_CMDECHO)
;; Restore the org CMDECHO setting
(setq *ERROR* ORG_ERR)
;; Restore org *error* handler
(princ)
;; Exit quietly
) ;_ end of defun
;; Close defun
;;===========================================================
;; Main Program
;;===========================================================
(defun
C:PIPE (/ ORG_CMDECHO VAL CODE_12 CODE)
;; Define function, declare local vars
(setq ORG_ERR *ERROR*
;; Store org "error" handler
*ERROR* PIPE_ERR
) ;_ end of setq
;; Set new "error" handler
(setq ORG_CMDECHO (getvar "CMDECHO"))
;; Store org CMDECHO
(setvar "CMDECHO" 0)
;; Supress echoing AutoLISP to screen
(graphscr)
;; Flip to graphics screen
(command "_.vslide" "PIPE")
;; View the "Pipe properties chart" slide
(prompt "\nPress any key to continue: ")
;; Prompt user to exit
(setq VAL ;; Open setq
(grread)
;; Pauses program, accepts any keyboard, or pointing device input to continue
) ;_ end of setq
;; Close setq
(if ;; Open if
(= 12 (car VAL))
;; Did user click pointing device in graphics area
(setq CODE_12 (grread (setq CODE (grread))))
;; If so, clear code 12 data from buffer
) ;_ end of if
;; Close if
(redraw)
;; Clear the screen
(setvar "CMDECHO" ORG_CMDECHO)
;; Restore org CMDECHO setting
(setq *ERROR* ORG_ERR)
;; Restore org *error* handler
(princ)
;; Exit quietly
) ;_ end of defun
;; Close main defun
(princ "\nPIPE.LSP for AutoCAD is loaded.")
;; Print introduction to screen
(princ "\nTo view a slide of the Pipe properties chart type PIPE.")
;; Print introduction to screen
(princ)
;; Exit quietly :D :D
-
Thanks, very useful.
Here is another one t-bear turned me on to some time back.
;Tip1681a: VSF.LSP Fraction Chart (c)2001, George Velon
;; VSF.LSP - Routine to view a slide of a fraction chart. ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; VARIABLES listed in the order that they appear: ;;
;; ;;
;; org_err : Store the current *error* handler ;;
;; org_cmdecho : Store the current cmdecho setting ;;
;; CMDECHO : System variable, Autolisp echoing on/off ;;
;; val : Store input data code ;;
;; code : Store input data code ;;
;; code_12 : Store input data code ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; SUB-ROUTINES listed in the order that they appear: ;;
;; ;;
;; vsf_err : Abort routine ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; EXTERNAL FILES necessary: ;;
;; ;;
;; vsf.sld : Slide file of a fraction chart. This file must be in ;;
;; AutoCAD's path. ;;
;; vsf.dwg : Although not necessary to the function of the program, ;;
;; this file is provided for customization purposes of the ;;
;; slide file. Simply edit the vsf.dwg file for something ;;
;; such as color preference, and then re-create the ;;
;; vsf.sld file. ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;===========================================================
;; Error Handling
;;===========================================================
(defun SLD_ERR (S)
(prompt "\nAn error occurred during the VSF function.")
(if ;; Open if
(/= S "Function canceled") ;; If an error, (such as ESC) occurs
(princ (strcat "\n*** ERROR : " S " ")) ;; Strcat and print to screen
) ;_ endif
(redraw) ;; Clear the screen
(setq ORG_CMDECHO NIL ;; Restore var's to org state
VAL NIL
CODE_12 NIL
CODE NIL
) ;_ end of setq
(setvar "CMDECHO" ORG_CMDECHO) ;; Restore the org CMDECHO setting
(setq *ERROR* ORG_ERR) ;; Restore org *error* handler
(princ) ;; Exit quietly
) ;_ end of defun
;;===========================================================
;; Main Program Routine
;;===========================================================
;; Define function, declare local vars
(defun SlideDisplay (SldName / ORG_CMDECHO VAL CODE_12 CODE)
(setq ORG_ERR *ERROR* ;; Store org "error" handler
*ERROR* Sld_ERR
) ;_ end of setq ;; Set new "error" handler
(if (findfile (strcat Sldname ".SLD")) ;ok to run
(progn
(setq ORG_CMDECHO (getvar "CMDECHO")) ;; Store org CMDECHO
(setvar "CMDECHO" 0) ;; Supress echoing AutoLISP to screen
(graphscr) ;; Flip to graphics screen
(command "_.vslide" SldName) ;; View the "fraction chart" slide
(prompt "\nPress any key to continue: ") ;; Prompt user to exit
(setq VAL ;; Open setq
(grread);; Pauses, for keyboard, or pointing device input to continue
) ;_ end of setq
(if ;; Open if
(= 12 (car VAL)) ; Did user click pointing device in graphics area
(setq CODE_12 (grread (setq CODE (grread)))) ;; If so, clear code 12 data from buffer
) ;_ end of if
(redraw) ;; Clear the screen
(setvar "CMDECHO" ORG_CMDECHO) ;; Restore org CMDECHO setting
) ; end progn
; ELSE ========================
(Alert (strcat Sldname " slide not found. \n Can not continue."))
) ;endif filefind
(setq *ERROR* ORG_ERR) ;; Restore org *error* handler
(princ) ;; Exit quietly
) ;_ end of defun
;;; --------------------------------------------------------------------
;;; --------------------------------------------------------------------
;;; You may use the following code to add your slides to those available
;;; (defun c:RoutineName() (SlideDisplay "SlideName"))
;;; or add the call in the button like this
;;; ^C^C(SlideDisplay "WindowCallSize")
;;; or use both or button ^C^CRoutineName if the defun is created
;;; --------------------------------------------------------------------
;;; --------------------------------------------------------------------
(defun c:wcs() (SlideDisplay "WindowCallSize")); CAB
(defun c:vsf() ; Fraction/Decimal Chart
(SlideDisplay "vsf")
)
(princ "\nSlideDisplay.LSP for AutoCAD is loaded.")
(princ "\nTo view a slide one of the following commands:")
(princ "\nWCS=Window Call Sizes VSF=Fraction/Decimal Chart")
(princ);; Exit quietly
-
Yes, I gave it to t-bear. The one you posted is the fraction routine (VSF). All you have to do is replace VSF with XXX for your own use :)
Note that it is polite to give credit to the original author and this routine is of great value to me and others.
-
Andy,
Note that this routine is modified from the one t-bear posted.
I changed the name of the routine and added a passed parameter
so you can call it with the name of the slide you want to display.
So for example if you have 3 slides named "PipeSize.sld", Fractions.sld"
and "WindowCallSize.sld" you will create 3 routines like this:
(defun c:pipe()(SlideDisplay "PipeSize")) ; pipe size chart
(defun c:f2d()(SlideDisplay "Fractions")) ; fractions 2 decimals
(defun c:wcs()(SlideDisplay "WindowCallSize")) ; Florida window sizes
So add as many as you need without having to duplicate the entire routine.
You can even call it from the command line with the slide name like this:
Command: (SlideDisplay "Slide Name")
-
Andy.....
I thought that I sent a "disclaimer" with the routine....if I did not, I appologize. I try ALWAYS to give credit to the authors of routines I pass around. Sometimes my "Old-timers" kicks in and I forget.
-
t-bear- you wrote that!! remember ?
-
No! Did I? Wellll....... waddya know!
Pat says my memory is now officially the shortest thing I got......
-
must... bite... tongue... :D
-
T-bear your setting yourself up for disaster with that one!!!
But im to nice.... cant do it :lol:
Give a man a match and he'll be warm for a few minutes. Set a man on fire and he'll be warm for the rest of his life.
now thats funny
-
T-bear your setting yourself up for disaster with that one!!!
:lol:
Yep...he sure is!
-
Usually I can edit my post before anybody looks at it but I think M-dub was just to quick on that one! I just added Nivuahc signature, which started my day off with a laugh!
-
I love playing the straight man to you clowns....
Fire away, gentlemen, you CAN'T be any worse than my dear wife.
-
This VSF routine sounds quite interesting.
Is it possible to have the VSF routine show slide #1, then with the click of the mouse, or key board key, show slide # 2, # 3 etc. and end with the last slide or esc key?
-
This VSF routine sounds quite interesting.
Is it possible to have the VSF routine show slide #1, then with the click of the mouse, or key board key, show slide # 2, # 3 etc. and end with the last slide or esc key?
if you use my version of the routine, this will work.
(defun c:3slides()
(SlideDisplay "Slide1")
(SlideDisplay "Slide2")
(SlideDisplay "Slide3")
(princ)
)
-
CAB:
I tried your routine and could not get it to work. I got "no function definition: SLIDEDISPLAY" at the command line.
I have my Q:\Support path added to "support file search path"
I have the 3slides routine loaded in my Q:\support.
I have changed "slide1, 2 & 3 to my slide names, without .sld.
I added it to my Startup Suite.
I have A2K4, Windows XP Pro
Is there something that I am missing?
THANKS FOR THE HELP!!
-
CAB:
I tried your routine and could not get it to work. I got "no function definition: SLIDEDISPLAY" at the command line.
Did you load the main routine I posted? The one I modified. This one:
http://theswamp.org/phpBB2/viewtopic.php?p=19342#19342
Make sure it is in the path and try this and see what you get.
(defun c:3slides()
(if (not SlideDisplay) (load "SlideDisplay.lsp"))
(SlideDisplay "Slide1")
(SlideDisplay "Slide2")
(SlideDisplay "Slide3")
(princ)
)
-
CAB:
I did not know that I needed to load the SlideDisplay.lsp routine. I have now loaded it and it works.
THANK YOU MUCH.
I appreciate your time.