Skip to main content
7-Bedrock
January 31, 2018
Solved

How to start a batch with toolkit

  • January 31, 2018
  • 1 reply
  • 7911 views

Hello,

I'm trying to write the application which reads some informations from asm/prt files in a directory and writes them into xml files.

What I can do now is to create an exe-file in VS2012, a prodev.dat and a rbn-file (just did according to the document "Getting Started with Creo Object TOOLKIT C++ 3.0").

If I start creo 3 from the folder containing prodev.dat, then I see the button in the OTK group and can run the application.

 

My Question is, how can I start my application without GUI and the button is automatically pushed (means, my application is automatically executed)?

 

Thank you in advance

Xinyu

Best answer by sully7

Aaaah okay - sorry, I forgot one additional requirement during my original post. Your additional arguments also need to be prefixed with a "+" or a "-".  (I'll go back and edit the post to include that)

 

The documentation states (page 63-ish of the ProToolkit user guide):

The first command-line argument passed to Creo Parametric TOOLKIT is the
same one seen by Creo Parametric; that is, it is the name of the Creo Parametric
executable. The remaining command-line arguments passed to user_
initialize() are a subset of those given on the command line that invoked
Creo Parametric. The rule is that Creo Parametric passes on to user_
initialize() any command-line argument that starts with a “+”, or with a “-”
followed by an upper-case character.
For example, these command-line arguments will be passed to Creo Parametric
TOOLKIT:
+batch=mybatchfile.txt
-Level=expert

Give that a try - it should work just fine 🙂

 

Thanks, 

James Sullivan

1 reply

14-Alexandrite
January 31, 2018

You'll need to use the windows command prompt to start Creo. You can do this by navigating to the folder for your working directory, opening a command prompt, and running the following command line: 

 

In this example, I have set my creo install path as a windows environment variable, so that I can quickly replace the command for different versions of Creo, etc.

 

call "%CREO_INSTALL_PATH%\Parametric\bin\parametric.exe" -g:no_graphics -batch_mode -i:rpc_input 

 

From there, if you pass OTHER arguments after the last one, they will be also passed into your Toolkit application's "user_initialize" function. Aka, if you use 

 

call "%CREO_INSTALL_PATH%\Parametric\bin\parametric.exe" -g:no_graphics -batch_mode -i:rpc_input -RUN_MY_DESIRED_APPLICATOIN

 

Then you should see a command line pop up, it should load Creo in non-graphical mode, load your toolkit application, and pass the argument "-RUN_MY_DESIRED_APPLICATION" in as one of the values in your "argv" array. 

 

You would then basically write code into your "user_initalize" to look for those arguments, and do the appropriate actions.

 

For more information, there is a section of the ProToolkit documentation called "Using Creo Parametric TOOLKIT to Make a Batch Creo Parametric Session" (located on Page 63-ish, depending on what version of the docs you are looking at). 

 

Hope this helps! Please don't hesitate to reach out if you have any issues.

 

Thanks, 

James Sullivan

james.sullivan@cadactive.com

eclaassen7-BedrockAuthor
7-Bedrock
February 1, 2018

Hi,

thank you for your reply.

It works almost... And I have some qustions:

1) The user_initialize takes always one argument "proe", whatever I write at end of the command line

2) "wSession->UICreateCommand" does not work as in example, I have to call my callback function directly. Is it OK or there is some replacement for it?

3) How to terminate the program? Now I have to close the console manually.

4) Where can I find the documentation you mentioned? Is it shipped with Creo/Toolkit or can I download it anywhere?

 

Thank you!

Xinyu

PS: I use Creo 3

eclaassen7-BedrockAuthor
7-Bedrock
February 2, 2018

Yes, it works!

Thank you!