乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 65|回复: 1

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

[复制链接]

4

主题

6

帖子

2

银币

初来乍到

Rank: 1

铜币
22
发表于 2014-11-22 16:37:00 | 显示全部楼层 |阅读模式
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
回复

使用道具 举报

23

主题

561

帖子

13

银币

中流砥柱

Rank: 25

铜币
653
发表于 2014-11-22 22:57:00 | 显示全部楼层
常识 ByVal ents As Variant,Variant不能用byval传值方式
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-4-20 15:05 , Processed in 0.676666 second(s), 57 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表