弧线测量距离和定距标点
本帖最后由 【KAIXIN】 于 2012-12-28 08:24 编辑首先说明:这个悬赏贴是应一个老乡所托在此求助:
就当是给大家一个做习题吧!也当是回馈明经!
欢迎大家踊跃回帖讨论,很感谢!
凡认真回答此题者,皆有奖励,一个币起!
下图是图纸的截图:
测试文件:
根据szxgsh兄提的几个意见做了修改
1.现在程序响应的更快了
2.弄了个长名字和短名字
3.可以选择满布和单个
无图无真相的说
附上修改过了的fas
你是不是公路放线哦,, 本帖最后由 xiabin68 于 2012-12-27 16:14 编辑
技术只能这样了,,只能一根一根的选,,再看看别个有没有更好的思路了
;;QQ19539078
(DEFUN C:HK ()
(SETQ XY1 (GETPOINT "点击交点1:")
XY2 (GETPOINT "点击交点2:")
SS (CAR (ENTSEL "选择曲线:"))
NAME1 (VLAX-ENAME->VLA-OBJECT ss)
XX1 (VLAX-CURVE-GETCLOSESTPOINTTO NAME1 XY1)
XX2 (VLAX-CURVE-GETCLOSESTPOINTTO NAME1 XY2)
DIST1 (VLAX-CURVE-GETDISTATPOINT NAME1 XX1)
DIST2 (VLAX-CURVE-GETDISTATPOINT NAME1 XX2)
DIST (- DIST2 DIST1)
d2 (+ dist1 (/ dist 2))
d3 (vlax-curve-getpointatdistname1 d2)
)
(command "text" "j" "m" d3 "3" (angtos (angle xy1 xy2) 0 4) (rtos (abs dist) 2 3) "")
(command "point" xx1)
(command "point" xx2)
(command "text" "j" "m" (polar xx1 (angtof "60") 3) "3" "0" "交点1" "")
(command "text" "j" "m" (polar xx2 (angtof "60") 3) "3" "0" "交点2" "")
(princ )
)
是不是用vlax-curve族函数就能搞定了? 坐等,占座顶一下吧 要用到曲线“焊接”? (defun c:test (/ CUR P1 P2)
(vl-load-com)
(setq cur (car (entsel "nSelect the cure:")))
(setq p1 (getpoint "nPick First Point:"))
(Setq p2 (getpoint "nPick Seconf Point:"))
(abs (- (vlax-curve-getDistAtPoint cur p2)
(vlax-curve-getDistAtPoint cur p1)))
) (defun C:test ()
(setvar "osmode" 183)
(setq p (getpoint "\nPick a Point:"))
(setq jl (getreal "\ndist:"))
(setq cur (car (entsel)))
(setq pe (vlax-curve-getPointAtDist cur jl))
(setq tan (vlax-Curve-getFirstDeriv cur (vlax-Curve-getParamAtPoint cur pe)))
(setq pf (polar pe (+ (/ pi 2) (atan (/ (cadr tan) (car tan)))) 1))
(vl-cmdf "line" pe pf "")
) 上面胡乱改了下,应该是这个意思吧