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
Highlighted
Newbie

Setting Up VB API

All,

I am attempting to setup/install the VB API component for Wildfire 5.0 on an XP machine.

  1. I set PRO_COMM_MSG_EXE to the pro_install\i486_nt\obj\pro_comm_msg.exe
  2. I ran ptcsetup.bat and installed the VB API
  3. I ran vb_api_register.bat, and am receiving the following error:
    1. "pro_install\i486_nt\obj\pfclscom.exe" is not recognized... yada yada translation it's not there. In fact, it is nowhere on my machine.

Any ideas?

Thanks in advance,

Matt Wright

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Setting Up VB API

Hi Matt,

It cannot happen that a "vb_api_register.bat" exist in the bin folder and the pfclscom.exe is missing. This clearly tells me that the installion was incomplete.

So, could you please try reinstalling the product with Vb API component selected? This should fix your problem.

Thanks,

Seshu Kumar

Principal Engineer

Technical Support.

View solution in original post

28 REPLIES 28

Re: Setting Up VB API

Matt,

Did you ever figure this out? I am seeing the same problem on my computers.

Thanks,

Mark Bohannon

Re: Setting Up VB API

Hi Matt,

It cannot happen that a "vb_api_register.bat" exist in the bin folder and the pfclscom.exe is missing. This clearly tells me that the installion was incomplete.

So, could you please try reinstalling the product with Vb API component selected? This should fix your problem.

Thanks,

Seshu Kumar

Principal Engineer

Technical Support.

View solution in original post

Re: Setting Up VB API

Hello Mr Seshu,

i have written this code but i am not connect with vb to proe and not opening the model through vb.net what chan I do Plz help me i had written this code

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

'Dim componentFeat As pfcls.IpfcComponentFeat

'MsgBox("Feature number: " & componentFeat.Number)

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", ".")

session = asyncConnection.Session

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

Dim descModel As IpfcModelDescriptor

Dim model As IpfcModel

descModel = (New CCpfcModelDescriptor).Create(EpfcModelType.EpfcMDL_PART, "D:\ProEExample\test.prt", Nothing)

model = session.RetrieveModel(descModel)

Catch ex As Exception

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

Finally

If Not asyncConnection Is Nothing AndAlso asyncConnection.IsRunning Then

asyncConnection.End()

End If

End Try

End Sub

Re: Setting Up VB API

Hi Mohit,

To have a successful connection with Proe, you need to set PRO_COMM_MSG_EXE environment variable with correct path. Below is the documentation excerpt from VB API documenation. Please refer to this topic on how to set this environment variable. If you have a PTC.com user account, you could find technical articles on this in our Knowledge base. Try this and let me know.

Also, one should pass only the model name without the extension or path to (New CCpfcModelDescriptor).Create() function (second argument). The size limit for this string is 40 (39 + end of line).

Thanks,

Seshu

Setting Up a VB Application

For your application to communicate with Creo Elements/Pro, you must set the PRO_COMM_MSG_EXE environment variable to the full path of the executable, pro_comm_msg.exe. Typically, the path to the executable is [creo_loadpoint]/[machine type]/obj/pro_comm_msg.exe, where machine type is i486_nt for 32-bit Windows and x86e_win64 for 64-bit Windows installations.

Set PRO_COMM_MSG_EXE as:

    1. Click Start > Settings > Control Panel
    1. Click System. The System Properties windows opens.
    2. In the Advanced tab, click the Environment Variables button.
    3. Add PRO_COMM_MSG_EXE to System variables.

Registering the COM Server

To register the COM server, run the vb_api_register.bat file located at [creo_loadpoint]/bin.

To unregister the COM server, run the vb_api_unregister.bat file located at [creo_loadpoint]/bin.

After the COM server is registered with the system, whenever an application tries to access the types contained in this server the server starts automatically. By default, Windows starts services such as pfclscom.exe in the Windows system directory (c:\winnt\system_32). Because the server will also start new sessions of Creo Elements/Pro from the process working directory, you may want to control the server run directory. You can configure the server to start in a specific directory by setting the system environment variable PFCLS_START_DIR to any existing directory on your computer.

Re: Setting Up VB API

Hi Seshu,

Good morning, thanx for your quick reply... I have registered vb_api and setting environment variable my program is running fine but model is not openining only PROE wildfire 4.0 working area is open. Here is my code?? Please help me.. Below is my code......

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", ".")

session = asyncConnection.Session

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

'Set working directory

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

asyncConnection.Session.ChangeDirectory("D:\Program Files\proeWildfire 4.0\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.RetrieveModel(descModel)

Catch ex As Exception

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

Finally

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

'End the Pro/ENGINEER session when done

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

'If Not asyncConnection Is Nothing AndAlso asyncConnection.IsRunning Then

' asyncConnection.End()

' End If

End Try

Re: Setting Up VB API

Hi Mohit,

Do any of the existing functions throw any exceptions? if yes, please let me know which function and what exception. If none of the functions are throwing exception, then it meanse that the model is successfully retrieved. However, you won't be able to see it because you are not displying the model by calling model.Display(). RetrieveModel() function just retrieves the object in to Pro/ENGINEER Session. But, will not display it in the graphics window. One need to call Diaplay() function to be able to see the model.

Also, you are running Pro/ENGINEER in no graphics mode. if you remove the additional string + " -g:no_graphics-i:rpc_input" that is being passed to the Pro/ENGINEER Start command, then you should see Pro/E lanuching and the model would be displayed in the graphics window.

Thanks,

Seshu

Re: Setting Up VB API

Hello Seshu,

Thank you for providing clear step-to-step instruction for starting the VB API. My question is:

I have setup the environment variable but do not find the vb_api_register.bat.. Do I need to re-install Creo?

Thank you in advance!

Re: Setting Up VB API

Hi Heidi,

If your <Creo Load Point>\Parametric\bin folder does not contain the "vb_api_register.bat" file, it means that either you did not chose to install the VB API customization files Or the installation is incomplete. So, I would suggest a re-install.

Thanks,

Seshu

Re: Setting Up VB API

Thank you Seshu, I got it to work