G'day伙计们
我无法获得与用户的距离。我试着把三件事考虑进去。
1、用户将在模型空间中输入2个点
2.用户将在纸张空间中输入2个点
3、用户将输入值。
基本上尝试复制“Getdist”功能,使其在纸张空间中工作。
附件是我的代码。
- (defun Sub_GetDistance (Str_Msg / Pt_Point1 Pt_Point2)
- (if
- (and
- (not (vl-catch-all-error-p (setq Pt_Point1 (vl-catch-all-apply 'getpoint (list Str_Msg)))))
- Pt_Point1
- (not (vl-catch-all-error-p (setq Pt_Point2 (vl-catch-all-apply 'getpoint (list Pt_Point1 "\nSelect second point :")))))
- Pt_Point2
- )
- (if
- (and ;If all true measuring item in paper space through v port
- (zerop (getvar "tilemode"))
- (not (zerop (getvar "cvport")))
- (setq Pt_Point1 (trans Pt_Point1 2 0)
- Pt_Point2 (trans Pt_Point2 2 0))
- (equal Pt_Point1 (osnap Pt_Point1 "_End,_Int,_Qua,_Cen,_Mid,_Node"))
- (equal Pt_Point2 (osnap Pt_Point2 "_End,_Int,_Qua,_Cen,_Mid,_Node"))
- )
- (distance (trans Pt_Point1 3 2)(trans Pt_Point2 3 2)) ;This only uses the latest view port created
- (distance Pt_Point1 Pt_Point2)
- )
- )
- )
|