本帖最后由 llsheng_73 于 2023-11-11 22:31 编辑
- (defun c:tt(/ p a0 b0 a b x1 y2 y1 y2 b1 b2)
- (while(and(setq p(getpoint"\n左上角点:"))
- (or(setq a(getdist(strcat"长度"(if a0(rtos a0 2 2)""))))
- (setq a a0))
- (or(setq b(getdist(strcat"宽度"(if b0(rtos b0 2 2)""))))
- (setq b b0))
- (>(setq a(abs a))0)
- (>(setq b(abs b))0)
- (setq a0 a b0 b)
- (if(> a b)
- (setq x1(* b 0.5)y1 0 x2(- a x1)y2(- b)b1 0 b2 -1)
- (setq x1 0 y1(* a -0.5)x2 a y2(-(- y1)b)b1 -1 b2 0))
- (entmakex(mapcar'cons'(0 100 100 90 70 10 42 10 42 10 42 10 42)
- (list"LWPOLYLINE""AcDbEntity""AcDbPolyline"4 1
- (mapcar'+(list x1 y1)p)b1
- (mapcar'+(list x2 y1)p)b2
- (mapcar'+(list x2 y2)p)b1
- (mapcar'+(list x1 y2)p)b2))))))
|