VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "Class1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
' step11 -    

Option Explicit

Public iKompasObject As Kompas6API5.Application   '  KompasObject
Public doc As Kompas6API5.Document2D              '  ksDocument2D

'   
' 0 - , 1 - , 2 -  -  collection

Public Function CALLBACKPROCCOMMANDWINDOW(comm As Integer, rInfo As Object) As Integer
  iKompasObject.ksMessage "  : " & comm
  
  '        
  '       
  Dim info As Kompas6API5.RequestInfo         '  ksRequestInfo
  Set info = rInfo                            '    
  
  If Not info Is Nothing Then
    info.Title = "   : " & comm
    Set info = Nothing
  End If
  
  '   ,       :
  ' ( TRUE - , FALSE -     )
  If comm = 3 Then
    CALLBACKPROCCOMMANDWINDOW = False
  Else
    CALLBACKPROCCOMMANDWINDOW = True
  End If
End Function

'   

Public Function GetLibraryName() As String
  GetLibraryName = "   " '  
End Function

'    -      
 
'           .
'        NULL,
'    CommandWindow  ,
'        .
'      .
'     ,    
'      FALSE,    -1.

Public Sub ExternalRunCommand(ByVal command As Integer, ByVal mode As Integer, ByVal kompas_ As Kompas6API5.Application)
  Set iKompasObject = kompas_                 '   
    
  If iKompasObject Is Nothing Then            '     - 
    Exit Sub                                  '    
  End If
  
  Set doc = iKompasObject.ActiveDocument2D    '    2D 
  
  Dim info As Kompas6API5.RequestInfo         '  ksRequestInfo
  '      
  Set info = iKompasObject.GetParamStruct(ko_RequestInfo)
  
  '          -   
  If Not doc Is Nothing And Not info Is Nothing Then
    info.Init                                 '      

    info.menuId = 3000 'ID_TREE_CONTENTS      '      
    info.Title = " "              '   
    info.SetCallBackCm "CALLBACKPROCCOMMANDWINDOW", 0, Me '   
    
    Dim command1 As Integer
    command1 = doc.ksCommandWindow(info)      '     
    iKompasObject.ksMessage "  : " & command1
    Set info = Nothing
  End If

End Sub

'   

Public Function ExternalMenuItem(ByVal number As Integer, itemType As Integer, command As Integer) As String
    itemType = 3 '"ENDMENU"'
    ExternalMenuItem = ""
    command = -1

    Select Case number
        Case 1                                '  1 -    
            itemType = 1 'MENUITEM'
            ExternalMenuItem = "   "
            command = 1
        Case 2                                '   
            itemType = 3 '"ENDMENU"'
            ExternalMenuItem = ""
            command = -1
    End Select
End Function


