很简单啊.我也来一个.- (defun gps->Circle-2plinelst (pt r n / ang nang pt1 ptlst) (setq nang (/ (* 2 pi) n) ang 0) (repeat n (setq pt1 (polar pt ang r)) (setq ang (+ ang nang)) (setq ptlst (append ptlst (list pt1))) ))
- (defun gps->entmake-pline(pt_lst lay clsd) (entmakex (append (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") (cons 8 lay) (cons 90 (length pt_lst)) (cons 70 clsd); 1闭合 ) (mapcar '(lambda (pt) (cons 10 pt)) pt_lst) ) ) ) (defun gps->ss-2lst (ss / lst n) (if (= (type ss) 'PICKSET) (repeat (setq n (sslength ss)) (setq lst (cons (ssname ss (setq n (1- n))) lst)) ) ) lst)(defun c:cl() (if (null $fs)(setq $fs 10)) (setq tmp (getint (strcat "\n圆转多段线,请输入等份数量<" (itoa $fs) ">:"))) (if tmp (setq $fs tmp)) (foreach n (gps->ss-2lst (ssget '((0 . "Circle")))) (setq ptlst (entget n) lay (cdr (assoc 8 ptlst)) pt (cdr (assoc 10 ptlst)) r (cdr (assoc 40 ptlst))) (gps->entmake-pline (gps->Circle-2plinelst pt r $fs) lay 1) (entdel n) ) (prin1))
|