本帖最后由 酷酷提 于 2022-4-27 03:20 编辑
源码来自于:Gu_xl 大大
遇到的问题是:这个源码是 以拾取点的中心为基点画矩形
希望得到解决方案是:以拾取基点为基础,鼠标向右上方移动,就以基点为基础 向右上方画矩形,鼠标往左上方移动,就以基点为基础向左上方画矩形,就是有可能鼠标会往左上左下,右上右下方向移动
- (defun c:tt (/ w p1 p2 ang )
- (initget 7)
- (setq w (getdist "\n**输入宽度:"))
-
- (princ "\n**输入")
- (while (and
- (setq p1 (getpoint "第一点:"))
- (setq p2 (getpoint p1 "\n**第二点:"))
- )
- (setq ang (angle p1 p2) l (distance p1 p2))
- (entmake
- (list
- '(0 . "LWPOLYLINE")
- '(100 . "AcDbEntity")
- '(100 . "AcDbPolyline")
- '(90 . 4)
- '(70 . 1)
- '(43 . 0.0)
- '(38 . 0.0)
- '(39 . 0.0)
- (cons 10 (trans (setq p(polar p1 (+ ang (* 0.5 pi)) (* 0.5 w))) 1 0))
- (cons 10 (trans (setq p (polar p ang l)) 1 0))
- (cons 10 (trans (setq p (polar p (- ang (* 0.5 pi)) w)) 1 0))
- (cons 10 (trans (setq p (polar p (+ pi ang) l)) 1 0))
- )
- )
- (princ "\n**继续输入")
- )
- (princ)
- )
|