马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
- [FONT=courier new]
- ;block edit; N改块/X左右镜相/Y前后镜相/Z值/V新尺寸/S放缩 ------lxx.97.4[2001.2m]
- ;dwall can be stretch at the same time when V
- ;tblsearch;cond;ucs
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;------chb-------;;;;;;;;;;;;;;;;;;;;;;;;;;;main
- (defun c:chb (/ ss n i kw nvl sc)
- (princ "\nchb--block块修改工具------------------lxx.97.4[2001.2m]")
- ; (COMMAND "UCS" "" "PLAN" "")
- (chb1) ;;;;---chb1
- (setvar "osmode" 0)
- (setq ss(ssget)
- n (sslength ss)
- i 0)
- (repeat n
- (setq ent (entget (ssname ss i) '("*")) i (+ 1 i))
- (if (or (= "INSERT" (cdr (assoc 0 ent)))
- (= "attrib" (cdr (assoc 0 ent)))) (chb2));;;---chb2
- )(princ)
- )
- ;;;;;;;;;;;;;;;;;;;;;-------chb1--------;;;;;;;;;;;;;;;;;;;;;;;;;
- (defun chb1 ( )
- (initget "N X Y Z V S")
- (setq kw (strcase(getkword "\nN改块/X左右镜相/Y前后镜相/Z值/V插入比例/S放缩:")))
- (cond ((= "N" kw) (progn (setq cod 2 nval (getstring "\n 替换为块?:"))
- (if (null (tblsearch "block" nval)) (progn (command "insert" nval)(command)))
- ))
- ((= "X" kw) (setq cod 41))
- ((= "Y" kw) (setq cod 42))
- ((= "Z" kw) (setq cod 43 nval (getdist "\n z 值:")))
- ((= "V" kw) (setq cod 41 nvl (getdist "\n 插入比例:")))
- ((= "S" kw) (setq cod 41 sc (getdist "\n scale比例:")))
- ) )
- ;;;;;;;;;;;;;;;;;-------chb2--------;;;;;;;;;;;;;;;;
- (defun chb2 (/ oe nent ipt ang pt1 pt2 p1 p2) ;nval
- (setq oe (assoc cod ent) val (cdr oe))
- (cond
- ((= "N" kw)(princ "\nOK!"))
- ((= "X" kw)(setq nval (- 0 VAL)))
- ((= "Y" kw)(setq nval (- 0 VAL)))
- ((= "Z" kw)(princ "\nOK!"))
- ((= "V" kw)(setq nval (/ (* val nvl) (abs val))
- ipt (cdr (assoc 10 ent)) ang (cdr (assoc 50 ent)))
- (COMMAND "UCS" "") ;MUST LINE
- (setvar "osmode" 0)
- (setq pt1 (polar ipt ang val) anp (/ pi 20)
- pt2 (polar ipt ang nval)
- p1 (polar pt1 (+ (+ ang (/ pi 2)) anp) 200)
- p2 (polar pt1 (+ (- ang (/ pi 2)) anp) 200)))
- ((= "S" kw)(setq nval (* sc VAL)))
- )
- (setq nent (subst (cons cod nval) oe ent)) (entmod nent)
- (if (or (= "V" kw) (= "S" kw)) ;y value
- (if(/= "C" (cdr (assoc 2 ent)))
- (progn (setq oe (assoc 42 nent) val (cdr oe))
- (if(= "V" kw)(setq nval (/ (* val nvl) (abs val))))
- (if(= "S" kw)(setq nval (* sc VAL)))
- (setq nent (subst (cons 42 nval) oe nent))
- (entmod nent)
- ) ))
- (if (= "V" kw)
- (command "_stretch" "c" p1 p2 "" pt1 pt2)
- ) )
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;end
- (princ "\n chb---block块修改工具------------------lxx.97.4[2001.2m]")(princ)
- [/FONT]
|