Skip to main content
1-Visitor
September 9, 2014
Question

How to load a model from Windchill in Creo via vba api

  • September 9, 2014
  • 1 reply
  • 1684 views

Hi,

I have a list in Excel with model numbers to load in Creo via the vba api. The models reside in Windchill. How can I do this ?

I tryed next but this does not work:

Dim model As IpfcModel

Set model = gSession.GetModel("48603102.PRT", EpfcModelType.EpfcMDL_PART)

If Not model Is Nothing Then model.Display

Any help is appreciated.

Regards,

Bernard

    1 reply

    1-Visitor
    September 9, 2014

    Found it after looking into Excel attachments :

    'Create a modeldescriptor to the Pro/E Model
    Dim oModelDescriptorCreate As New CCpfcModelDescriptor
    Dim oModelDescriptor As IpfcModelDescriptor
    Set oModelDescriptor = oModelDescriptorCreate.Create(EpfcMDL_PART, sNumber, Null)

    'Retrieve the model into the oModel handle
    Set model = gSession.RetrieveModel(oModelDescriptor)

    'Create a new window which displays the Pro/E Model
    Dim oWindow As pfcls.IpfcWindow
    Set oWindow = gSession.OpenFile(oModelDescriptor)

    'Activate the new window
    oWindow.Activate