반응형
- Run Creo in the background.
- Use only Creo Foundation licenses
- Used for converting Creo files.
Option Explicit
Sub ModelnameTable()
On Error GoTo RunError
Application.EnableEvents = False
Dim asynconn As New pfcls.CCpfcAsyncConnection
Dim conn As pfcls.IpfcAsyncConnection
Dim CreoProgramName As String
Dim BaseSession As pfcls.IpfcBaseSession
Dim CreateModelDescriptor As New CCpfcModelDescriptor
Dim ModelDescriptor As pfcls.IpfcModelDescriptor
Dim Model As pfcls.IpfcModel
CreoProgramName = "C:\PTC\Creo 9.0.6.0\Parametric\bin\parametric.exe -g:no_graphics"
Set conn = asynconn.Start(CreoProgramName, "")
Set BaseSession = conn.Session
Call BaseSession.ChangeDirectory("C:\Temp")
Set ModelDescriptor = CreateModelDescriptor.CreateFromFileName("korea.prt")
Set Model = BaseSession.RetrieveModel(ModelDescriptor)
MsgBox Model.fileName
conn.End
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
Configure and use your PC for various conversion tasks.
by korealionkk@gmail.com
'VBA, VB.NET For Creo' 카테고리의 다른 글
Creo] Get drawing information - 작업중 (0) | 2025.01.27 |
---|---|
CREO] Get selected Folder and file names (0) | 2025.01.26 |
Template] Create a new model by changing the dimensions - 작업중 (0) | 2025.01.22 |
VB.NET] 2022버전 : 새로운 프로젝트 만들기 (0) | 2025.01.21 |
VB.NET] 자주 사용하는 코드를 별도의 파일로 만들어 공유 (0) | 2025.01.21 |