본문 바로가기
  • Welcome!
VBA For Windchill

Windchill 연결 하기

by ToolBOX01 2024. 6. 19.
반응형

□ 다시 WC 서버 등록 하기

등록 전 등록 후

 

아래 코드는 Register 서버를 연결 하는 프로시져 입니다. WC 서버의 "이름", "서버 주소", "작업공간"을 입력 합니다

로그인 아이디 "tony", 비번을 입력 합니다.

▷ ▷Creo Session 연결 코드

Option Explicit
Public asynconn As New pfcls.CCpfcAsyncConnection
Public conn As pfcls.IpfcAsyncConnection
Public BaseSession As pfcls.IpfcBaseSession
Public Sub CreoConnt()
     
     '// connect creo model
     Set conn = asynconn.Connect("", "", ".", 5)
     Set BaseSession = conn.Session
             
End Sub

 

▷ ▷ Registers a server 코드

Option Explicit
Sub IDTWindchill()

    On Error GoTo RunError
    Application.EnableEvents = False
    
    '// Module Name : CreoVBAStart
    Call CreoVBAStart001.CreoConnt
    
    Dim ActiveServerName As IpfcServer
    Set ActiveServerName = BaseSession.RegisterServer("plm", "http://plm.*****.com/Windchill", "ko")
    Call BaseSession.AuthenticateBrowser("tony", "7777")
    
'// Disconnect with Creo
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

 

▷ ▷  Windchill VBA API는 다음과 같은 기능을 제공 합니다

  • Accessing a Windchill Server from a Session.
  • Accessing Workspaces
  • Workflow to Register a Server
  • Aliased URL
  • Server Operations
    Save
    Upload
    CheckIn
    Retrieval
    Checkout and Download
    Undo Checkout
    Import and Export
    File Copy
    Server Object Status
    Delete Objects

 

  • Conflicts During Server Operations
  • Utility APIs