(defun c:TTS(/ e1 e1_data gr isright n osm p0 p1 p2 p3 p4 p5 p6 p7 p8 pplst ptlst ss t1 t1_data tstr)
(setvar "cmdecho" 0)
(setq osm (getvar "osmode"))
(setvar "osmode" 0)
(setq p0 (cadr (grread T 15 0)) isright T ss (ssadd))
(setq ptlst
(list
(setq p1 (polar p0 pi 4.7))
(setq p2 (polar p1 (* pi 0.5) 2.5))
(setq p3 (polar p2 0 7.0))
(setq p4 (polar p3 (* pi 0.5) 1.5))
(setq p5 (list (+ (car p4) 4) (- (cadr p4) 4) (caddr p4)))
(setq p6 (list (- (car p5) 4) (- (cadr p5) 4) (caddr p5)))
(setq p7 (polar p6 (* pi 0.5) 1.5))
(setq p8 (polar p7 pi 7))
)
)
(if (setq tstr (getint "\n请输入页面号:"))
(progn
(setq t1_data (entget (setq t1 (entmakex (list '(0 . "TEXT") (cons 10 p0) (cons 11 p0) (cons 1 (strcat "第" (rtos tstr) "页")) (cons 40 3.5) '(62 . 2) '(41 . 0.8) '(72 . 4) '(73 . 0))))))
(setq e1_data (entget (setq e1 (entmakex (append (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") '(62 . 2) (cons 90 (length ptlst)) (cons 70 1)) (mapcar '(lambda(x) (cons 10 x)) ptlst))))))
(princ "\n请指定插入点")
(while (and (setq gr (grread T 15 0)) (or (= (car gr) 5) (= (car gr) 2) (= (car gr) 11) (= (car gr) 25)))
(if (equal gr '(2 32)) (if isright (setq isright nil) (setq isright T)))
(if (and (/= (car gr) 11) (/= (car gr) 25) (/= (car gr) 2))
(progn
(setq p0 (cadr gr))
(if isright
(setq ptlst
(list
(setq p1 (polar p0 PI 4.7))
(setq p2 (polar p1 (* pi 0.5) 2.5))
(setq p3 (polar p2 0 7.0))
(setq p4 (polar p3 (* pi 0.5) 1.5))
(setq p5 (list (+ (car p4) 4) (- (cadr p4) 4) (caddr p4)))
(setq p6 (list (- (car p5) 4) (- (cadr p5) 4) (caddr p5)))
(setq p7 (polar p6 (* pi 0.5) 1.5))
(setq p8 (polar p7 pi 7))
)
)
(setq ptlst
(list
(setq p1 (polar p0 0 4.7))
(setq p2 (polar p1 (* pi 0.5) 2.5))
(setq p3 (polar p2 pi 7.0))
(setq p4 (polar p3 (* pi 0.5) 1.5))
(setq p5 (list (- (car p4) 4) (- (cadr p4) 4) (caddr p4)))
(setq p6 (list (+ (car p5) 4) (- (cadr p5) 4) (caddr p5)))
(setq p7 (polar p6 (* pi 0.5) 1.5))
(setq p8 (polar p7 0 7))
)
)
)
(setq t1_data (subst (cons 10 p0) (assoc 10 t1_data) t1_data) t1_data (subst (cons 11 p0) (assoc 11 t1_data) t1_data))
(setq pplst (mapcar '(lambda(x) (cons 10 x)) ptlst) n 0)
(foreach x e1_data (if (= (car x) 10) (progn (setq e1_data (subst (nth n pplst) x e1_data)) (setq n (1+ n)))))
(entmod t1_data)
(entmod e1_data)
)
)
)
(ssadd t1 ss)
(ssadd e1 ss)
(command "-GROUP" "" "*" "" ss "")
)
)
(setvar "osmode" osm)
(prin1)
)