****************** COPY HANG LOAT TANG DAN *************************************** (defun c:cc (/ ang x y ent tg tg1tg2 num_r num_c num_inc dis_r dis_c num top idnum dx dy bottom inc tgnum attr attr_ent t_base b_base locat value deci stnum loca1 loca2 tt count inctg inctg1 bpoint mx my nx ny bx by) (setq idnum 0) (while (/= idnum 1) (setq ent (entsel "\nHay lua chon so ma ban muon copy : ")) (if ent (progn (setq e (car ent)) (setq tg (entget e)) (if (= (cdr (assoc 0 tg)) "TEXT") (setq idnum 1)) ) (princ) ) ) (setq num_inc (getreal "\nHay nhap he so tang giam <1> : ")) (if (= num_inc nil) (setq num_inc 1)) (setq bpoint (getpoint "\nChon diem goc de copy : ")) (setq x (car bpoint)) (setq y (car(cdr bpoint))) (if (and (= (cdr (assoc 72 tg)) 0) (= (cdr (assoc 73 tg)) 0)) (progn (setq bx (car (cdr (assoc 10 tg)))) (setq by (car (cdr (cdr (assoc 10 tg))))) ) (progn (setq bx (car (cdr (assoc 11 tg)))) (setq by (car (cdr (cdr (assoc 11 tg))))) ) ) (setq attr (cdr tg)) ;attr chua cac thuoc tinh cua Entity nguon (setq tg (cdr (assoc 1 tg))) (setq inc 0) (setq tg1 "") (setq t_base "") (setq b_base "") (setq idnum 0) (setq top 0) (setq bottom 0) (setq stnum "") (setq deci 0) (repeat (strlen tg) (if (or (and (> (ascii (setq tgnum (substr tg (- (strlen tg) inc) 1))) 47) (< (ascii (setq tgnum (substr tg (- (strlen tg) inc) 1))) 58)) (= (ascii (setq tgnum (substr tg (- (strlen tg) inc) 1))) 32) (= (ascii (setq tgnum (substr tg (- (strlen tg) inc) 1))) 46)) (progn (if (= (ascii (setq tgnum (substr tg (- (strlen tg) inc) 1))) 46) (setq deci inc)) (if (= inc 0) (progn (setq idnum 1) (if (= (ascii (setq tgnum (substr tg (- (strlen tg) inc) 1))) 46) (setq b_base (strcat "." b_base))) ) ) (if (= bottom 1) (progn (setq bottom 0) (setq idnum 1) (setq top 1))) (if (and (= idnum 0) (= top 1)) (setq t_base (strcat tgnum t_base))) (if (= idnum 1) (progn (if (and (= tgnum "0") (> inc 0)) (setq stnum (strcat stnum "0")) (setq stnum "")) (setq tg1 (strcat tgnum tg1)) ) ) ) (if (= inc 0) (progn (setq b_base (strcat tgnum b_base)) (setq bottom 1) ) (if (= bottom 1) (setq b_base (strcat tgnum b_base)) (progn (setq top 1) (setq t_base (strcat tgnum t_base)) (if (= idnum 1) (setq idnum 0)) ) ) ) ) (setq inc (+ inc 1)) ) (if (= tg1 "") (exit)) (setq num (atof tg1)) (setq count 1) (while (setq bpoint (getpoint "\nChon diem copy tiep theo : ")) (setq num (+ num num_inc)) (setq value (strcat t_base (strcat stnum (rtos num 2 deci)) b_base)) (setq nx (car bpoint)) (setq ny (car(cdr bpoint))) (setq dx (- nx x)) (setq dy (- ny y)) (setq mx (car (getvar "ucsxdir"))) (setq my (car (cdr (getvar "ucsxdir")))) (setq loca1 (+ bx (* mx dx))) (setq loca2 (+ by (* my dx))) (setq mx (car (getvar "ucsydir"))) (setq my (car (cdr (getvar "ucsydir")))) (setq loca1 (+ loca1 (* mx dy))) (setq loca2 (+ loca2 (* my dy))) (setq attr_ent (subst (cons 1 value) (assoc 1 attr) attr)) (if (and (= (cdr (assoc 72 attr_ent)) 0) (= (cdr (assoc 73 attr_ent)) 0)) (setq attr_ent (subst (list 10 loca1 loca2 0) (assoc 10 attr_ent) attr_ent)) (setq attr_ent (subst (list 11 loca1 loca2 0) (assoc 11 attr_ent) attr_ent)) ) (entmake attr_ent) (setq count (+ count 1)) ) ;end while (princ) )