VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "Sheet2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Option Explicit
Sub Drawing02()
    On Error GoTo RunError

    '// Module Name : CreoVBAStart
    Call CreoVBAStart.CreoConnt01
    
    Dim GetModel As IpfcModel
    Dim Model2D As IpfcModel2D
    Dim Drawing As IpfcDrawing
    
    Dim View2Ds As IpfcView2Ds
    Dim View2D As IpfcView2D
    Dim GetView2D As IpfcView2D
    Dim Transform3D As IpfcTransform3D
    Dim ViewOrigin As IpfcPoint3D

    Dim BaseDimension As pfcls.IpfcBaseDimension
    Dim Dimension2Ds As IpfcDimension2Ds
    Dim Dimension2D As IpfcDimension2D
    
    Dim i As Integer
    Dim j As Integer
    Dim lo As Integer
    lo = 1
    
    Set Model2D = BaseSession.CurrentModel
    Set Drawing = Model2D
    Set View2Ds = Model2D.List2DViews


    For i = 0 To View2Ds.Count - 1
        Set View2D = View2Ds.Item(i)
        Set Transform3D = View2Ds.Item(i).GetTransform
        Set ViewOrigin = Transform3D.GetOrigin

        Worksheets("drawing01").Cells(i + 6, "A") = i + 1
        Worksheets("drawing01").Cells(i + 6, "B") = View2D.Name
        Worksheets("drawing01").Cells(i + 6, "C") = ViewOrigin.Item(0)
        Worksheets("drawing01").Cells(i + 6, "D") = ViewOrigin.Item(1)
        Worksheets("drawing01").Cells(i + 6, "E") = View2D.GetSheetNumber
        
        
        Set GetModel = View2D.GetModel
        Set Dimension2Ds = Model2D.ListShownDimensions(GetModel, EpfcModelItemType.EpfcITEM_DIMENSION)
        
                For j = 0 To Dimension2Ds.Count - 1
                    
                         Set BaseDimension = Dimension2Ds.Item(j)
                         Set Dimension2D = BaseDimension
                         Set GetView2D = Dimension2D.GetView
                         
                         If GetView2D.Name = View2D.Name Then
                          
                            Worksheets("drawing01").Cells(i + 6, "E").Offset(, lo) = BaseDimension.Symbol
                            lo = lo + 1
                            
                         End If
                         
                Next j
                
                 lo = 1
    
    Next i
     MsgBox "I brought all the Drawing View names and Dimension IDs.", vbInformation, "korealionkk@gmail.com"
    
    conn.Disconnect (2)
    
    '// Cleanup
    Set asynconn = Nothing
    Set conn = Nothing
    Set BaseSession = Nothing
    Set model = Nothing
    
RunError:
            If Err.Number <> 0 Then
                MsgBox "Process Failed: An error occurred." & vbCrLf & _
                       "Error No: " & CStr(Err.Number) & vbCrLf & _
                       "Error Description: " & Err.Description & vbCrLf & _
                       "Error Source: " & Err.Source, vbCritical, "Error"
                If Not conn Is Nothing Then
                    If conn.IsRunning Then
                        conn.Disconnect (2)
                    End If
                End If
            End If

End Sub


