明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1522|回复: 0

版主大哥,急,为什么这个交点集是空呢!

[复制链接]
发表于 2005-3-23 23:43:00 | 显示全部楼层 |阅读模式
Public Sub selectAtPoint() Dim selectionSet1 As AcadSelectionSet, Lastset As AcadSelectionSet
Dim pyline As AcadLWPolyline
Dim line1 As AcadLine
Dim intPoints As Variant
Dim Fdata(0) As Variant
Dim Ftype(0) As Integer
Dim i As Integer, j As Integer, k As Integer, m As Integer, n As Integer, p As Integer, q As Integer, r As Integer, s As Integer
Dim pointPt(0 To 8000) As Double

Dim str As String

Dim vSelectPoint As Variant, vSelectPoint1 As Variant
Dim selection As AcadSelectionSet
ThisDrawing.SendCommand "cmdecho" & vbCr & "0" & vbCr

On Error Resume Next
Set selectionSet1 = ThisDrawing.SelectionSets.Add("SS1")
If Err Then
Set selectionSet1 = ThisDrawing.SelectionSets("SS1")
selectionSet1.Delete
End If
Set selectionSet1 = ThisDrawing.PickfirstSelectionSet
If selectionSet1.Count = 0 Then
Set selectionSet1 = ThisDrawing.SelectionSets("SS1")
If Err Then Set selectionSet1 = ThisDrawing.SelectionSets.Add("SS1")
selectionSet1.Clear
selectionSet1.SelectOnScreen
End If

Set Lastset = ThisDrawing.SelectionSets.Add("SS2")
ThisDrawing.Utility.Prompt "请选择测线:"
Fdata(0) = "3"
Ftype(0) = 8

m = 0
For i = 0 To selectionSet1.Count - 1
Set line1 = selectionSet1.Item(i)
line1.Color = acGreen
line1.GetBoundingBox vSelectPoint, vSelectPoint1

Set selection = ThisDrawing.ActiveSelectionSet
selection.Select acSelectionSetCrossing, vSelectPoint, vSelectPoint1, Ftype, Fdata
For j = 0 To selection.Count - 1
Set pyline = selection.Item(j)
pyline.Color = acBlue
intPoints = line1.IntersectWith(pyline, acExtendNone)
If VarType(intPoints) <> vbEmpty Then
n = 0
For k = LBound(intPoints) To UBound(intPoints)
pointPt(m) = intPoints(n)
pointPt(m + 1) = intPoints(n + 1)
pointPt(m + 2) = intPoints(n + 2)
k = k + 2
m = m + 3
n = n + 3
Next
Else
MsgBox "无交点数据", , "IntersectWith Example"
End If
Next
Next end sub 为什么 intPoints 是空的呢,问题出在哪呢,请高手指教。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-27 18:29 , Processed in 0.165157 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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