본문 바로가기
  • Welcome!
업무 자동화/VBA, VB.NET For Creo

Creo Model Open

by ToolBOX01 2024. 11. 19.

▷ Code

'// Create a modeldescriptor to the Creo Model
Dim session As pfcls.IpfcBaseSession
Dim oModelDescriptorCreate As New CCpfcModelDescriptor
Dim oModelDescriptor As IpfcModelDescriptor

Set oModelDescriptor = oModelDescriptorCreate.Create(EpfcMDL_ASSEMBLY, "ASM0001.ASM", Null)
 
'//Retrieve the model into the oModel handle
Set oModel = session.RetrieveModel(oModelDescriptor)
 
'//Create a new window which displays the Creo Model
Dim oWindow As pfcls.IpfcWindow
Set oWindow = session.GetModelWindow(oModelDescriptor)
 
'//Activate the new window
oWindow.Activate
 
'//Show the name of the Creo Model in a messagebox
MsgBox "Model name = " & oModel.Filename