函数grreed 用法以及grreed的捕捉点方法
本帖最后由 qcw911 于 2011-7-13 11:15 编辑非常感谢zhynt
grreed 这个函数很重要
(defun sqr (x) (* x x))
(defun grd ()
(grdraw pt5 pt6 8 0)
(grdraw pt6 pt7 8 0)
(grdraw pt7 pt8 8 0)
(grdraw pt8 pt5 8 0)
(grdraw pt9 pt10 8 0)
(grdraw pt10 pt11 8 0)
(grdraw pt11 pt12 8 0)
(grdraw pt12 pt9 8 0)
(grdraw pt5 pt7 8 0)
(grdraw pt6 pt8 8 0)
) ;_ end of defun
(defun c:ddtt ()
(setq pt1 (getpoint "\n第一角点:"))
(prompt "\n第二角点:")
(while (= (car (setq ptn (grread T 4 0))) 5)
(setq pt3 (cadr ptn))
(redraw)
(cond
((and (> (car pt3) (car pt1)) (> (cadr pt3) (cadr pt1)))
(setq pt2 (list (car pt3) (cadr pt1))
pt4 (list (car pt1) (cadr pt3))
) ;_ end of setq
(setq a (distance pt1 pt2)
b (distance pt2 pt3)
) ;_ end of setq
(setq pt8 (polarpt4
(- (atan (/ b 24) (/ a 24)))
(sqrt (+ (sqr (/ b 24)) (sqr (/ a 24))))
) ;_ end of polar
pt7 (polarpt3
(+ (atan (/ b 24) (/ a 24)) pi)
(sqrt (+ (sqr (/ b 24)) (sqr (/ a 24))))
) ;_ end of polar
pt5 (polar pt8 (angle pt4 pt1) (/ b 1.4))
pt6 (polar pt7 (angle pt4 pt1) (/ b 1.4))
) ;_ end of setq
(setq pt9(polar pt1
(atan (/ b 24) (/ a 6))
(sqrt (+ (sqr (/ b 24)) (sqr (/ a 6))))
) ;_ end of polar
pt10 (polar pt9 (angle pt1 pt2) (/ a 1.5))
pt11 (polar pt10 (angle pt2 pt3) (/ b 12))
pt12 (polar pt9 (angle pt2 pt3) (/ b 12))
) ;_ end of setq
(grd)
)
((and (> (car pt3) (car pt1)) (< (cadr pt3) (cadr pt1)))
(setq pt2 (list (car pt1) (cadr pt3))
pt4 (list (car pt3) (cadr pt1))
) ;_ end of setq
(setq a (distance pt1 pt4)
b (distance pt1 pt2)
) ;_ end of setq
(setq pt8 (polarpt3
(- pi (atan (/ b 24) (/ a 24)))
(sqrt (+ (sqr (/ b 24)) (sqr (/ a 24))))
) ;_ end of polar
pt7 (polarpt2
(atan (/ b 24) (/ a 24))
(sqrt (+ (sqr (/ b 24)) (sqr (/ a 24))))
) ;_ end of polar
pt5 (polar pt8 (angle pt3 pt4) (/ b 1.4))
pt6 (polar pt7 (angle pt3 pt4) (/ b 1.4))
) ;_ end of setq
(setq pt9(polar pt4
(+ (atan (/ b 24) (/ a 6)) pi)
(sqrt (+ (sqr (/ b 24)) (sqr (/ a 6))))
) ;_ end of polar
pt10 (polar pt9 (angle pt4 pt1) (/ a 1.5))
pt11 (polar pt10 (angle pt1 pt2) (/ b 12))
pt12 (polar pt9 (angle pt1 pt2) (/ b 12))
) ;_ end of setq
(grd)
)
((and (< (car pt3) (car pt1)) (< (cadr pt3) (cadr pt1)))
(setq pt2 (list (car pt3) (cadr pt1))
pt4 (list (car pt1) (cadr pt3))
) ;_ end of setq
(setq a (distance pt3 pt4)
b (distance pt1 pt4)
) ;_ end of setq
(setq pt8 (polarpt3
(atan (/ b 24) (/ a 24))
(sqrt (+ (sqr (/ b 24)) (sqr (/ a 24))))
) ;_ end of polar
pt7 (polarpt4
(- pi (atan (/ b 24) (/ a 24)))
(sqrt (+ (sqr (/ b 24)) (sqr (/ a 24))))
) ;_ end of polar
pt5 (polar pt8 (angle pt3 pt2) (/ b 1.4))
pt6 (polar pt7 (angle pt4 pt1) (/ b 1.4))
) ;_ end of setq
(setq pt9(polar pt1
(+ pi (atan (/ b 24) (/ a 6)))
(sqrt (+ (sqr (/ b 24)) (sqr (/ a 6))))
) ;_ end of polar
pt10 (polar pt9 (angle pt1 pt2) (/ a 1.5))
pt11 (polar pt10 (angle pt1 pt4) (/ b 12))
pt12 (polar pt9 (angle pt1 pt4) (/ b 12))
) ;_ end of setq
(grd)
)
((and (< (car pt3) (car pt1)) (> (cadr pt3) (cadr pt1)))
(setq pt2 (list (car pt1) (cadr pt3))
pt4 (list (car pt3) (cadr pt1))
) ;_ end of setq
(setq a (distance pt3 pt4)
b (distance pt1 pt4)
) ;_ end of setq
(setq pt8 (polarpt3
(+ (* 1.5 pi) (atan (/ b 24) (/ a 24)))
(sqrt (+ (sqr (/ b 24)) (sqr (/ a 24))))
) ;_ end of polar
pt7 (polarpt4
(- (* 0.5 pi) (atan (/ b 24) (/ a 24)))
(sqrt (+ (sqr (/ b 24)) (sqr (/ a 24))))
) ;_ end of polar
pt5 (polar pt8 (angle pt4 pt1) (/ b 1.4))
pt6 (polar pt7 (angle pt4 pt1) (/ b 1.4))
) ;_ end of setq
(setq pt9(polar pt1
(+ (* 0.5 pi) (atan (/ b 24) (/ a 6)))
(sqrt (+ (sqr (/ b 24)) (sqr (/ a 6))))
) ;_ end of polar
pt10 (polar pt9 (angle pt1 pt2) (/ a 1.5))
pt11 (polar pt10 (angle pt2 pt3) (/ b 12))
pt12 (polar pt9 (angle pt2 pt3) (/ b 12))
) ;_ end of setq
(grd)
)
) ;_ end of cond
) ;_ end of while
(redraw)
(command "Line" "non"pt5 "non" pt6 "non" pt7"non" pt8 "non"pt5
"non" pt7 "") ;_ end of command
(command "line" "non" pt8 "non" pt6 "")
(command "line" "non"pt9 "non" pt10 "non" pt11 "non"pt12 "non" pt9
"") ;_ end of command
) ;_ end of defun
感谢热心人提供的源码
但是第二点怎么获取呢?
请高手支招!
不要伪源码
本帖最后由 下文没句号。 于 2023-5-27 21:54 编辑
强烈关注,以备后用,楼主第二点加上了没? 如果还支持追踪就更完美了。 强烈关注,以备后用 强烈关注一下!!
一定要顶起来! jig应该可以实现,就是自己做不到! 用块,绘制结束后再炸天,不难实现。 昨天赶出来的,有点罗嗦,还有就是第二个捕捉不知怎么弄。还是和图示不一样。 回复 zhynt 的帖子
挺好的,如果是家具填充,那么家具还要一点的一点画吗? 怎么才能框选选到第二点呢? 回复 zhynt 的帖子
Dear Sir,
nice lisp
add layer at lift 本帖最后由 qcw911 于 2011-7-11 15:43 编辑
我在论坛里面找到的捕捉方法
我的技术有限 看不懂啊
请你(高手)帮忙看看
这是用块的:
(defun c:ddtt ()
(setq pt (getpoint "\n插入点:"))
(command "insert" "dt" pt pause "")
)