本帖最后由 llsheng_73 于 2022-5-12 17:18 编辑
用command它快不起来,另外很多步骤实际上都能计算出来
- (defun c:bb (/ del n ro ss w1 d1 r ang)
- (setq w1(if(numberp w)w 5)
- d1(if(numberp d)d 5))
- (or(setq w(getdist (strcat"\n长:"(rtos(if(numberp w)w 5))">>>>>")))
- (setq w w1))
- (or(setq d(getdist (strcat"\n宽:"(rtos(if(numberp d)d 5))">>>>>")))
- (setq d d1))
- (setq ro(getreal "\n旋转角度:[0]")
- ro(if ro(/(* ro pi)180)0))
- (initget "Y y N n")
- (setq del(="N"(GETKWORD"\n是否删除圆Y/N[Y])"))
- r(*(sqrt(+(* w w)(* d d)))0.5)
- ang(angle'(0 0)(list w d))
- n 0
- ss(ssget '((0 . "CIRCLE"))))
- (repeat(sslength ss)
- (sub-ob(ssname ss n)r ang ro del)
- (setq n(1+ n)))
- (setvar "osmode" 4543)
- )
- (defun sub-ob(e r ang ro f / pt)
- (setq pt(cdr(assoc 10(entget e))))
- (entmake(apply'append(cons(mapcar'cons'(0 100 100 62 90 70)(append'("LWPOLYLINE""AcDbEntity""AcDbPolyline"2 4 1)))
- (mapcar'(lambda(x y)(list(cons 10(polar pt x r))(cons 42 y)))
- (list(+ pi ang ro)(+ pi pi(- ang)ro)(+ ang ro)(+ pi(- ang)ro))
- '(0 1 0 1)))))
- (if f(entmod(append(entget e)'((62 . 1))))
- (entdel e))
- )
|