- 积分
- 988
- 明经币
- 个
- 注册时间
- 2004-7-21
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
楼主 |
发表于 2005-4-30 14:34:00
|
显示全部楼层
请帮忙看一看代码哪里出现了问题:
要求用户在多段线上选择一点,然后找到该点在垂直方向上和多段线的交点,但是提示找不到交点:在debug状态下。basepnt的值为2230.24,-85;dmxPolyLineObj的Cooridinates的值横坐标在4700以上,纵坐标的值在153左右,所以找不到交点,为什么会发生这种情况。应该怎么解决?
ThisDrawing.Utility.GetEntity obj, basePnt, '在多段线上选择一点' Set dmxPolyLineObj = obj basePnt = GetIntersectPntWithDmx(basePnt, dmxPolyLineObj)
'函数:GetIntersectPntWithDmx
Public Function GetIntersectPntWithDmx(pnt As Variant, PLine As AcadLWPolyline) As Variant Dim lineobj As AcadLine Dim pnt1(0 To 2) As Double, pnt2(0 To 2) As Double Dim intersectVarient As Variant Dim intersectPnt(0 To 2) As Double pnt1(0) = pnt(0): pnt1(1) = pnt(1): pnt1(2) = 0: pnt2(0) = pnt(0): pnt1(1) = pnt(1) - 1: pnt1(2) = 0: Set lineobj = ThisDrawing.ModelSpace.AddLine(pnt1, pnt2) intersectVarient = GetIntersectPoint(lineobj, PLine) intersectPnt(0) = intersectVarient(0): intersectPnt(1) = intersectVarient(1): intersectPnt(2) = intersectVarient(2) GetIntersectPntWithDmx = intersectPnt lineobj.Delete End Function
|
|