以下代码为什么不能求得交点也不能划直线
<P>以下代码为什么不能求得交点也不能划直线</P><P>Dim InsPoint(0 To 2) As Double</P>
<P>Dim pt1(0 To 2), pt2(0 To 2), pt3(0 To 2) As Double</P>
<P>Dim SPoint, pt As Variant </P>
<P><BR>Dim Hint As String<BR>Hint = vbCrLf & "Please put in Point:"<BR>SPoint = acadApp.ActiveDocument.Utility.GetPoint(, Hint)<BR>InsPoint(0) = SPoint(0) + 10#</P>
<P>InsPoint(1) = SPoint(1)</P>
<P>InsPoint(2) = 0</P>
<P>pt1(0) = SPoint(0)<BR>pt1(1) = SPoint(1) + 10#<BR>pt(2) = 0</P>
<P>pt2(0) = SPoint(0) + 10#<BR>pt2(1) = SPoint(1) + 10#<BR>pt2(2) = 0</P>
<P>Dim La, Lb As AcadLine</P>
<P>Dim st1, St2, ed1, ed2 As Variant<BR>ed1(0) = pt2(0)<BR>ed1(1) = pt2(1)<BR>ed1(2) = 0</P>
<P>St2(0) = InsPoint(0)<BR>St2(1) = InsPoint(1)<BR>St2(2) = 0</P>
<P>ed2(0) = pt1(0)<BR>ed2(1) = pt1(1)<BR>ed2(2) = 0</P>
<P>Dim cir As AcadCircle</P>
<P>cir = acadApp.ActiveDocument.ModelSpace.AddCircle(pt1, 20)</P>
<P><BR>Set La = acadApp.ActiveDocument.ModelSpace.AddLine(SPoint, ed1)<BR>Set Lb = acadApp.ActiveDocument.ModelSpace.AddLine(St2, ed1)</P>
<P>pt = Lb.IntersectWith(La, acExtendBoth)<BR></P>
<P>请高手指点!</P> <P>错误太多了!</P>
<P>Sub tttt()<BR>Dim acadapp As AcadApplication<BR>Set acadapp = Application<BR>Dim InsPoint(0 To 2) As Double</P>
<P>Dim pt1(0 To 2) As Double, pt2(0 To 2) As Double, pt3(0 To 2) As Double</P>
<P>Dim SPoint, pt As Variant</P>
<P><BR>Dim Hint As String<BR>Hint = vbCrLf & "Please put in Point:"<BR>SPoint = acadapp.ActiveDocument.Utility.GetPoint(, Hint)<BR>InsPoint(0) = SPoint(0) + 10#</P>
<P>InsPoint(1) = SPoint(1)</P>
<P>InsPoint(2) = 0</P>
<P>pt1(0) = SPoint(0)<BR>pt1(1) = SPoint(1) + 10#<BR>pt1(2) = 0</P>
<P>pt2(0) = SPoint(0) + 10#<BR>pt2(1) = SPoint(1) + 10#<BR>pt2(2) = 0</P>
<P>Dim La, Lb As AcadLine</P>
<P>Dim st1, St2, ed1, ed2<BR>ed1 = pt2<BR>St2 = InsPoint<BR>ed2 = pt1</P>
<P>Dim cir As AcadCircle</P>
<P>Set cir = acadapp.ActiveDocument.ModelSpace.AddCircle(pt1, 20)</P>
<P><BR>Set La = acadapp.ActiveDocument.ModelSpace.AddLine(SPoint, ed1)<BR>Set Lb = acadapp.ActiveDocument.ModelSpace.AddLine(St2, ed1)</P>
<P>pt = Lb.IntersectWith(La, acExtendBoth)</P>
<P><BR>End Sub<BR></P> <P>非常感谢你的帮助</P>
<P> </P>
页:
[1]