Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hi everyone,
I have successfully developed a jlink Async app for CREO, and it is working perfect. What I need is that whenever I start CREO Parametric the app should be started too. Currently, I need to run the app through Netbeans, and then CREO is started via the code.
So, is there any way I can register the async app globally so whenever CREO is started, my app is started along.
Please respond!
Thanks
Solved! Go to Solution.
Thank you everyone, your help directed me to optimum solution.
For starting my app I used "Parametric Start File" parametric.psf, placed this command at the end of file:
RUN="NameOfJarFile.jar"
Where jar file was placed in same folder as psf file.
For my other problem with connection, @sjuraj I used the connect method instead of start
pfcAsyncConnection.AsyncConnection_Connect(null, null, proETextPath, 1000);
connection = pfcAsyncConnection.AsyncConnection_GetActiveConnection();
Now it's all sorted out, thanks again!
You can create simple synchronou app which starts your async app or use os script in mapkey to start it. I suppose os script can be run in trail file as well. A trail file can be passed to creo as parameter while starting.
@sjuraj Thanks for quick response, and yes I get your idea, now the problem is I start CREO from code, so I assume this will start another instance of CREO, here is the code
connection = pfcAsyncConnection.AsyncConnection_Start(proECommand, proETextPath);
connection.AddActionListener((AsyncActionListener) this);
curSession = connection.GetSession();
createMenuButtons();
Is there anyway I can connect to already opened CREO, so my ultimate goal would be,
User starts CREO from where ever, my async app is started along, and app connects to CREO. I hope that makes sense.
Thanks
I really have no clue about your intention, just modify the psf file to start your Script, this will connect to the first session and later starts the second Session, or vice versa. It may required to make the session ID public, dependent on the order, not sure if the connect is smart enough to ignore his parent. I think you have to deal with this two handles. You may have fun with dead locks 😀, and you have 2 event loops.
from documentation:
AsyncConnection_ConnectById |
---|
static AsyncConnection | AsyncConnection_ConnectById | (ConnectionId Id, /*optional*/ String TextPath, /*optional*/ Integer TimeoutSec) |
Connects to a specific Creo Parametric session by passing the identification string. The ID string for a given session can be obtained from AsyncConnection.GetConnectionId(). The application may only connect to one Creo Parametric session at any time.
|
Connection ID can be extracted from Session object: BaseSession.GetConnectionId ()
You need to develop synchronous app. The app will be started with Creo. You can register the app in Creo using protk.dat file.
Thank you everyone, your help directed me to optimum solution.
For starting my app I used "Parametric Start File" parametric.psf, placed this command at the end of file:
RUN="NameOfJarFile.jar"
Where jar file was placed in same folder as psf file.
For my other problem with connection, @sjuraj I used the connect method instead of start
pfcAsyncConnection.AsyncConnection_Connect(null, null, proETextPath, 1000);
connection = pfcAsyncConnection.AsyncConnection_GetActiveConnection();
Now it's all sorted out, thanks again!