可靠地访问图纸集组件 (SSO) 
可以使用 VBA 中的结构可靠地访问图纸集组件。Microsoft VBA 帮助包含结构的示例。VBA 的 Microsoft 帮助可从 VBA IDE 中的“帮助”菜单获得。Do WhileDo While 若要使用结构访问图纸集组件,请使用类似于 的语句来确定对象是否可用。例如,若要使用语句循环访问集合中的对象,可以使用以下代码:Do WhileDo While Not obj Is NothingDo While Not obj Is Nothing Public Function FindAllComponents(comps As Collection) As Boolean
    On Local Error GoTo etrap
    If comps Is Nothing Then Set comps = New Collection
    Dim iter As IAcSmEnumPersist
    Set iter = m_db.GetEnumerator
    Dim obj As IAcSmPersist
    Set obj = iter.Next
    Do While Not obj Is Nothing
        If TypeOf obj Is IAcSmComponent Then
            Dim comp As IAcSmComponent
            Set comp = obj
            comps.Add comp
        End If
        Set obj = iter.Next
    Loop
    FindAllComponents = True
    Exit Function
etrap:
    MsgBox CStr(Err.Number) & " - " & Err.Description
End Function
    相关参考父主题: | 
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1   苏公网安备32011402011833)
GMT+8, 2025-11-4 07:57
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.