cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Setting Up VB API

SOLVED

Re: Setting Up VB API

Hello Sir,

I have to open Proe using vb program, but it opens and automatically it is closed. Please give me a sample program how to open proe using vb. Here is my sample code.

im asyncConnection As IpfcAsyncConnection = Nothing

Dim cAC As CCpfcAsyncConnection

Dim session As IpfcBaseSession

Try

'======================================================================

'First Argument : The path to the Pro/E executable along with command

'line options. -i and -g flags make Pro/ENGINEER run in non-graphic,

'non-interactive mode

'Second Argument: String path to menu and message files.

'======================================================================

cAC = New CCpfcAsyncConnection

asyncConnection = cAC.Start("D:\Program Files\proeWildfire 5.0\bin\proe.exe" + "-g:graphics-i:rpc_input", ".")

session = asyncConnection.Session

'======================================================================

'Set working directory

'======================================================================

asyncConnection.Session.ChangeDirectory("D:\Program Files\proeWildfire 5.0\bin\TestModels")

'======================================================================

'VB api process calls and other processing to be done

'======================================================================

Dim descModel As IpfcModelDescriptor

Dim model As IpfcModel

descModel = (New CCpfcModelDescriptor).Create(EpfcModelType.EpfcMDL_PART, "el2.prt", Nothing)

model = session.OpenFile(descModel)

Catch ex As Exception

MsgBox(ex.Message.ToString + Chr(13) + ex.StackTrace.ToString)

Finally

End Try

Re: Setting Up VB API

Hi Mohit,

In the code you are using, you are not calling any function that would close Pro/ENGINEER after completing the

required task. So, Pro/ENGINEER should not close on its own.

So, without calling IpfcAsyncConnection.End(), if your ProE is closing, then I suspect that something is going wrong in the code which might be causing a premature exit. Debug the code and see after which function ProE is exiting. You may also try writing some lines to a log file after each function to see if the code is executing completely or existing.

To close Pro/ENGINEER from VB code, one should use IpfcAsyncConnection.End().

Thanks,

Seshu

Re: Setting Up VB API

Dear Seshu,

Thanx for ur reply

ProeError111.jpg

Please solve this error its urjent.

Re: Setting Up VB API

Why this error is comming.. this error is comming every time what can I do Please help me

Re: Setting Up VB API

Hi Mohit,

I work in US time zone. So, cannot reply to this post in your time zone. Hence, there will be some delay in my replies.

Regarding the error, this error is thrown when your VB application is attempting to connect to Pro/ENGINEER. Please note that the failure resons could be multipel and it depends on the conditions that exist on the machine at the time of connection attempt is made. I need to look at the machine to find the exact reasons for the connection failure. I cannot do this through this post. I would request you to contact PTC Technical Support if you need immediate help and solution for this issue.

Or you could go through the below given technical articles and try the suggestsions.

https://www.ptc.com/appserver/cs/view/solution.jsp?n=CS59132

https://www.ptc.com/appserver/cs/view/solution.jsp?n=CS46034

https://www.ptc.com/appserver/cs/view/solution.jsp?n=CS129789

https://www.ptc.com/appserver/cs/view/solution.jsp?n=CS53658

https://www.ptc.com/appserver/cs/view/solution.jsp?n=CS82236

Thanks,

Seshu

Re: Setting Up VB API

Thanx a lot for ur help

one error is comming the error is

errorPTC.jpg

Below is my code wich gives this error why?????????? Please

Dim asyncConnection As IpfcAsyncConnection = Nothing

Dim cAC As CCpfcAsyncConnection

Dim session As IpfcBaseSession

Try

'======================================================================

'First Argument : The path to the Pro/E executable along with command

'line options. -i and -g flags make Pro/ENGINEER run in non-graphic,

'non-interactive mode

'Second Argument: String path to menu and message files.

'======================================================================

cAC = New CCpfcAsyncConnection

asyncConnection = cAC.Start("D:\Program Files\proeWildfire 4.0\bin\proe.exe" + " -g:no_graphics-i:rpc_input", ".")

'asyncConnection = (New CCpfcAsyncConnection).Start("D:\Program Files\proeWildfire 5.0\bin\proe.exe", "D:\Program Files\Wrkdir\txt")

'asyncConnection = cAC.Start("D:\Program Files\proeWildfire 5.0\bin\proe.exe" + "", ".")

session = asyncConnection.Session

'======================================================================

'Set working directory

'======================================================================

asyncConnection.Session.ChangeDirectory("D:\ProEExample")

'======================================================================

'VB api process calls and other processing to be done

'======================================================================

Dim descModel As IpfcModelDescriptor

Dim model As IpfcModel

descModel = (New CCpfcModelDescriptor).Create(EpfcModelType.EpfcMDL_PART, "prt0001.prt", Nothing)

model = session.OpenFile(descModel)

Catch ex As Exception

MsgBox(ex.Message.ToString + Chr(13) + ex.StackTrace.ToString)

Finally

End Try

Highlighted

Re: Setting Up VB API

hello Mr Seshu,

Can you help me how to get excel values in the current model. and how to regerate the model. I am so many time but the values are not set please give a sample program or procedure to help me. please help me Can you give your Number I need your help. Plz Help me

Re: Setting Up VB API

Please try searching in our online Knowledge Base. You should find good number of example codes for Creo VBA excel example codes.

Thanks,

Seshu

Re: Setting Up VB API

Hello,

could you please help me out.

I am using Creo/Elements Pro M210 without Pro/Toolkit license and want to use VB API.

PRO_COMM_MSG.EXE and PFCLSCOM.EXE are running fine.

When I try to connect to the session with:

Dim asyncConnection As IpfcAsyncConnection =Nothing

asyncConnection = (New CCpfcAsyncConnection).Connect(Nothing, Nothing, Nothing, Nothing)

I get following exception: XToolkitNeedsUnlock

Was there any change in the WF5 because I thought that VB API can be used without any license.

Again Pro/Toolkit license is not available.

Appreciate any help. Thanks

Re: Setting Up VB API

Hi Sven,

This is a known issue already reported and fixed. Please see SPR 2205159 and technical Article CS153281

This issue is corrected in M220 date code which will be available for download on 31-Jan-2014. You may switch to M200 date code OR contact PTC Technical Support to have the pfclscom.exe unlocked.

Thanks,

Seshu Kumar