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,
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,