本帖最后由 q3_2006 于 2014-6-25 12:23 编辑
- (defun c:tt ( / e en la p pp pt pt1 pt2 px)
- (defun mkline (la pt1 pt2) (entmakex (list '(0 . "LINE") (cons 8 la) (cons 10 pt1) (cons 11 pt2))))
- (vl-load-com)
- (while (setq en (entsel "\n选择钢筋断点:")
- pt (getpoint "\n点取弯钩方向:")
- )
- (setq e (car en)
- la (cdr (assoc 8 (entget e)))
- p (vlax-curve-getClosestPointTo e (cadr en))
- px (vlax-curve-getClosestPointTo e pt)
- pp (polar px (angle px p) 1e6)
- )
- (cond
- ((equal (* 0.25 pi) (angle p pt) (* 0.249 pi)) (mkline la p (polar p (* 0.25 pi) 100)) (vl-cmdf "break" (list e p) pp))
- ((equal (* 0.75 pi) (angle p pt) (* 0.249 pi)) (mkline la p (polar p (* 0.75 pi) 100)) (vl-cmdf "break" (list e p) pp))
- ((equal (* 1.25 pi) (angle p pt) (* 0.249 pi)) (mkline la p (polar p (* 1.25 pi) 100)) (vl-cmdf "break" (list e p) pp))
- ((equal (* 1.75 pi) (angle p pt) (* 0.249 pi)) (mkline la p (polar p (* 1.75 pi) 100)) (vl-cmdf "break" (list e p) pp))
- (t (exit))
- )
- )
- )
|