用vba在cad中如何编写捕捉结点的坐标的程序?
www.dimcax.com
用vba在cad中如何编写捕捉结点的坐标的程序?
如何用vba实现在cad中捕捉结点的坐标程序?
我再细细解释一下:
结点就是:交点、端点或中点等,用vba编写程序实现用鼠标捕获这个结点,然后记录这个点的坐标。
例如:两条直线的交点,用鼠标点击这个交点捕获后,然后将坐标的x坐标值及y的坐标值记录在记事本中,或excel表中,保存到一个地方。还有只有鼠标点击的时候这个程序才能执行。
感觉挺难,如何实现呢?我刚初学cad中的vba,还要请教这方面的专家高手
能把程序代码帮我写一下吗?谢谢了
基本思路: object.intersectwith(intersectobject, extendoption)
'求两直线的交点
public function intersect2line(byval objline1 as acadline, byval objline2 as acadline, byref pt as variant) as boolean
on error goto errhandle
dim pttemp as variant
pttemp = objline1.intersectwith(objline2, acextendnone)
pt(0) = pttemp(0)
pt(1) = pttemp(1)
pt(2) = pttemp(2)
intersect2line = true
errhandle:
intersect2line = false
end function
其中objline1 和objline2 是已知的直线吗?
如果这两条直线已经存在,如何将这两条直线引到参数objline1 和objline2 中
用两坐标点?