- ;阵列标高
- (defun c:arbg ()
- ;(PXT_ER)
- (defun DXF (n da) (cdr (assoc n da)))
- (setq xtblm '("osmode" "clayer" "cecolor" "orthomode" "plinewid")
- xtblz (mapcar 'getvar xtblm))
- (setvar "osmode" 1) ;_捕捉端点
- (if (setq s1 (entsel "\n请选择要复制"图层为_B标高"的标高(退出):")) (progn
- (command "undo" "be")
- (if (null bl-cb) (setq bl-cb 1.0))
- (prompt (strcat "\n当前缩放比例:【" (rtos bl-cb 2 1) "】"))
- (initget "Bili")
- (setq p1 (getpoint "\nBili改变比例/ 基点(退出):"))
- (while (= (progn (initget "Bili")
- (setq p1 (getpoint "\nBili改变比例/ 基点(退出):"))) "Bili")
- (setq bl-cb2 (getreal (strcat "\n请输入比例:<" (rtos bl-cb 2 1) ">")))
- (setq bl-cb (if bl-cb2 bl-cb2 bl-cb))
- (prompt (strcat "\n当前缩放比例:【" (rtos bl-cb 2 1) "】"))
- )
- ;;--------------------------------------------
- (setq en_Last (entlast) ss (ssadd))
- (command "_.ARRAY" s1 "" "R")
- (if (> (getvar "CMDACTIVE") 0) (command PAUSE))
- ;; 返回阵列后,新生成的物体ss
- (while (setq en_Last (entnext en_Last))
- (ssadd en_Last ss)
- )
- ;;------------------------------
- (setq i 0)
- (repeat (sslength ss)
- (setq en (ssname ss i)
- da (entget en)
- enty (DXF 0 da))
- (cond ;;处理:普通标高text 天正标高
- ((member enty (list "TEXT" "TCH_ELEVATION"))
- (setq txt (DXF 1 da))
- (if (or (= txt "%%p0.000") (= txt "0") ;_Tch标高为 (1 . "0")
- (and (/= (atof txt) 0) (wcmatch txt "*.*"))
- ) (progn
- ;;--计算高差----
- (setq d (* (- (cadr p2) (cadr p1)) 0.001 bl-cb)
- num (+ (atof txt) d))
- (setq txt-n (rtos num 2 3))
- (if (= txt-n "0.000") (setq txt-n "%%p0.000"))
- ;;------------
- (entmod (subst (cons 1 txt-n) (assoc 1 da) da))
- ))
- )
- ;;处理:属性标高
- ((member enty (list "INSERT"))
- (setq da (entget (entnext en))
- txt (DXF 1 da))
- ;;--计算高差----
- (setq d (* (- (cadr p2) (cadr p1)) 0.001 bl-cb)
- num (+ (atof txt) d))
- (setq txt-n (rtos num 2 3))
- (if (= txt-n "0.000") (setq txt-n "%%p0.000"))
- ;; 替换属性文字
- (setq da (entget (entnext en)))
- (entmod (subst (cons 1 txt-n) (assoc 1 da) da))
- (entupd en)
- (entupd (entnext en))
- ;;============================
- )
- ) ;_ cond
- (setq i (1+ i))
- ) ;_end repeat
- )) ;_end while
- (command "undo" "e")
- (mapcar 'setvar xtblm xtblz)
- (princ)
- )
|