- 积分
- 354
- 明经币
- 个
- 注册时间
- 2002-11-22
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
小弟有一作业,情况是这样的:
在任意直线上得一点,再得不在这一直线上的点作为方向,然后画表面粗糙度.
小弟参考了上次网友 chg 在 "用(ssget )可以做到" 一文中的办法
想半天,做不出,ssget实体选择实在有点过不去
请各位帮忙挑错,感谢感谢...
(defun c:t2(/ p1 p2 p3 p4 p5 p6 p7 p8 ang ang1 k ename ss)
(setq p1 (getpoint "\n input p1"))
(setq p5 (getpoint "\n input p2"))
(setq k (getdist "\n input k"))
(setq ss (ssget p1))
(setq ename (ssname ss 0))
(setq p2 (cdr (assoc 10 (entget ename))))
(setq p3 (cdr (assoc 11 (entget ename))))
(setq ang (angle p2 p3))
(setq ang1 (angle p1 p5))
(cond
((> (- ang1 pi) ang)
(setq p6 (polar p1 (- ang (/ pi 3)) (* 10 k)))
(setq p7 (polar p1 (- ang (* (/ pi 3) 2) (* 10 k))))
(setq p8 (polar p1 (- ang (* (/ pi 3) 2) (* 20 K)))))
((and (> ang1 ang) (< ang1 (+ ang pi)))
(setq p6 (polar p1 (+ ang (* (/ pi 3) 2) (* 10 k))))
(setq p7 (polar p1 (+ ang (/ pi 3) (* 10 k))))
(setq p8 (polar p1 (+ ang (/ pi 3) (* 20 K)))))
((and (> ang1 0) (< ang1 ang))
(setq p6 (polar p1 (- ang (/ pi 3)) (* 10 k)))
(setq p7 (polar p1 (- ang (* (/ pi 3) 2) (* 10 k))))
(setq p8 (polar p1 (- ang (* (/ pi 3) 2) (* 20 K))))))
(command "pline" p7 p6 p1 p8 "")
)
注:k是画粗糙度的比例系数 |
|