我的版本-快速组合,仅适用于线条对象:
- (defun c:test (/ doc space en el ep1 ep2 vp1 vp2 inp)
- (vl-load-com)
- (setq doc (vla-get-activedocument (vlax-get-acad-object))
- space (if (> (getvar "CVPORT") 1)(vla-get-modelspace doc)(vla-get-paperspace doc))
- )
- (if (setq en(entsel "\nSelect a Line: "))
- (progn
- (setq el (entget (car en))
- ep1 (cdr (assoc 10 el))
- ep2 (cdr (assoc 11 el))
- )
- (if (setq vp1 (getpoint "\nSelect a point for a vertical xline: ")
- vp2 (polar vp1 (/ pi 2) 1.0)
- inp (inters ep1 ep2 vp1 vp2 nil)
- )
- (progn
- (vla-addxline space (vlax-3d-point vp1)(vlax-3d-point vp2))
- (vla-addxline space (vlax-3d-point inp)(vlax-3d-point (polar inp 0.0 1.0)))
- )
- )
- )
- )
- )
|