Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
Hi all,
My experience in java and J-Link are VERY low, and that's not really my daily business.
I think that can not be a big issue. hopefully someone can help me.
I need a program that starts with creo4 (protk.dat) and wait until the drawing is loaded. after that a mapkey should run.
the drawing will be loaded with the Creo start command (not with J-Link).
I found something that could maybe help:
OnAfterModelRetrieve and then macrostring = "~ Activate `main_dlg_cur`;%myMapkey;";
hopefully someone can help me.
Thanks and best Regards
Daniel
Solved! Go to Solution.
I got it. I was struggling because in the workflow has something changed.
in earlier releases the application was loaded direct after Creo start, but when starting Creo with a filename like:
"C:\ptc\creo4\Creo 4.0\M010\Parametric\bin\parametric.exe" "C:\ptc\creo4\Creo 4.0\M010\Parametric\bin\parametric.psf" mydrawing.drw
the jlink application is started after the model is retrieved... and in this case i do not need a listener who is waiting for the drawing retrieved or displayed..
here my code:
public class JlinkAPP {
static int done = 0;
public static void start() {
try {
Logger.write("Application started.");
String macrostring;
Session s = pfcGlobal.GetProESession();
Logger.write("session id : " + s);
macrostring = "~ Activate `main_dlg_cur`;%mymapkey;";
Logger.write(" *** RUN macrostring ***= " + macrostring);
JlinkAPP.done = JlinkAPP.done + 1;
if (JlinkAPP.done == 1) {
s.RunMacro(macrostring);
}
} catch (Exception x) {
Logger.write("Exception start : " + x);
Logger.write("Exception mapkey: " + x);
StackTraceElement[] st = x.getStackTrace();
for (int i = 0; i < st.length; i++) {
Logger.write(st[i].toString());
}
}
}
public static void stop() {
Logger.write("Application stoped.");
}
}
This is quite big issue if your skills in java and j-link are low. I suggest you to learn basics of java oop and basic of j-link. There are lot of tutorials for java on the internet. Pdf guide to j-link is located in creo common files in jlink directory.
Hi Juraj,
Thank you for your reply, I know that's a big thing for someone who has no skills. and i know there are a lot tutorials in the internet.
And you are right, I could learn basics of java and j-link. but that was not the question and i do not have the time for that
The question is, can someone help ore write that tool? or maybe someone has something similar?
Thanks and best regards
Daniel
I got it. I was struggling because in the workflow has something changed.
in earlier releases the application was loaded direct after Creo start, but when starting Creo with a filename like:
"C:\ptc\creo4\Creo 4.0\M010\Parametric\bin\parametric.exe" "C:\ptc\creo4\Creo 4.0\M010\Parametric\bin\parametric.psf" mydrawing.drw
the jlink application is started after the model is retrieved... and in this case i do not need a listener who is waiting for the drawing retrieved or displayed..
here my code:
public class JlinkAPP {
static int done = 0;
public static void start() {
try {
Logger.write("Application started.");
String macrostring;
Session s = pfcGlobal.GetProESession();
Logger.write("session id : " + s);
macrostring = "~ Activate `main_dlg_cur`;%mymapkey;";
Logger.write(" *** RUN macrostring ***= " + macrostring);
JlinkAPP.done = JlinkAPP.done + 1;
if (JlinkAPP.done == 1) {
s.RunMacro(macrostring);
}
} catch (Exception x) {
Logger.write("Exception start : " + x);
Logger.write("Exception mapkey: " + x);
StackTraceElement[] st = x.getStackTrace();
for (int i = 0; i < st.length; i++) {
Logger.write(st[i].toString());
}
}
}
public static void stop() {
Logger.write("Application stoped.");
}
}
Hi,
if I were you I would probably solve the procedure (i.e. open drawing & run mapkey) using trail file.
MH
Hi Martin,
shure, but this runns on nongraphics mode
Have a good time
Daniel