Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
Hello everyone! My company uses Creo 7.0.9. I am utilizing J-Link (Java Object Toolkit free) to create some programs to automate some repetitive tasks. I need your help in automating the running of predefined FEA simulations, or at least fixing my code so far...
_______________________________________________________________________________________________
Problem Background / Goal:
One of the features I want to have in my J-Link programs is the ability to rerun predefined simulations from code... meaning I as the engineer set up everything from conditions to loads, and get the simulation all ready to go, and my J-Link application really just has to hit the run button. The use case here is: I have other already functioning j-link code to change parameters of loads, so the idea is in the future, I can have some automated way of testing 15 different loads, running the FEA each time, saving results, and maybe even making me a graphic or something like that...
____________________________________________________________________________________________
Efforts so far:
I have attempted a few ways to do this.
1. I successfully created a map key that opens the simulate environment, opens the analysis and design study window and clicks run. This works perfectly. When I am in creo. I just hit F2, and then my simulation runs... I then attempted to use J-Link to run the mapkey, but Jlink does not do this. There are no errors no crashes, and nothing in the Trail.txt file, but also nothing happens when I run the program. I have attached code and my config.pro file with the mapkey below in case you want to see... Eventually I gave up on this.
2. I attempted directly running each of the macros contained within the mapkey file in JLink using session.RunMacro("MACRO TEXT HERE") and session.ExecuteMacro(). This ended up working (sort of)... I was able to run the first few macros to open up the simulation environment and to open the analysis and design studies window, but after that it just stops. Regardless of what windows I activate or what I try to do, it refuses to actually run the FEA. I basically want the program to hit the green flag button, but it will not.
3. I have tried to find a way to do this natively through the creo API, but so far I have not found anything promising. I tried to use pushbutton to simulate a button click, but I just get a bunch of errors. I am pretty sure the API isn't designed for me to use this to simulate clicking the run button, but correct me if there is a good way to do this...
_________________________________________________________________________________________________
What I am looking to hear from you
1. does anyone know if this is even allowed/possible? The thought occurred to me that perhaps this is intentionally blocked with J-Link and only possible with the full OTK. Do I need to buy something, so this gets enabled?
2. Is this some sort of permissions issue? Is the program not allowed to run simulations?
3. Is there any obvious error in my code? Do you have any fixes or suggestions for me?
4. Is there another/better way to do this?
I would greatly appreciate any concrete sample code you can provide to help me solve this issue.
_________________________________________________________________________________________________
config.pro file containing Mapkey for running my FEA
mapkey $F2 @MAPKEY_NAMEEnable Jlink to automate running FEA studies;\
mapkey(continued) @MAPKEY_LABELLinkRunFEA;\
mapkey(continued) ~ Activate `main_dlg_cur` `page_Applications_control_btn` 1;\
mapkey(continued) ~ Command `ProCmdAppMechanica` 1;~ Command `ProCmdSimMechSol` ;\
mapkey(continued) ~ Activate `run` `RunToolBtn`;~ Activate `UI Message Dialog` `yes`;\
mapkey(continued) ~ Activate `UI Message Dialog` `no`;~ Activate `run` `ClosePush`;\
mapkey(continued) ~ Command `ProCmdAppMechanicaExit`;
__________________________________________________________________________________________________
An attempt to run the FEA using directly(note: I have tried adding 5 second delays between all macros just to give creo a moment to enter the simulate environment properly before spamming another macro through J-Link, but it did not make a difference).
method call:
Solved! Go to Solution.
Hi
First and foremost here is the state of the art from the Java Object Toolkit documentation :
Accessing Creo Simulate is indeed not part of Creo Java Object Toolkit Free functionalities
From Creo Toolkit (C langage) though some entery points are granted according to the documentation :
But from a glance, the functions enable mainly to interrogate the environnement (get) and set some bits and pieces here and there.
No signs of a "ProRunAnalysis()" function though.
After reviewing a few articles in our knowledge base and some cases (internal information), the closest case that could address your requirement would be to use dbatch.
I'm personally not a fan of that tool but you can see if for yourself with this extensive reference document : https://www.ptc.com/en/support/article/CS139340
Pay specifically attention to the "known limitations" section.
To end on this message, I, too, recommend the creation of a custom script-based tooling alternative.
In a nutshell, use trail files instead of mapkeys and rely on scripts.
Hi
First and foremost here is the state of the art from the Java Object Toolkit documentation :
Accessing Creo Simulate is indeed not part of Creo Java Object Toolkit Free functionalities
From Creo Toolkit (C langage) though some entery points are granted according to the documentation :
But from a glance, the functions enable mainly to interrogate the environnement (get) and set some bits and pieces here and there.
No signs of a "ProRunAnalysis()" function though.
After reviewing a few articles in our knowledge base and some cases (internal information), the closest case that could address your requirement would be to use dbatch.
I'm personally not a fan of that tool but you can see if for yourself with this extensive reference document : https://www.ptc.com/en/support/article/CS139340
Pay specifically attention to the "known limitations" section.
To end on this message, I, too, recommend the creation of a custom script-based tooling alternative.
In a nutshell, use trail files instead of mapkeys and rely on scripts.