114
1万
中流砥柱
(defun c:valv (/ *error* oldVars varLst oldos oldlay vchx ln1 pt1 valvno ln1ent ang1 block1 c1) (defun *error*(msg) (if oldVars (mapcar 'setvar varLst oldVars) ); end if (princ "\nError or Esc pressed... Exit Program. ") (princ) ); end of *error* (setq varLst(list "CMDECHO" "OSMODE" "CLAYER" "DIMSCALE") oldVars(mapcar 'getvar varLst) ); end setq (setvar "cmdecho" 0) (setq oldos (getvar "osmode")) (setq oldlay (getvar "clayer")) (initget 1 "Ball Butterfly Diaphragm Gate Globe") (setq vchx (getkword "\nSpecify Valve Type [bAll/BUtterfly/Diaphragm/GAte/GLobe]: ")) (while (and (/= (setq ln1 (car (entsel "\nSelect Line for Valve: "))) nil) (/= (setq pt1 (getpoint "\nSelect Point for Valve: ")) nil) (/= (setq valvno (getstring "\nType Valve Number: ")) "") ) ; end and (setq ln1ent (entget ln1)) (setq ang1 (angle (cdr (assoc 10 ln1ent)) (cdr (assoc 11 ln1ent)) ) ; end angle ) ; end setq (setvar "clayer" "4") (setvar "osmode" 0) (cond ( (= vchx "Gate") (command "_.insert" "C:\\Users\\Lee Mac\\Documents\\Valves\\GATE VALVE.dwg" pt1 "" "" (rtd ang1) valvno ) ; end insert (setq block1 (entlast)) ) ; end condition 1 ( (= vchx "Globe") (command "_.insert" "C:\\Users\\Lee Mac\\Documents\\Valves\\GLOBE VALVE.dwg" pt1 "" "" (rtd ang1) valvno ) ; end insert (setq block1 (entlast)) ) ; end condition 2 ( (= vchx "Ball") (command "_.insert" "C:\\Users\\Lee Mac\\Documents\\Valves\\BALL VALVE.dwg" pt1 "" "" (rtd ang1) valvno ) ; end insert (setq block1 (entlast)) ) ; end condition 3 ( (= vchx "Butterfly") (command "_.insert" "C:\\Users\\Lee Mac\\Documents\\Valves\\BUTTERFLY VALVE.dwg" pt1 "" "" (rtd ang1) valvno ) ; end insert (setq block1 (entlast)) ) ; end condition 4 ( (= vchx "Diaphragm") (command "_.insert" "C:\\Users\\Lee Mac\\Documents\\Valves\\DIAPHRAGM VALVE.dwg" pt1 "" "" (rtd ang1) valvno ) ; end insert (setq block1 (entlast)) ) ; end condition 5 ) ; end cond; ***TRIM*** (command "_circle" pt1 "3" ) ; end circle (setq c1 (entlast)) (command "_zoom" "W" (polar pt1 (/ (* 3 pi) 4) (/ 3 4) ) ; end polar (polar pt1 (/ (* 7 pi) 4) (/ 3 4) ) ; end polar ) ; end zoom