Drawing Setup - Part 3
- See also:
- Drawing Setup - Part 1
- Drawing Setup - Part 2
AutoLISP Coding
Here is the complete AutoLISP Coding :
(defun C:SETUP () ;define function (setvar "BLIPMODE" 0) ;switch off variables (setvar "CMDECHO" 0) (setvar "OSMODE" 0) (setq typ "e") ;set default (setq dcl_id (load_dialog "setup.dcl")) ;load dialogue (if (not ;test if loaded (new_dialog "setup" dcl_id) ;new dialogue ) ;end not (exit) ;if not loaded, exit ) ;end if (set_tile "rb1" "1") ;switch on radio button (action_tile "rb1" ;if button selected "(setq typ \"e\") ;store sheet type (mode_tile \"eb1\" 2)") ;set focus to edit box (action_tile "rb2" ;if button selected "(setq typ \"a\") ;store sheet type (mode_tile \"eb1\" 2)") ;set focus to edit box (action_tile "rb3" ;if button selected "(setq typ \"c\") ;store sheet type (mode_tile \"eb1\" 2)") ;set focus to edit box (action_tile "rb4" ;if button selected "(setq typ \"el\") ;store sheet type (mode_tile \"eb1\" 2)") ;set focus to edit box (action_tile "rb5" ;if button selected "(setq typ \"b\") ;store sheet type (mode_tile \"eb1\" 2)") ;set focus to edit box (set_tile "rb6" "1") ;make default (setq SIZ "A0") ;Default sheet size (set_tile "eb1" "1") ;initial edit box value (mode_tile "eb1" 2) ;set focus to edit box (action_tile "rb6" ;if button selected "(setq siz \"A0\") ;store sheet size (mode_tile \"eb1\" 2)") ;set focus to edit box (action_tile "rb7" ;if button selected "(setq siz \"A1\") ;store sheet size (mode_tile \"eb1\" 2)") ;set focus to edit box (action_tile "rb8" ;if button selected "(setq siz \"A2\") ;store sheet size (mode_tile \"eb1\" 2)") ;set focus to edit box (action_tile "rb9" ;if button selected "(setq siz \"A3\") ;store sheet size (mode_tile \"eb1\" 2)") ;set focus to edit box (action_tile "rb10" ;if button selected "(setq siz \"A4\") ;store sheet size (mode_tile \"eb1\" 2)") ;set focus to edit box (action_tile "cancel" ;if Cancel selected "(done_dialog)(setq userclick nil)") ;close dialogue, clear flag (action_tile "accept" ;if OK selected (strcat ;string 'em together "(progn (setq #dwgsc ;store value (atof (get_tile \"eb1\")))" ;get edit box value "(done_dialog) (setq userclick T))" ;close dialogue, set flag ) ;end progn ) ;end action_tile (start_dialog) ;start dialogue (unload_dialog dcl_id) ;unload dialogue (if userclick ;if flag is true (progn ;do the following (if (eq siz "A0") ;If size is A0 (progn ;Do the following (setq x 1189.0 ;Set x limits y 841.0 ;Set y limits ) ;End setq ) ;End progn ) ;End If (if (eq siz "A1") ;If size is A1 (progn ;Do the following (setq x 841.0 ;Set x limits y 594.0 ;Set y limits ) ;End setq ) ;End progn ) ;End If (if (eq siz "A2") ;If size is A2 (progn ;Do the following (setq x 594.0 ;Set x limits y 420.0 ;Set y limits ) ;End setq ) ;End progn ) ;End If (if (eq siz "A3") ;If size is A3 (progn ;Do the following (setq x 420.0 ;Set x limits y 297.0 ;Set y limits ) ;End setq ) ;End progn ) ;End If (if (eq siz "A4") ;If size is A4 (progn ;Do the following (setq x 297.0 ;Set x limits y 210.0 ;Set y limits ) ;End setq ) ;End progn ) ;End If (setq SIZE (strcat TYP SIZ)) ;Construct name of Template (if (eq typ "e") (eng)) ;Run Engineering Setup (if (eq typ "a") (arch)) ;Run Architectural Setup (if (eq typ "c") (civil)) ;Run Civil Setup (if (eq typ "el") (elec)) ;Run Electrical Setup (if (eq typ "b") (blank)) ;Run Blank Setup ) ;End progn ) ;End If (princ) ;finish clean ) ;end function ;;;---------------------------------------------------------------------------- (defun blank () ;Define function (setvar "DIMSCALE" #DWGSC) ;Set Dimscale (setvar "USERR1" #DWGSC) ;Store Scale for future (setvar "LTSCALE" ( #DWGSC 10)) ;Set Ltscale (setvar "REGENMODE" 1) ;Regen ON (setvar "TILEMODE" 1) ;Tilemode ON (setq n ( 3.5 #DWGSC)) ;Store Text Height (setq L (list ( X #DWGSC) ( Y #DWGSC)) ;Calculate Limits ) (command "LIMITS" "0,0" L "ZOOM" "W" "0,0" L "STYLE" "italict" "italict" N "" "" "" "" "" "INSERT" SIZE "0,0" #DWGSC "" "" ) ;Set Up Drawing (prompt "\n ") ;Blank Line (prompt "\nO.K Setup Routine Complete") ;Inform User (princ) ;Exit Quietly ) ;End Function ;;;---------------------------------------------------------------------------- (defun eng () ;Define function (setvar "DIMSCALE" #DWGSC) ;Set Dimscale (setvar "USERR1" #DWGSC) ;Store Scale for future (setvar "LTSCALE" ( #DWGSC 10)) ;Set Ltscale (setvar "REGENMODE" 1) ;Regen ON (setvar "TILEMODE" 1) ;Tilemode ON (setq n ( 3.5 #DWGSC)) ;Store Text Height (setq L (list ( X #DWGSC) ( Y #DWGSC)) ;Calculate Limits ) (command "LIMITS" "0,0" L "ZOOM" "W" "0,0" L "STYLE" "italict" "italict" N "" "" "" "" "" "INSERT" SIZE "0,0" #DWGSC "" "" ) ;Set Up Drawing (prompt "\n ") ;Blank Line (prompt "\nO.K Setup Routine Complete") ;Inform User (princ) ;Exit Quietly ) ;End Function ;;;---------------------------------------------------------------------------- (defun arch () ;Define function (setvar "DIMSCALE" #DWGSC) ;Set Dimscale (setvar "USERR1" #DWGSC) ;Store Scale for future (setvar "LTSCALE" ( #DWGSC 10)) ;Set Ltscale (setvar "REGENMODE" 1) ;Regen ON (setvar "TILEMODE" 1) ;Tilemode ON (setq n ( 3.5 #DWGSC)) ;Store Text Height (setq L (list ( X #DWGSC) ( Y #DWGSC)) ;Calculate Limits ) (command "LIMITS" "0,0" L "ZOOM" "W" "0,0" L "STYLE" "italict" "italict" N "" "" "" "" "" "INSERT" SIZE "0,0" #DWGSC "" "" ) ;Set Up Drawing (prompt "\n ") ;Blank Line (prompt "\nO.K Setup Routine Complete") ;Inform User (princ) ;Exit Quietly ) ;End Function ;;;---------------------------------------------------------------------------- (defun civil () ;Define function (setvar "DIMSCALE" #DWGSC) ;Set Dimscale (setvar "USERR1" #DWGSC) ;Store Scale for future (setvar "LTSCALE" ( #DWGSC 10)) ;Set Ltscale (setvar "REGENMODE" 1) ;Regen ON (setvar "TILEMODE" 1) ;Tilemode ON (setq n ( 3.5 #DWGSC)) ;Store Text Height (setq L (list ( X #DWGSC) ( Y #DWGSC)) ;Calculate Limits ) (command "LIMITS" "0,0" L "ZOOM" "W" "0,0" L "STYLE" "italict" "italict" N "" "" "" "" "" "INSERT" SIZE "0,0" #DWGSC "" "" ) ;Set Up Drawing (prompt "\n ") ;Blank Line (prompt "\nO.K Setup Routine Complete") ;Inform User (princ) ;Exit Quietly ) ;End Function ;;;---------------------------------------------------------------------------- (defun elec () ;Define function (setvar "DIMSCALE" #DWGSC) ;Set Dimscale (setvar "USERR1" #DWGSC) ;Store Scale for future (setvar "LTSCALE" ( #DWGSC 10)) ;Set Ltscale (setvar "REGENMODE" 1) ;Regen ON (setvar "TILEMODE" 1) ;Tilemode ON (setq n ( 3.5 #DWGSC)) ;Store Text Height (setq L (list ( X #DWGSC) ( Y #DWGSC)) ;Calculate Limits ) (command "LIMITS" "0,0" L "ZOOM" "W" "0,0" L "STYLE" "italict" "italict" N "" "" "" "" "" "INSERT" SIZE "0,0" #DWGSC "" "" ) ;Set Up Drawing (prompt "\n ") ;Blank Line (prompt "\nO.K Setup Routine Complete") ;Inform User (princ) ;Exit Quietly ) ;End Function ;;;---------------------------------------------------------------------------- (princ) ;Clean Loading ;;;-----------------------------------------------------------------------------
To download the source coding and template files Click Here.
Please remember that you will need to create some of the template files yourself.