;============================================================================== ; LYR-SHOW.LSP v1.2 [07/08/90] (C) Brother Sanders Design, All Rights Reserved ; Simplified Layer-Identity Manipulation Enhancement: AKA [S.L.I.M.E.] ;============================================================================== ; ; WHO DOODLED DIDDLY ; ~~~ ~~~~~~~ ~~~~~~ ; Randy Sanders (602) Voice: (602) 946-0735 ; 4908 N 85th Str Modem: (602) 946-5239 ; Scottsdale, AZ 85251 PC-AUG BBS: (602) 952-0638 (Leave MSSG) ; COMPUSERV ID# 76326,3460 ; ;UPPER-CASE TEXT IS ORIGINAL LISP CODE BY AUTHOR: ;lower-case text is lisp routines that has been adopted from ;refer to pages where it is indicated. Thank You: J. Smith & R. Gessner: ;(REPEAT 1000000 (STRCAT "THANKS A " (ITOA 1,000,000) "To Inside AutoLisp: ")) ; ; Who can use ETC-LYRS.LSP? Anyone with lots of LAYERS in DWGS. The goal of ; ETC-LYRS.LSP is to reduce the number of Headaches faced when using LAYERS ; in AutoCad. I've personally achieved compression ratios of 80% or greater ; for the time spent Sorting & Restoring Layers for Plotting Purposes. This ; means that a 800K FILE.DWG with 60+ LAYERS can more easily be manipulated ; to Restore etc./various Layer-Identities from within a huge Master-File. ; ; LYR-SHOW.LSP tries to adhere to STANDARD v1.1 06/01/90. The Latest version ; of Alacrity STANDARD AutoLISP Programming Guidelines can be downloaded as ; STANDARD.ZIP from Alacrity BBS (206) 643-5477 8N1 1200/2400bps 24hrs. ; ; NOTICE ; ~~~~~~ ; LYR-SHOW.LSP is copyrighted material created by Brother Sanders Design. ; You are given permission to redistribute ETC-LYRS.LSP in any manner you wish ; providing that: 1) LYR-SHOW.LSP is not modified in any way; 2) no fee is ; charged for distribution of LYR-SHOW.LSP; 3) LYR-SHOW.LSP is only used for ; non-Commercial purposes; 4) LYR-SHOW.LSP & its associated files are remain ; bundled together. 5) MOST IMPORTANT!! THAT THE ROUTINES FROM INSIDE AUTOLISP ; ARE (STILL) CLEARLY DEFINED AND SO NOTED AS BELONGING TO NEW RIDERS PUBLISH- ; ING AND PLEASE LEAVE THE PAGE NUMBERS IN WHERE THEY ARE QUOTED SO OTHERS MAY ; REFERENCE THE BOOK IN THE FUTURE! ; ; < PLEASE NOTE: MATERIAL THAT IS QUOTED FROM OTHER SOURCES IS FROM: > ; ; INSIDE AUTOLISP - RELEASE 10. BY J. SMITH & R. GESSNER ; NEW RIDERS PUBLISHING P.O. BOX 4846 THOUSAND OAKS, CA 91360 ; : : ; ; For condition of use and permission to use LYR-SHOW.LSP for Publication ; please contact Randy Sanders at Brother Sanders Design. See Above. ; ; If You make Modifications to LYR-SHOW that would be of benefit to Others ; please forward them to Brother Sanders Design for inclusion in the next ; release of LYR-SHOW.LSP & I thank You for your Support! ; ; USE AT YOUR OWN RISK - I AM STILL SOMEWHAT OF A NOVICE AT AUTOLISP. NO ; WARRANTY IS AVAILABLE EXPRESSED OR IMPLIED. Read My Lips! "MAKING POVERTY ; LINE WAGES WOULD PUT ME IN A HIGHER TAX BRACKET." Catch My Snow Drift? ; ;============================================================================== ; ; REQUIREMENTS ; ~~~~~~~~~~~ ; THIS ROUTINE ASSUMES/REQUIRES THE EXISTENCE OF ; ; EXAMPLE USAGE ; ~~~~~~~ ~~~~~ ; First load LYR-SHOW.LSP, include the full drive and pathname if necessary. ; ; Command: (LOAD "LYR-SHOW") ; Command: LYR-SHOW ; To Manipulate Layer Identity - USE: [Chop/Edit/List/Type] - Show/: ; ; OPTION: Make ; INITGET> "ALL ASB BKG CVL DEM ELE EQP FLR INT MOD NEW RCP" ; PROMPT > "Enter Three Letter Extension to open LAYER-IDENTITY File with: " ; REPLY > one of the Variable Extensions to OPEN FILE with: ; DEFAULT> is : ; ; OPTION: Show ; INITGET> "ALL ASB BKG CVL DEM ELE EQP FLR INT MOD NEW RCP" ; PROMPT > "Available Extensions To RESTORE are: " ; REPLY > "Enter Three Letter Extension to Retrieve Layer Identity with: " ; DEFAULT> is : ; ; OPTION: Chop ; ACTION > Automatically Removes Previous backup Files from D:\DWG-INFO ; ; OPTION: Edit ; INITGET> "ALL ASB BKG CVL DEM ELE EQP FLR INT MOD NEW RCP" ; PROMPT > "Enter FILE Extension To EDIT File: " ; REPLY > one of the Variable Extensions to EDIT Layer-Identity File: ; DEFAULT> is : ; ; OPTION: List ; ACTION > Automatically Dumps a "DIR" of D:\DWG-INFO to the Screen ; ; OPTION: Type ; INITGET> "ALL ASB BKG CVL DEM ELE EQP FLR INT MOD NEW RCP" ; PROMPT > "Available Extensions To TYPE are: ; PROMPT > "Enter FILE Extension To TYPE File To Screen: " ; ENTER > one of the Variable Extensions to TYPE Layer-Identity File: ; DEFAULT> is : ; ;------------------------------------------------------------------------------ (princ "\nLYR-SHOW.LSP v1.2 [07/08/90] (C) 1990 Brother Sanders Design") ;------------------------------------------------------------------------------ ; ; FUNCTIONS ; ~~~~~~~~~ ; C:LYR-SHOW - Executive Function ; 1#> ; MAKELIST - Makes List of Visible Layers ; 2#> ; S-STRING - "Sets String" Strcats Layers with "," makes a String ; 3#> ; OPENFILE - Sets up Predefined Extensions to Open Files with ; 4#> ; XX-FILES - Does "DIR" of "DWGNAME" returns EXTENSIONS ; 5#> ; G-STRING - "Gets String" Opens appropriate File to "Read-line" ; 6#> ; & Returns "STRING" to "LAYER" Command ; ;--------------- The Following are the [Edit Commands] ------------------------ ; ; CHOPINFO - Deletes "*.bak" "*.@*" "*.~*" in "D:\DWG-INFO\" ; 7#> ; EDITFILE - Uses "User Defined TEXT Editor" to Edit LYR-FILE : 8#> ; DWG-LIST - Returns a "DIR" List to Screen ; 9#> ; TYPEFILE - "TYPEs" Contents of File To Screen ; 10#> ; ;--------------- The Following are from "INSIDE AUTOLISP" --------------------- ; ; USEKWORD - Initget filtering. Sets up Default for Extensions. ; 11#> ; CHOPNAME - Removes \PATHNAME\ from "DWGNAME" ; 12#> ; ;============================================================================== ; ;============================================================================== ; ; FUNCTION ; ~~~~~~~~ ; - EXECUTIVE FUNCTION: calls Others ; ; #GLOBALS ; ~~~~~~~ ; #LX - List of Visible Layers ; 1> ; #LS - List of Visible Layers in "String with Commas" ; 2> ; #FN - DWGNAME without the \PATHNAME\ ; 3> ; ; LOCAL SYMBOLS ; ~~~~~~~~~~~~~ ; RG - set REGENMODE to "0" ; 4> ; OCE - set CMDECHO to "0" ; 5> ; LLIST - Pick the Options to Use: ; 6> ; ; COMMENTS ; ~~~~~~~~ ; Subject to Change without Prior Notice. ; ;------------------------------------------------------------------------------ (DEFUN C:LYR-SHOW (/ RG OCE LLIST) ; 1#> (SETQ RG (GETVAR "REGENMODE")) ; 4> (SETVAR "REGENMODE" 0) (SETQ OCE (GETVAR "CMDECHO")) ; 5> (SETVAR "CMDECHO" 0) (INITGET "Chop Edit List Type Show Make") (SETQ LLIST (GETKWORD ; 6> "\nTo Manipulate Layer Identity - USE: [Chop/Edit/List/Type] - Show/: ")) (COND ((EQ LLIST "Chop") (CHOPINFO)) ; 7#> ((EQ LLIST "Edit") (EDITFILE)) ; 8#> ((EQ LLIST "List") (DWG-LIST)) ; 9#> ((EQ LLIST "Type") (TYPEFILE)) ; 10#> ((EQ LLIST "Show") (G-STRING)) ; 6#> (T (MAKELIST) ; 2#> (S-STRING) ; 3#> (OPENFILE) ; 4#> ) ) (SETVAR "REGENMODE" RG) (SETVAR "CMDECHO" OCE) (SETQ #LX nil #LS nil #FN nil) ; 1,2,3> (PRINC) ) ;------------------------------------------------------------------------------ ; ; FUNCTION ; ~~~~~~~~ ; - Makes List of VISIBLE Layers ; 2#> ; ; GLOBALS ; ~~~~~~~ ; #LX - List of VISIBLE Layers ; 1> ; ; LOCAL SYMBOLS ; ~~~~~~~~~~~~~ ; L - "Layer" ; 2> ; L1 - "Layer Name" ; 3> ; L2 - "Layer VISIBILITY Code" ; 4> ; ; RETURNED VALUE ; ~~~~~~~~~~~~~~ ; #LX - Returns List of Visible Layers ; 1> ; ; COMMENTS ; ~~~~~~~~ ; (CDR (ASSOC 2 L)) Layer Name ; 5> ; (CDR (ASSOC 70 L)) Layer Visibility FLAG ; 6> ; (IF (= L2 64).....) if Layer is VISIBLE append to #LX ; 7> ; ;------------------------------------------------------------------------------ (DEFUN MAKELIST (/ L L1 L2) ; 2#> (SETQ L (TBLNEXT "LAYER" T)) ; 2> (WHILE L (SETQ L1 (LIST (CDR (ASSOC 2 L))) ; 3,5> L2 (CDR (ASSOC 70 L)) ; 4,6> ) (IF (= L2 64) (SETQ #LX (APPEND #LX L1))) ; 1,7> (SETQ L (TBLNEXT "LAYER")) ) (LIST #LX) ; 1> ) ;------------------------------------------------------------------------------ ; ; FUNCTION ; ~~~~~~~~ ; - Strings Layer Names into String with "," (Commas) ; 3#> ; ; GLOBALS ; ~~~~~~~ ; #LX - List of VISIBLE Layers ; 1> ; #LS - String with Layer Names with "," (Commas) ; 2> ; ; LOCAL SYMBOLS ; ~~~~~~~~~~~~~ ; N - Number ; 3> ; T - Length of #LX ; 4> ; T1 - Length of #LX - 1 ; 5> ; ; DEPENDENCIES ; ~~~~~~~~~~~~ ; Needs VALUE of #LX ; 1> ; ; RETURNED VALUE ; ~~~~~~~~~~~~~~ ; #LS - String with Layer Names with "," (Commas) ; 2> ; ; COMMENTS ; ~~~~~~~~ ; There may be a Better Way to do This. but This works so far ; ; String First Member of List with "," ; 6> ; String Additional Members of List with "," ; 7> ; String Last Member of List to List to avoid the Final "," ; 8> ; Returned Value of #LS ; 9> ; ;------------------------------------------------------------------------------ (DEFUN S-STRING (/ N T T1) ; 3#> (SETQ N 0 ; 3> T (LENGTH #LX) ; 4> T1 (- T 1) ; 5> #LS (STRCAT (NTH N #LX) ",") ; 2,6> N (1+ N) ) (WHILE (< N T1) (SETQ #LS (STRCAT #LS (NTH N #LX) ",") ; 2,7> N (1+ N) ) ) (SETQ #LS (STRCAT #LS (LAST #LX))) ; 8> (LIST #LS) ; 9> ) ;------------------------------------------------------------------------------ ; ; FUNCTION ; ~~~~~~~~ ; - Opens File "w" ; 4#> ; ; LOCAL SYMBOLS ; ~~~~~~~~~~~~~ ; EXT - Extension: Default is ; 1> ; TF - Temporary File (File Descriptor) ; 2> ; ; DEPENDENCIES ; ~~~~~~~~~~~~ ; #LS - Writes Value of #LS to File ; 3> ; USEKWORD - Initget filtering Default for Extensions. ; 4> ; CHOPNAME - Removes \PATHNAME\ from "DWGNAME" ; 5> ; ; RETURNED VALUE ; ~~~~~~~~~~~~~~ ; Writes Layer-List to File & PROMPTS to Screen: ; 6> ; ; "FILE WRITTEN TO D:\DWG-INFO\DWGNAME.EXT" ; ; COMMENTS ; ~~~~~~~~ ; THIS ROUTINE REQUIRES : ; 7> ; ; SET-UP PREDEFINED EXTENSIONS TO STRCAT TO FILENAMES ; & OPEN FILENAMES IN : WRITES: ; ; 1: LAYER-LIST, ; 8> ; 2: DRAWING NAME, ; 9> ; 3: CURRENT DATE: ; 10> ; ; You can MODIFY the PROMPT that has the VARIABLE EXT's to ; 11> ; FIT Your own NEEDS. This PROMPT occurs 2X in OPENFILE & ; 1X in G-STRING ; ; Refer to "INSIDE ATOLISP" PP. 11-21 (TIMELIB.LSP) ; 12> ; ;------------------------------------------------------------------------------ (defun OPENFILE (/ EXT TF T Y D M) ; 4#> (PROMPT "ALL ASB BKG CVL DEM ELE EQP FLR INT MOD NEW RCP") ; 11> (SETQ EXT (STRCAT "." (usekword 1 ; 1,4> "ALL ASB BKG CVL DEM ELE EQP FLR INT MOD NEW RCP" ; 11> "Enter Three Letter Extension to open LAYER-IDENTITY File with: " "ALL"))) (SETQ TF (OPEN (STRCAT "D:\\DWG-INFO\\" ; 2,7> (CHOPNAME (GETVAR "DWGNAME")) EXT) "w")) ; 5> (WRITE-LINE (STRCAT "\t" #LS) TF) ; 3,8> (WRITE-LINE (STRCAT "\t" (GETVAR "DWGNAME") EXT) TF) ; 9> (setq T (rtos (getvar "cdate") 2 6) ; 12> Y (substr T 3 2) D (substr T 5 2) M (substr T 7 2) ) (WRITE-LINE (STRCAT "\tThe Date Is: " M "/" D "/" Y) TF) ; 10> (CLOSE TF) (SETQ T nil Y nil D nil M nil) (PROMPT (STRCAT "\nLayer-Identity ASCII File Written To (CHOPNAME (GETVAR "DWGNAME")) EXT ">" ; 5> ) ) ) ;------------------------------------------------------------------------------ ; ; FUNCTION ; ~~~~~~~~ ; - Reads File EXT's in That ; 5#> ; match "DWGNAME" & writes EXT's To a File named ; Where the List is then ; Filtered back into a LIST that is saved for The ; following G-STRING to use. ; ; GLOBALS ; ~~~~~~~ ; #FN - DWGNAME without \PATHNAME\ ; 1> ; ; LOCAL SYMBOLS ; ~~~~~~~~~~~~~ ; CMD1 - DIR of : & DOS PIPING ; 2> ; of OutPut to ; XF - File Descriptor to Open File to "r" ; 3> ; SX - List of Filtered EXT's ; 4> ; D - "Read-Line" of ; 5> ; D1 - EXT Substring of D ; 6> ; DF - LIST of EXT's Passed To G-STRING ; 7> ; ; DEPENDENCIES ; ~~~~~~~~~~~~ ; Files that Match the DWGNAME must EXIST in : ; ; RETURNED VALUE ; ~~~~~~~~~~~~~~ ; DF - STRING of EXT's for INITGET PROMPT ; 7> ; ; COMMENTS ; ~~~~~~~~ ; This is where some additional FILTERING of the RETURNED EXT's ; needs to be installed, to remove *.BAK's, *.@* etc. ; ; This is where The Value of The EXT's are taken out of the ; 8> ; "Read-Line(s)" ; ;------------------------------------------------------------------------------ (DEFUN XX-FILES (#FN / CMD1 XF SX D D1) ; 5#> (SETQ #FN (CHOPNAME (GETVAR "DWGNAME"))) ; 1> (SETQ CMD1 (STRCAT "DIR " "D:\\DWG-INFO\\" #FN ; 2> ".* | SORT > D:\\DWG-FILE\\DWG-FILE.EXT")) (COMMAND "SH" CMD1) ; 1> (SETQ XF (OPEN "D:\\DWG-FILE\\DWG-FILE.EXT" "r")) ; 3> (SETQ SX "") ; 4> (WHILE (SETQ D (READ-LINE XF)) ; 5> (IF (= (STRCASE #FN) (SUBSTR D 1 (STRLEN #FN))) (PROGN (STRCAT "\t" (SETQ D1 (STRCASE (SUBSTR D 10 3))) "\n") ; 6,8> (SETQ SX (STRCAT SX " " D1)) ; 4,6> ) ) ) (SETQ XF (CLOSE XF)) ; 3> (SETQ DF (SUBSTR SX 2)) ; 7> ) ;------------------------------------------------------------------------------ ; ; FUNCTION ; ~~~~~~~~ ; - "Get String" User Input of EXT to RESTORE ; 6#> ; Selected Layer-Identity ; ; LOCAL SYMBOLS ; ~~~~~~~~~~~~~ ; EXT - User Input Selects EXT to RESTORE LAYER-IDENTITY ; 1> ; DF - STRING of EXT's for INITGET PROMPT ; 2> ; TF - Temporary File (File Descriptor) ; 3> ; NL - New List! This is passed to The AutoCad Layer command ; 4> ; ; DEPENDENCIES ; ~~~~~~~~~~~~ ; DF - STRING of EXT's for INITGET PROMPT ; 2> ; #FN - DWGNAME without \PATHNAME\ ; 5> ; USEKWORD - Initget filtering Default for Extensions. ; 6> ; CHOPNAME - Removes \PATHNAME\ from "DWGNAME" ; 7> ; XX-FILES - Reads File EXT's in That ; 8> ; match "DWGNAME" & writes EXT's To a File named ; ; ; RETURNED VALUE ; ~~~~~~~~~~~~~~ ; NL - New List! This is passed to The AutoCad Layer command ; 4> ; ; COMMENTS ; ~~~~~~~~ ; This Opens the File that has the Layer-Identity Information ; 9> ; ; The Value of NL is passed to The Layer Command which allows You ; 10> ; to RESTORE any PREVIOUSLY SAVED Layer-Identity! ; ; PROMPTS to Screen: LAYER-IDENTITY < > RESTORED! ; 11> ; ;------------------------------------------------------------------------------ (DEFUN G-STRING (/ EXT DF TF NL) ; 6#> (SETQ EXT ".ALL") ; 1> (SETQ #FN (CHOPNAME (GETVAR "DWGNAME"))) ; 5,7> (SETQ EXT (XX-FILES #FN)) ; 1,5,8> (INITGET 1 "ALL ASB BKG CVL DEM ELE EQP FLR INT MOD NEW RCP") (PROMPT (STRCAT "Available Extensions To RESTORE are: " DF )) ; 2> (IF EXT (PROGN (SETQ EXT (STRCAT "." (usekword 1 ;1,6> "ALL ASB BKG CVL DEM ELE EQP FLR INT MOD NEW RCP" "Enter Three Letter Extension to Retrieve Layer Identity with: " "ALL"))))) (SETQ TF (OPEN (STRCAT "D:\\DWG-INFO\\" #FN EXT) "r")) ; 3,9> (SETQ NL (READ-LINE TF)) ; 4> (SETQ TF (CLOSE TF)) ; 3> (COMMAND "LAYER" "T" "0" "S" "0" "F" "*" "T" (EVAL NL) "") ; 10>! (PROMPT (STRCAT "\n\t\tLayer-Identity <" (SUBSTR EXT 2) "> Restored")); 11> (PRINC) ) ;------------------------------------------------------------------------------ ; ; FUNCTION ; ~~~~~~~~ ; ; 7#> ; ; GLOBALS ; ~~~~~~~ ; REVISIONS ; ~~~~~~~~~ ; SYNTAX/ARGUMENTS ; ~~~~~~~~~~~~~~~~ ; LOCAL SYMBOLS ; ~~~~~~~~~~~~~ ; DEPENDENCIES ; ~~~~~~~~~~~~ ; RETURNED VALUE ; ~~~~~~~~~~~~~~ ; COMMENTS ; ~~~~~~~ ; This Removes "Previous Files". This Routine is subject to Improvement ; ;------------------------------------------------------------------------------ (DEFUN CHOPINFO (/ CMD2 CMD3 CMD4) ; 7#> (SETQ CMD2 (STRCAT "DEL D:\\DWG-INFO\\*.BAK")) (COMMAND "SHELL" CMD2) (SETQ CMD3 (STRCAT "DEL D:\\DWG-INFO\\*.@*" )) (COMMAND "SHELL" CMD3) (SETQ CMD4 (STRCAT "DEL D:\\DWG-INFO\\*.~*" )) (COMMAND "SHELL" CMD4) ) ;------------------------------------------------------------------------------ ; ; FUNCTION ; ~~~~~~~~ ; ; 8#> ; ; LOCAL SYMBOLS ; ~~~~~~~~~~~~~ ; EXT - Extension ; ; DEPENDENCIES ; ~~~~~~~~~~~~ ; COMMENTS ; ~~~~~~~~ ; Substitute YOUR OWN TEXT EDITOR for "NE". must be in the PATH ; ;------------------------------------------------------------------------------ (DEFUN EDITFILE (/ EXT) ; 8#> (PROMPT (STRCAT "Available Extensions To EDIT are: " DF )) (SETQ EXT (STRCAT "." (usekword 1 "ALL ASB BKG CVL DEM ELE EQP FLR INT MOD NEW RCP" "Enter FILE Extension To EDIT File: " "ALL")) ) (COMMAND "NE" (STRCAT "D:\\DWG-INFO\\" (CHOPNAME (GETVAR "DWGNAME")) EXT)) (princ) ) ;------------------------------------------------------------------------------ ; ; FUNCTION ; ~~~~~~~~ ; ; 9#> ; ; RETURNED VALUE ; ~~~~~~~~~~~~~~ ; Prints "DIR" of "D:\DWG-INFO\DWGNAME.*" to Screen ; ; COMMENTS ; ~~~~~~~~ ; Uses DOS "SORT" Command ; ;------------------------------------------------------------------------------ (DEFUN DWG-LIST () ; 9#> (COMMAND ".DIR" (STRCAT "D:\\DWG-INFO\\" (CHOPNAME (GETVAR "DWGNAME")) "*.* | SORT")) ) ;------------------------------------------------------------------------------ ; ; FUNCTION ; ~~~~~~~~ ; ; 10#> ; ; GLOBALS ; ~~~~~~~ ; REVISIONS ; ~~~~~~~~~ ; SYNTAX/ARGUMENTS ; ~~~~~~~~~~~~~~~~ ; LOCAL SYMBOLS ; ~~~~~~~~~~~~~ ; DEPENDENCIES ; ~~~~~~~~~~~~ ; RETURNED VALUE ; ~~~~~~~~~~~~~~ ; COMMENTS ; ~~~~~~~~ ;------------------------------------------------------------------------------ (DEFUN TYPEFILE (/ ext) ; 10#> (SETQ EXT ".ALL") (SETQ #FN (CHOPNAME (GETVAR "DWGNAME"))) ; 5,7> (SETQ EXT (XX-FILES #FN)) ; 1,5,8> (INITGET 1 "ALL ASB BKG CVL DEM ELE EQP FLR INT MOD NEW RCP") (PROMPT (STRCAT "Available Extensions To TYPE are: " DF )) ; 2> (SETQ EXT (STRCAT "." (usekword 1 "ALL ASB BKG CVL DEM ELE EQP FLR INT MOD NEW RCP" "Enter FILE Extension To TYPE File To Screen: " "ALL")) ) (TERPRI) (COMMAND ".TYPE" (STRCAT "D:\\DWG-INFO\\" (CHOPNAME (GETVAR "DWGNAME")) EXT)) (PROMPT (STRCAT "\nLayer-Identity ASCII File Printed To Screen: ")) ) ;================ These Routines are from "INSIDE AUTOLISP" =================== ; FUNCTION ; ~~~~~~~~~ ; ; 11#> ; ; GLOBALS ; ~~~~~~~ ; BIT - 1 for no null, 0 for none ; KWD - Keyword ; MSG - Message "STRING" ; DEF - Default ; ; LOCAL SYMBOLS ; ~~~~~~~~~~~~~ ; INP - User Input ; ; RETURNED VALUE ; ~~~~~~~~~~~~~~ ; Filtered Input. must match User Defined Keyword(s) ; ; COMMENTS ; ~~~~~~~~ ; DEFAULT FOR EXTENSIONS: ; ALSO KNOWN AS: ; ; "test for both nil and null string ; 1> ; string'em with default ; 2> ; a default and no null bit code conflict so ; 3> ; this reduces bit by 1 if odd, to allow null ; 4> ; without default ; 5> ; Initailize the key words ; 6> ; and use the GET command ; 7> ; compare the results, return appropriate value ; 8> ; ;------------------------------------------------------------------------------ (defun USEKWORD (bit kwd msg def / inp) ; 11# (if ( and def (/= def "")) ; 1> (setq msg (strcat "\n" msg "<" def ">: ") ; 2> bit (* 2 (fix (/ bit 2))) ; 3> ) ; 4> (setq msg (strcat "\n" msg ": ")) ; 5> ) (initget bit kwd) ; 6. (setq inp (getkword msg)) ; 7> (if inp inp def) ; 8> ) ;------------------------------------------------------------------------------ ; ; FUNCTION ; ~~~~~~~~~ ; ; 12#> ; ; GLOBALS ; ~~~~~~~ ; FNAME ; 1> ; ; LOCAL SYMBOLS ; ~~~~~~~~~~~~~ ; LNGTH - Length of Name ; STR - String Value ; CHAR - Character ; ; RETURNED VALUE ; ~~~~~~~~~~~~~~ ; Returns FILENAME without \PATHNAME\ ; ; COMMENTS ; ~~~~~~~~ ; REMOVES \PATHNAME\ from DWGNAME ; ALSO KNOWN AS ; ; "Intialize. lngth is filename length ; 1> ; loops until AND is non-NIL ; 2> ; exit to avoid invalid substr ; 3> ; get next char in reverse ; 4> ; find "/" and exit ; 5> ; find "\" and exit ; 6> ; otherwise add last char to str" ; 7> ; ;------------------------------------------------------------------------------ (defun CHOPNAME ( fname / lngth str char) ; 12#> (setq lngth (1+ (strlen fname)) str "") ; 1> (while ; 2> (and (/= 1 lngth) ; 3> (setq lngth (1- lngth) char (substr fname lngth 1)) ; 4> (/= "/" char) ; 5> (/= "\\" char) ; 6> (setq str (strcat char str)) ; 7> ) ) str ) ;================ Above Routines are from "INSIDE AUTOLISP" =================== (PROMPT "\nLYR-SHOW is now LOADED...") (PRINC) ;EOF