Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X
Hi,
I want to verify the family table in the existing part file using VB.NET. Because of some values are updated even if i use regenerate process table not verified.
Please help me if you anyone know the process / idea.
Balaji.S
I think it's not possible to verify it through toolkit or VB.Net...You just can get status of instances of family table.
Ketan,
is it possible to run mapkey, which verifies family table instances ?
Martin Hanak
Not sure...Need to create test plan properly...Simply verification using map key is working fine with below:
mapkey $F2 ~ Command `ProCmdMmFamTab`
mapkey(continued) ~ Activate `ftb_edit_table` `TBVerify`;~ Activate `mdlbrowser` `OK`;\
mapkey(continued) ~ Activate `mdlbrowser` `Cancel`;~ Activate `ftb_edit_table` `OK`;
Note: Family instance in test part on which I checked was having two features one is extrude and one is hole...In first instance, both were visible where as in second one, only extrude was visible.
Hi Martin,
I have tried using mapkey manually its working. But I want to do that action through coding process.
I am looking the pass mapkey value to creo using coding process.
Hi,
I am sorry I do not know how to launch mapkey from vb.net code. Maybe Ketan Lalcheta will help ?
Martin Hanak
Hi Ketan,
Thanks for your response.
Hi Ketan,
I want to launch mapkey from vb.net, already i created mapkey and configured with name of ftv in the existing part file.
Now i want to run that ftv command through coding(vb.net).
Please help me.
Hi,
Use this VBAPI "RunMacro" and provide the string of your macro as argument.. RunMacro API is accessible on object of Basesession.
Hi Ketan,
Thank you for your idea / comments. I will check with that option and will let you know if any issue.
Thnks,
Balaji.S
Hi ketan,
Good morning...
I tried the below coding for family table verification process as your suggestion option, its not working, I dn’t know where I done mistake in my coding part.
Already I created mapkey in config file with corresponding model file, now I want to run that command of “ftv” through coding.
Please help me where I done mistake
Dim asyncConnection As IpfcAsyncConnection = Nothing
Dim cAC As CCpfcAsyncConnection
Dim session As IpfcBaseSession
Dim descModel As IpfcModelDescriptor
Dim options As IpfcRetrieveModelOptions
Dim model As pfcls.IpfcModel
Dim bssn As pfcls.IpfcBaseSession
Try
cAC = New CCpfcAsyncConnection
'asyncConnection = cAC.Connect(DBNull.Value, DBNull.Value, DBNull.Value, DBNull.Value)
asyncConnection = cAC.Start(exePath + " -g:no_graphics-i:rpc_input", workDir)
session = asyncConnection.Session
session.LoadConfigFile("C:\Users\Public\Documents\config.pro")
Dim LmodDoc As IpfcModel = retrieveModelFromStdDir(session, EpfcModelType.EpfcMDL_PART, parttwofile)
If Not LmodDoc Is Nothing Then
LmodDoc.Display()
session.CurrentWindow.Activate()
........................
...........................
‘session.RunMacro("ftv family_table_ver;")
'bssn = session
'bssn.RunMacro("ftv family_table_ver;")
end if
Catch ex As Exception
MsgBox(ex.Message.ToString + Chr(13) + ex.StackTrace.ToString)
Finally
'MsgBox("Completed")
If Not asyncConnection Is Nothing AndAlso
asyncConnection.IsRunning Then
asyncConnection.End()
End If
End Try
Highlighted my coding part of family table verification part
Help me
Thnaks
Balaji.S
Hi,
Could you please let me know on which line you are getting error along with error?
Regards
Ketan
You can give a try to below snippet:
Public _objIpfcConnection As
IpfcAsyncConnection
Public ioIpfcBaseSession As
IpfcBaseSession
Dim objCCpfcConnection As New CCpfcAsyncConnection
Try
frmMain._objIpfcConnection =
objCCpfcConnection.Connect(Nothing, Nothing, Nothing, Nothing)
Catch
Try
frmMain._objIpfcConnection =
objCCpfcConnection.Connect(DBNull.Value, DBNull.Value, DBNull.Value,
DBNull.Value)
Catch
MessageBox.Show("GetSessionAndDWGModelHandler--->Failed to get
connection object")
Return False
End Try
End Try
Try
ioIpfcBaseSession = frmMain._objIpfcConnection.Session
Catch ex As Exception
MessageBox.Show("GetSessionAndDWGModelHandler--->Failed
to get base session object")
Return False
End Try
Try
ioIpfcBaseSession.EraseUndisplayedModels()
Catch ex As Exception
MessageBox.Show("GetSessionAndDWGModelHandler--->Failed to erase Undisplayed Models")
Return False
End Try
‘Below is the code to run macro
Hi ketan,
Below coding part run without any error, but family table not verified.
option 1
‘session.RunMacro("ftv family_table_ver;")
option 2
'bssn = session
'bssn.RunMacro("ftv family_table_ver;")
ftv - seq-name
family_table_ver - description
Hi,
Correct. Except run macro API in my code snippet, it was the part to get handle of bases session object.
Up to best of my knowledge, RunMacro is the API which will do same as what creo does once user Run mapkey manually.
What you need to do is as below:
Let me know your results.
Regards
Ketan
Hi ketan,
Thank you for your reply, i will check and let you.
Thnks
Balaji.S
Hi Ketan,
Thanks for timely help, runmacro proces working now. But i have one issue while verify the family table, after verify the family table each row verified and success.
But current window of verify and family table window not closed even if i use below code.
~ Activate `mdlbrowser` `Cancel`;~ Activate `ftb_edit_table` `OK`;
Thnks
Regards,
Balaji.S
Does the above mentioned map key line related to family table window close works in manually operation?
Regards
Ket
Hi Ketan,
YES,
Please check my coding process for FTV
bssn.RunMacro("ft @MAPKEY_LABELfaM;~ Command `ProCmdMmFamTab` ;")
bssn.RunMacro("~ Activate `ftb_edit_table` `TBVerify`;~ Activate `mdlbrowser` `OK`;")
bssn.RunMacro("~ Activate `mdlbrowser` `Cancel`;~ Activate `ftb_edit_table` `OK`;")
Thread.Sleep(1000)
bssn.RunMacro("~ Activate `mdlbrowser` `OK`;")
bssn.RunMacro("~ Activate `mdlbrowser` `Cancel`;")
bssn.RunMacro("~ Activate `ftb_edit_table` `OK`;")
Family table verified and success, but both window not closed after run the macro. Please check attached image after run macro.
Thnks,
Regards,
Balaji.S
This Seems okay..Could you please share your code and test part with me ?
Hi ketan,
Sorry, I don't have writes to copy that file from server because of its not test file, exe running in the server with special user login. If i try to copy or move, our IT person will check.
I will try to get that file.
Thnks,
Regards,
Balaji.S
Hi Ketan,
If i give sleep(1000) time-interval between each macro line process, now its working both window closed.
I dn't know its correct or wrong method.
Please advice.
Thnks
Regards,
Balaji.S
Hi,
It's difficult to do analysis without test part. I am not sure whether below function is useful to you or not:
Function VerifyInstanceCurModel()
Dim objCCpfcConnection As New CCpfcAsyncConnection
Try
Nothing, Nothing, Nothing, Nothing)
Catch
Try
DBNull.Value, DBNull.Value, DBNull.Value, DBNull.Value)
Catch
MessageBox.Show("GetSessionAndDWGModelHandler--->Failed to get connection object")
Return False
End Try
End Try
Try
Catch ex As Exception
MessageBox.Show("GetSessionAndDWGModelHandler--->Failed to get base session object")
Return False
End Try
Try
Catch ex As Exception
MessageBox.Show("GetSessionAndDWGModelHandler--->Failed to erase Undisplayed Models")
Return False
End Try
Try
Catch ex As Exception
MessageBox.Show("GetSessionAndDWGModelHandler--->Failed to Get active model")
Return False
End Try
"~ Activate `main_dlg_cur` `page_Tools_control_btn` 1; ~ Command `ProCmdMmFamTab` ;~ Activate `ftb_edit_table` `TBVerify`; ~ Activate `mdlbrowser` `OK`;~ Activate `mdlbrowser` `OK`; ~ Activate `mdlbrowser` `Cancel`;~ Activate `ftb_edit_table` `OK`;")
Return True
End Function
Just call this function and you should be able to verify the family table.
Regards
Ket
I tested the function on attached test part and it worked:
- Open part1's generic model
- Run code
- You will be able to see that active tab on Menu bar changes from Model to Tool
Thanks and Regards
Ket
Hi Ketan,
Sorry ketan don’t mistake me, I don’t have the test file and working with server file. So couldn’t send to you and I couldn’t copy that file also.
I will check with your macro, part file and let you the status.
Thnks
Regards,
Balaji.S
No problem.. It's fine if my macro runs on your test parts also.. If not, next level of analysis will not be possible from my side. Last code snippet I sent, One issue is there in copy paste.
replace
"~ Activate `main_dlg_cur` `page_Tools_control_btn` 1; ~ Command `ProCmdMmFamTab` ;~ Activate `ftb_edit_table` `TBVerify`; ~ Activate `mdlbrowser` `OK`;~ Activate `mdlbrowser` `OK`; ~ Activate `mdlbrowser` `Cancel`;~ Activate `ftb_edit_table` `OK`;")
with
ioIpfcBaseSession.RunMacro("~ Activate `main_dlg_cur` `page_Tools_control_btn` 1; ~ Command `ProCmdMmFamTab` ;~ Activate `ftb_edit_table` `TBVerify`; ~ Activate `mdlbrowser` `OK`;~ Activate `mdlbrowser` `OK`; ~ Activate `mdlbrowser` `Cancel`;~ Activate `ftb_edit_table` `OK`;")
in function...
Hope this function solves your problem...Let me know your test results.
Regards
Ketan
Hi Ketan,
Thank you for your support.
Verify window close problem solved and working.
Thnks,
Regards,
Balaji.S
balaji somasundaram, Good to know that it's solved.. Mark this answer as correct answer !!!
Hi Ketan,
YES.....
Can i share my doubts / issues in the future, because i think i'm disturbed you lot in your precise time.
Thanks lot for your support
Regards,
Balaji.S
I am not sure how fast I will be able to respond you in future... But, definitely, you can share your doubts...