明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1600|回复: 0

紧急求助:各位同仁们帮助看一下这段程序问题在哪里?

[复制链接]
发表于 2005-7-28 12:48:00 | 显示全部楼层 |阅读模式

Sub ConnectLine()
Dim mySelect As AcadSelectionSet
Dim MyVal(0 To 3) As String
MyVal(0) = "8": MyVal(1) = "TbRegion": MyVal(2) = "0": MyVal(3) = "REGION"
BuildFilter fType, fDate, MyVal
Set sss = ThisDrawing.SelectionSets
On Error Resume Next
ThisDrawing.SelectionSets.Item("mySelects12").Delete
On Error GoTo ErrExit
Set myss = sss.Add("mySelects12")
myss.Select acSelectionSetAll, , , fType, fDate
Dim myExplode As Variant, En As AcadEntity
For Each En In myss
   myExplode = En.Explode
   Set mySelect = sss.Add("sRegions5")
   mySelect.AddItems myExplode   '当前选择集已经添加了对象
  
   '问题:为什么下一句中P提示前一个选择集合不存在
   ThisDrawing.SendCommand "_pedit" & vbCr & "M" & vbCr & "P" & vbCr & vbCr & "Y" & vbCr & "J" & vbCr & vbCr & vbCr
   mySelect.Delete
Next
Exit Sub
ErrExit:
   MsgBox Err.Description
End Sub

'创建选择集的过滤规则
Public Sub BuildFilter(typeArray As Variant, dataArray As Variant, ByVal gCodes As Variant)
Dim fType() As Integer, fData() As Variant
Dim Index As Long, i As Long
Index = LBound(gCodes) - 1
'根据gCodes的内容创建过滤数组
For i = LBound(gCodes) To UBound(gCodes) Step 2
    Index = Index + 1
    ReDim Preserve fType(0 To Index)
    ReDim Preserve fData(0 To Index)
    fType(Index) = CInt(gCodes(i))
    fData(Index) = gCodes(i + 1)
Next
'返回值
typeArray = fType
dataArray = fData
End Sub

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

本版积分规则

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

GMT+8, 2024-11-27 12:48 , Processed in 0.157095 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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