- (defun c:qxdist (/ SS DIST DIST1 DIST2 EN ENOBJ OSM P1 P2)
- (vl-load-com)
- (setq ss (ssget))
- (command "pedit" "M" ss "" "" "j" "0" "")
- (setq osm (getvar "OSMode"))
- (setvar "OSMode" 512)
- (setq p1 (getpoint "\n选择第一点:"))
- (setq p2 (getpoint "\n选择第二点:"))
- (setq en (ssname (ssget p1) 0))
- (setq enobj (vlax-ename->vla-object en))
- (setq dist1 (vlax-curve-getDistAtPoint enobj p1))
- (setq dist2 (vlax-curve-getDistAtPoint enobj p2))
- (command "undo" "1")
- (setvar "OSMode" osm)
- (princ "\n测量段曲线长度:")
- (setq dist (abs (- dist1 dist2)))
- )
|