Welcome to the Southern African Autolisp Website.
You are Visitor Number
|
| Page I. | Home. | Page III. |
Engineering Drawings
A0 - 1189 mm x 841 mm A1 - 841 mm x 594 mm A2 - 594 mm x 420 mm A3 - 420 mm x 297 mm A4 - 297 mm x 210 mm
The dialogue box we have designed will return 3 values :
TYP - Type of Sheet (eg. EL for Electrical)
SIZ - Size of Sheet (eg. A3 for A3 size sheet)
#DWGSC - Drawing Scale (eg. 25 for 1 in 25)
We can now use these values to set up our drawing sheet.
Have a look at the following coding :
(defun C:SETUP3 () ;define function
(setvar "BLIPMODE" 0) ;switch off variables
(setvar "CMDECHO" 0)
(setvar "OSMODE" 0)
(setq typ "e") ;set default
(setq dcl_id (load_dialog "setup3.dcl")) ;load dialogue
(if (not ;test if loaded
(new_dialog "setup3" 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
;;;----------------------------------------------------------------------------
(princ) ;*Clean Loading
;;;-----------------------------------------------------------------------------
First of all, we check that the O.K. button has been selected.
If the user Cancels, nothing happens and we quietly exit the routine.
If O.K. has been selected, we first check the size of sheet choosen then,
set our x and y limits depending on what size sheet was choosen.
Next, we take the type and size of sheet and string them together.
This gives us the name of the Template Drawing that we need to insert.
Clever, Hey....
Folowing this, we test to see what type of sheet was choosen.
Depending on the type, we run a sub-routine to set up our drawing.
I have deliberalty allowed different setup routines for each type of
drawing. This makes the programme fully customisable and flexible.
Please note that these setup routines are set to my standards and
may not suit the way you want to setup a drawing.
Did you notice how I stored the scale factor into USERR1?
This allows you to retrieve the scale factor for later use.
(The value in USERR1 is saved with the drawing.)
On the next page I will list the complete coding for all Sheet Types.
| Page I. | Home. | Page III. |