Continue to Site

Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

interfacing of proengineer 4.0 with visual basic 6.0

shankar j

New member
Respected sir /mam,

I am facing start up directory error while interfacing proengineer from visual basic 6.0,

Here i am pasting code is having start up directory error while connecting from visual basic

Set cAC = New CCpfcAsyncConnection
Set asyncConnection = cAC.Start(txtExePath.Text, "d:\ptc_temp") '"d:\ptc_temp")
Set session = asyncConnection.session

This code i reffered from VB_API_User_Guide_06_2009 from ptc website


if any one have the solution ,please suggest the rightful path for proceeding my m.tech project to interface cad component from visual basic 6.0 to proengineer 4.0.

sincere regards,
J.Shankar
 
Try below code for replacing Set asyncConnection

asyncConnection = cAC.Start("C:\Program Files\proeWildfire 5.0\bin\proe.exe", "Working Directory")

in above line
C:\Program Files\proeWildfire 5.0\bin\proe.exe is the path where your proe.exe is placed
Working Directory replace it with your working directory path
 
based on vb code how can we create block from proe

Respected sir/mam,

Can u have the code for creating block in proe based on vb code,after entering to start page of proe
 
how to create line in proengineerusing visual basic

Respected sir/mam,


I am facing problem for entering into proe sketching environment while interfacing proengineer from visual basic 6.0,

Here i am pasting code ,based on this opening and closing can be done easily,how can we create line based on this code where we can add code for interact with sketch mode while connecting from visual basic

visual basic codes:

Dim asyncConnection As IpfcAsyncConnection
Dim cAC As CCpfcAsyncConnection
Dim session As IpfcBaseSession
Dim descModel As IpfcModelDescriptor
Dim descModelCreate As CCpfcModelDescriptor
Dim model As IpfcModel
Dim workDir As String
Dim asynconn As New pfcls.CCpfcAsyncConnection
Dim conn As pfcls.IpfcAsyncConnection
Dim oModel As pfcls.IpfcModel
Dim position As Integer


Dim new_paramowner As pfcls.IpfcParameterOwner

Private Sub Form_Load()btnRun_Click
End Sub
Private Sub btnRun_Click()

On Error GoTo RunError
'======================================================================
'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.
'======================================================================
Set cAC = New CCpfcAsyncConnection
Set asyncConnection = cAC.Start("D:\Program Files\proeWildfire 4.0\bin\proe.exe", "Working Directory")
MsgBox (asyncConnection.IsRunning)
Set session = asyncConnection.session
Set conn = asynconn.Connect("", "", ".", 5)
Set session = conn.session

'======================================================================
'Get current directory
'Set it as working directory
'======================================================================
workDir = " C:\Documents and Settings\Mech_Staff\My Documents\ptc_temp"
position = InStrRev(workDir, "\")
workDir = Left(workDir, position)
session.ChangeDirectory (workDir)

'Set oModel = session.CurrentModel
'MsgBox "Model name = " & oModel.FileName
'Set new_paramowner = oModel



'======================================================================
'VB api process calls and other processing to be done
'======================================================================
Set descModelCreate = New CCpfcModelDescriptor
Set descModel = descModelCreate.Create(EpfcModelType.EpfcMDL_PART, "partModel.prt", dbnull)
Set model = session.RetrieveModel(descModel)
'======================================================================
'End the Pro/E session when done
'======================================================================
If Not asyncConnection Is Nothing Then
If asyncConnection.IsRunning Then
asyncConnection.End
End If
End If
RunError:
If Err.Number <> 0 Then
MsgBox "Process Failed : Unknown error occured." + Chr(13) + _
"Error No: " + CStr(Err.Number) + Chr(13) + _
"Error: " + Err.Description, vbCritical, "Error"
If Not asyncConnection Is Nothing Then
If asyncConnection.IsRunning Then
asyncConnection.End
End If
End If
End If
End


End Sub



This code i reffered from VB_API_User_Guide_06_2009 from ptc website


if any one have the solution ,please suggest the rightful path for proceeding my m.tech project to interface cad component from visual basic 6.0 to proengineer 4.0.

sincere regards,
J.Shankar

Can u have the code for creating block or interacting with sketch mode in proe based on vb code,
 

Sponsor

Articles From 3DCAD World

Back
Top