; LS.LSP [Article Figure 3] (c)1990, Barry Bowen ; *************************************************************** ; Parametric System for Structural Steel Shapes ; Copyright (c) Barry R. Bowen 1989 ; ; ------------------------- LS ---------------------------------- ; Layer search command for creating new layers. ; Variables: ; CL = Current layer ; CLR = Color for new layer ; FRZ = Frozen layer ; NLAY = New layer name ; LAY = Requested layer name ; LT = Linetype for new layer ; ; SAMPLE CALL: (LS "BEAM" "3" "HIDDEN") ; Where "BEAM" is the new layer name, "3" is the ; layer color and "HIDDEN" is the linetype. An ; empty "" can be used for a continuous ; linetype. (defun LS (NLAY CLR LT) (setq CL (getvar "clayer")) (setq LAY (tblsearch "layer" NLAY)) (if (not LAY) (command "layer" "m" NLAY "c" CLR "" "lt" LT "" "");True (progn (setq FRZ (cdr (assoc 70 LAY))) (if (= FRZ 65) (progn (command "layer" "t" NLAY "") (command "layer" "s" NLAY "") ) (command "layer" "s" NLAY "") ;False )) ) ) ; -------------------------- RL --------------------------------- ; Resets the previous layer to the current layer. ; (defun RL () (command "layer" "s" CL "")) ; ------------------------ CHATCH ------------------------------- ; Hatches the structural shape if the hatch toggle is ON. ; (defun CHATCH () (LS "HATCH" "9" "") (if (= HAT T) (progn (if (not HS) (setq HS 1.0) (setq HS HSCL)) (setq HSCL (getreal (strcat "\nScale for Hatch <" (rtos HS) ">: "))) (if (eq HSCL nil) (setq HSCL HS)) (command "snap" "r" PT1 "") (command "hatch" "ansi32" HSCL "0" SL1 "") (SSET) ))) ; ----------------------- ROTANG -------------------------------- ; Rotates the shape before it is relocated. ; Variables: ; ANS = Answer ; ROTA = Rotation angle ; (defun ROTANG (/ ANS ROTA) (setq ANS (strcase (substr (getstring "\nRotate? ") 1 1))) (if (or (= ANS "") (= ANS "Y")) (progn (setq ROTA (getreal "\nAngle: ")) (command "rotate" (entlast) "" PT1 ROTA))) ) ; ----------------------- PLACE --------------------------------- ; Moves the inserted shape to a new location. ; (defun PLACE () (command "move" (entlast) "" PT1) ) ; ----------------------- ENDR ---------------------------------- ; Ending sub-routine to reset the system variables. ; (defun ENDR () (V1R) ;Reset system variables (RL) ;Reset current layer (foreach N '(SL1 OD ID SL CL X Y WLTK BF D TF TW K1 K TA) (setq N nil)) ;Set all variables to nil (command "UNDO" "END") ;Set for proper Undo ) ; ---------------------- *ERROR* -------------------------------- ; IF the program is prematurely terminated all environments ; are reset to the original. ; (defun *error* (E) (foreach N '(SL1 OD ID SL CL X Y WLTK BF D TF TW K1 K TA) (setq N nil)) (V1R) ;Restore system variables to original setting (RL) ;Set to original layer (command "linetype" "s" "bylayer" "") (ENDR) ;Ending routine (princ "error: ") (princ E) ;Print error message (tepri) )