难道是这样:(未做处理,不应该啊,这个比你的那个简单多了)
- (defun c:center( / ss i j ent ents ptc r pts)
- (setq ss (ssget '((0 . "CIRCLE"))))
- (setq i 0)
- (repeat (sslength ss)
- (setq ent (ssname ss i))
- (setq ents (entget ent))
- (setq ptc (cdr (assoc 10 ents))
- r (cdr (assoc 40 ents))
- j 0
- pts'())
- (repeat 4
- (setq pts (append pts (list (polar ptc (* j (/ pi 2)) (+ r (/ r 3))))))
- (setq j (1+ j))
- )
- (command "_.line" (nth 0 pts) (nth 2 pts) ""
- "_.line" (nth 1 pts) (nth 3 pts) "")
- (setq i (1+ i))
- )
- (princ)
- )
|