my code doesn work
Private Sub CommandButton8_Click()
Dim asynconn As New pfcls.CCpfcAsyncConnection
Dim conn As pfcls.IpfcAsyncConnection
Dim session As pfcls.IpfcBaseSession
'Make an asynchronous connection with Pro/ENGINEER
Set conn = asynconn.Connect("", "", ".", 5)
'Get the current session
Set session = conn.session
Dim cmodel As IpfcModel
Dim modelDesc As IpfcModelDescriptor
Dim CModelDscr As New CCpfcModelDescriptor
Dim componentModel As IpfcSolid
Set modelDesc = CModelDscr.CreateFromFileName("partmodel.prt")
Set componentModel = session.GetModelFromDescr(modelDesc)
conn.Disconnect (1)
End Sub
Hi Pete,
could you please describe it more? What does not work? Is there any error message?
Regards,
Tom
Hi Tomas
i want do new part using any template, take it active and create new parameter.
My code doesnt create partmodel.prt insession. Error message doesnt see after run this code. But code row
Set componentModel = session.RetrieveModelFromDescr(modelDesc) gave error message
run-time error -2147352567(80020009)
pfcExceptions::XToolkitGeneralError
It is strange. The connection to the Creo is ok? You have there only 5 s timeout which is too short I think.
I would recommend to extend it to 20s or to leave it empty - asynconn.Connect(Nothing, Nothing, Nothing, Nothing)
Then I would try to call another function - change working directory or something to check if the connection is working correctly and finally to retrieve another model, check the model is in the working directory or on a search path