本帖最后由 llsheng_73 于 2023-1-3 14:53 编辑
- (defun arctopl(p r ang1 ang2 / a);;圆(弧)转多段线
- (setq a(*(rem(+(- ang2 ang1)pi pi)(+ pi pi))0.25)a(cons 42(/(sin a)(cos a))))
- (List(cons 10(polar p ang1 r))a(cons 10(polar p ang2 r))a))
- (defun tt(e yn / en p r ang1 ang2)
- (setq en(entget e)
- p(cdr(assoc 10 en))
- r(cdr(assoc 40 en))
- ang1(cdr(assoc 50 en)))
- (entmakex(vl-remove'nil(append(mapcar'cons'(0 100 100 90 70)(list"LWPOLYLINE""AcDbEntity""AcDbPolyline"2(if ang1 0 1)))(list(assoc 8 en)(assoc 370 en)(assoc 62 en))
- (if ang1(arctopl p r ang1(cdr(assoc 51 en)))(arctopl p r 0 pi)))))
- (or(="1"Yn)(entdel e)))
- (defun c:tt(/ e Yn )
- (initget "1 2")
- (or(member(setq Yn(getkword"1.保留圆(弧) 2.不保留圆(弧)[2]"))'("1""2"))(setq Yn"2"))
- (while(setq e(ssget":E:S"'((0 . "circle,arc"))))
- (tt(ssname e 0)Yn))
- )
|