|
(defun c:CNN()
(setvar "cmdecho" 0)
;(command "ucs" "")
;(setq oldosmode(getvar "osmode"))
;;; (setvar "osmode" 0)
(princ "叫匡拒腹妓狾:" )
(setq sta(ssget))
(setq ssn(ssname sta 0))
(setq ss1(entget ssn))
(setq blocktype (cdr(assoc 2 ss1)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq c0 ssn
tb(entget c0)
ty(cdr (assoc 0 tb))
tl(cdr (assoc 2 tb))
)
(setq c c0)
(while (/= ty "SEQEND")
( setq c (entnext c)
tb(entget c)
ty(cdr (assoc 0 (entget c)))
va(cdr (assoc 1 tb)) ;GET ATTRIB DEFUN VALUE
na(cdr (assoc 2 tb))
)
(if (= na "瑈腹")
(progn
(setq filename (cdr (assoc 1 tb)))
(setq len(strlen filename))
(setq filename2(substr filename 1 (- len 3) ) )
(setq num2(substr filename (- len 2) 3))
)
)
)
(setq num2 (atoi num2))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(princ "\n叫匡拒璶逼瓜:" )
(setq ss(ssget))
(setq a4(ssadd))
(setq j 0)
(repeat (sslength ss)
(setq current(ssname ss j))
(setq currentobject(entget current))
(setq block (cdr(assoc 2 currentobject)))
(if (= block blocktype)
(setq a4(ssadd current a4))
)
(setq j(1+ j))
)
(setq i 0)
(repeat (sslength a4)
(setq currentblock(ssname a4 i))
(setq currentobjectblock(entget currentblock))
(setq insertpoint(cdr(assoc 10 currentobjectblock)))
(if (= i 0) (setq item (list(list currentblock insertpoint))) (setq item (cons (list currentblock insertpoint) item)))
(setq i (1+ i))
)
;;; y= (setq m (nth 1(nth 1 (nth 0 item))))
(setq m 0)
(repeat (length item)
(setq n 0)
(setq num 0)
(setq num3 0)
(setq num4 0)
(repeat (length item)
(if (< (+ (nth 1(nth 1 (nth m item)))50) (nth 1(nth 1 (nth n item))) ) (setq num (1+ num)))
(if (and (< (-(nth 1(nth 1 (nth m item)))50) (nth 1(nth 1 (nth n item)))) (> (+(nth 1(nth 1 (nth m item)))50) (nth 1(nth 1 (nth n item)))) (> (nth 0(nth 1 (nth m item))) (nth 0(nth 1 (nth n item))))) (setq num (1+ num)))
(setq n (1+ n))
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq c0 (nth 0 (nth m item))
tb (entget c0)
ty(cdr (assoc 0 tb))
tl(cdr (assoc 2 tb))
)
(setq c c0)
(while (/= ty "SEQEND")
( setq c (entnext c)
tb(entget c)
ty(cdr (assoc 0 (entget c)))
va(cdr (assoc 1 tb)) ;GET ATTRIB DEFUN VALUE
na(cdr (assoc 2 tb))
)
(if (= na "瑈腹")
(progn
(setq num3 (+ num num2))
(if (< num3 10) (setq num4(strcat "00" (itoa num3))) )
(if (and (< num3 100) (>= num3 10)) (setq num4(strcat "0" (itoa num3))))
(if (>= num3 100) (setq num4(itoa num3) ))
(setq newfilename (strcat filename2 num4))
(setq tb (subst (cons 1 newfilename) (assoc 1 tb) tb));REPET DATE
(entmod tb)
(entupd c)
))
)
(setq m (1+ m))
)
;;; (setvar "osmode" oldosmode)
;;; (setvar "cmdecho" 1)
(princ)
)
|
评分
-
查看全部评分
|