本帖最后由 Gu_xl 于 2014-8-26 21:41 编辑
目标是对于任意四边形,会自动做辅助线并自动标注尺寸接着自动列出公式
目前代码已经实现做辅助线(感谢cad高手:q2 的无私奉献)
- (defun c:tt ( / a b e l l1 l2 p pt1 pt2 pts px x y)
- (vl-load-com)
- (defun gpts (e) (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget e))))
- (defun mkline (pt1 pt2) (entmakex (list '(0 . "LINE") (cons 10 pt1) (cons 11 pt2))))
- (setq p (getpoint))
- (vl-cmdf "bpoly" p "")
- (setq e (entlast)
- pts (gpts e)
- l (list (list (car pts) (caddr pts)) (list (cadr pts) (cadddr pts)))
- l (vl-sort l '(lambda (x y) (> (distance (car x) (cadr x)) (distance (car y) (cadr y))) ) )
- l1 (car l)
- l2 (cadr l)
- a (mkline (car l1) (cadr l1))
- b (mkline (setq px (car l2)) (vlax-curve-getClosestPointTo a px))
- b (mkline (setq px (cadr l2)) (vlax-curve-getClosestPointTo a px))
- )
- (entdel e)
- )
|