明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 800|回复: 1

call调用函数怎么不行啊 求救 跪求大神啊

[复制链接]
发表于 2014-11-22 16:37:31 | 显示全部楼层 |阅读模式
Public Sub addentstosset(ByVal ents As Variant, ByRef sset As AcadSelectionSets)
   Dim objcollection() As AcadEntity
   ReDim objcollection(UBound(ents))
   If VarType(ents) <> vbArray + vbArray Then
     MsgBox "数据无效!"
    End If
    For i = 0 To UBound(ents)
        objcollection(i) = ents(i)
        Next i
   sset.AddItems objcollection
End Sub

Sub creat()
  Dim sset As AcadSelectionSet
  On Error Resume Next
  If Not IsNull(ThisDrawing.SelectionSets.Item("example")) Then
    Set sset = ThisDrawing.SelectionSets.Item("example")
    sset.Delete
End If
Set sset = ThisDrawing.SelectionSets.Add("example")
Dim pt(0 To 2) As Double
pt(0) = 0
pt(1) = 0
pt(2) = 0
Dim cirl1 As AcadCircle, cirl2 As AcadCircle, cirl3 As AcadCircle
Set cirl1 = ThisDrawing.ModelSpace.AddCircle(pt, 50)
Set cirl2 = ThisDrawing.ModelSpace.AddCircle(pt, 80)
Set cirl3 = ThisDrawing.ModelSpace.AddCircle(pt, 110)
Dim objcollection(0 To 2) As AcadEntity
Set objcollection(0) = cirl1
Set objcollection(1) = cirl2
Set objcollection(2) = cirl3
Call addentstosset(objcollection, sset)
MsgBox sset.Count
sset.Delete
End Sub

发表于 2014-11-22 22:57:34 | 显示全部楼层
常识 ByVal ents As Variant,Variant不能用byval传值方式
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

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

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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