明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1498|回复: 2

以下代码为什么不能求得交点也不能划直线

[复制链接]
发表于 2005-10-13 13:30:00 | 显示全部楼层 |阅读模式

以下代码为什么不能求得交点也不能划直线

Dim InsPoint(0 To 2) As Double

Dim pt1(0 To 2), pt2(0 To 2), pt3(0 To 2) As Double

Dim SPoint, pt As Variant


Dim Hint As String
Hint = vbCrLf & "Please put in Point:"
SPoint = acadApp.ActiveDocument.Utility.GetPoint(, Hint)
InsPoint(0) = SPoint(0) + 10#

InsPoint(1) = SPoint(1)

InsPoint(2) = 0

pt1(0) = SPoint(0)
pt1(1) = SPoint(1) + 10#
pt(2) = 0

pt2(0) = SPoint(0) + 10#
pt2(1) = SPoint(1) + 10#
pt2(2) = 0

Dim La, Lb As AcadLine

Dim st1, St2, ed1, ed2 As Variant
ed1(0) = pt2(0)
ed1(1) = pt2(1)
ed1(2) = 0

St2(0) = InsPoint(0)
St2(1) = InsPoint(1)
St2(2) = 0

ed2(0) = pt1(0)
ed2(1) = pt1(1)
ed2(2) = 0

Dim cir As AcadCircle

cir = acadApp.ActiveDocument.ModelSpace.AddCircle(pt1, 20)


Set La = acadApp.ActiveDocument.ModelSpace.AddLine(SPoint, ed1)
Set Lb = acadApp.ActiveDocument.ModelSpace.AddLine(St2, ed1)

pt = Lb.IntersectWith(La, acExtendBoth)

请高手指点!

发表于 2005-10-13 17:59:00 | 显示全部楼层

错误太多了!

Sub tttt()
Dim acadapp As AcadApplication
Set acadapp = Application
Dim InsPoint(0 To 2) As Double

Dim pt1(0 To 2) As Double, pt2(0 To 2) As Double, pt3(0 To 2) As Double

Dim SPoint, pt As Variant


Dim Hint As String
Hint = vbCrLf & "Please put in Point:"
SPoint = acadapp.ActiveDocument.Utility.GetPoint(, Hint)
InsPoint(0) = SPoint(0) + 10#

InsPoint(1) = SPoint(1)

InsPoint(2) = 0

pt1(0) = SPoint(0)
pt1(1) = SPoint(1) + 10#
pt1(2) = 0

pt2(0) = SPoint(0) + 10#
pt2(1) = SPoint(1) + 10#
pt2(2) = 0

Dim La, Lb As AcadLine

Dim st1, St2, ed1, ed2
ed1 = pt2
St2 = InsPoint
ed2 = pt1

Dim cir As AcadCircle

Set cir = acadapp.ActiveDocument.ModelSpace.AddCircle(pt1, 20)


Set La = acadapp.ActiveDocument.ModelSpace.AddLine(SPoint, ed1)
Set Lb = acadapp.ActiveDocument.ModelSpace.AddLine(St2, ed1)

pt = Lb.IntersectWith(La, acExtendBoth)


End Sub

 楼主| 发表于 2005-10-13 19:03:00 | 显示全部楼层

非常感谢你的帮助

 

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-27 10:25 , Processed in 0.170295 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表