FUN是放大方程- (defun fun(x)
- (* 2 x)
- )(defun c:Scale_circle( / ent ents pt ss i pt1 pt2 ptCenter pt_lst)
- (setq os (getvar "osmode"))
- (setvar "cmdecho" 0)
- (setvar "osmode" 0)
- (setq ent (car (entsel "选择圆...")))
- (setq ents (entget ent))
- (setq pt (cdr (assoc 10 ents)))
- (command "_.bhatch" "a" "b" "n" ent "" "" "p" "u" "45" "10" "" pt "")
- (command "_.explode" (entlast))
- (setq ss (ssget "p"))
- (entdel ent)
- (setq i 0)
- (setq pt_lst nil)
- (repeat (sslength ss)
- (setq ent (ssname ss i))
- (setq ents (entget ent))
- (setq pt1 (cdr (assoc 10 ents)))
- (setq pt2 (cdr (assoc 11 ents)))
- (setq ptcenter (list (/ (+ (car pt1) (car pt2)) 2.0)
- (/ (+ (cadr pt1) (cadr pt2)) 2.0)
- (/ (+ (last pt1) (last pt2)) 2.0)
- )
- )
- (command "_.scale" ent "" ptCenter (fun 1))
- (setq ents (entget ent))
- (setq pt1 (cdr (assoc 10 ents)))
- (setq pt2 (cdr (assoc 11 ents)))
- (setq pt_lst (append pt_lst (list (list pt1 pt2))))
- (entdel ent)
- (setq i (1+ i))
- )
- (command "_.spline")
- (mapcar '(lambda (e) (command (car e))) pt_lst)
- (mapcar '(lambda (e) (command (cadr e))) (reverse pt_lst))
- (command "c" "")
- (setvar "osmode" os)
- (princ)
- )
|