本帖最后由 飞雪神光 于 2024-8-22 11:58 编辑
用command 绘图要关闭捕捉 你却都打开 要是改为包围盒只需要框选一下就可以 不用指定四点
- (defun c:ctx(/ aa ctlenth ptbottom ptleft ptright pttop sb x1 x2 y1 y2)
- (setq sb (getvar "blipmode"))
- (setvar "blipmode" 0)
- (setvar "cmdecho" 0)
-
- ;;根据全局比例设置出头线段长度,即 50比例的 6倍为长度 300
- (setq aa(getvar "dimscale"))
- (setq CTLenth (* aa 6))
- ;调试显示长度值
- (print CTLenth)
-
- ;;根据选择,确认图纸的边界范围,左下x1y1 右上x2y2
- (setq ptleft (getpoint "\n选择最左点:"))
- (setq x1 (car ptleft))
- (print x1)
-
- (setq ptright (getpoint "\n选择最右点:"))
- (setq x2 (car ptright))
- (print x2)
-
- (setq ptbottom (getpoint "\n选择最底点:"))
- (setq y1 (cadr ptbottom))
- (print y1)
-
- (setq pttop (getpoint "\n选择最顶点:"))
- (setq y2 (cadr pttop))
- (print y2)
- (entmake (list '(0 . "LINE")(cons 62 8)(cons 10 (list (- x1 CTLenth) y1))(cons 11 (list (+ x2 CTLenth) y1))))
- (entmake (list '(0 . "LINE")(cons 62 8)(cons 10 (list (- x1 CTLenth) y2))(cons 11 (list (+ x2 CTLenth) y2))))
- (entmake (list '(0 . "LINE")(cons 62 8)(cons 10 (list x1 (- y1 CTLenth)))(cons 11 (list x1 (+ y2 CTLenth)))))
- (entmake (list '(0 . "LINE")(cons 62 8)(cons 10 (list x2 (- y1 CTLenth)))(cons 11 (list x2 (+ y2 CTLenth)))))
- (setvar "blipmode" sb)
- (princ)
- )
|