SMARTAnnotate provided Batch Process
SMARTAnnotate provides an asynchronous Creo Toolkit application, that simplifies to set up a Creo session that executes SMARTAnnotate functions as a batch process. The application
  • Accepts a input file that specifies which actions have to be applied to which models.
  • Starts the Creo session (either in graphics or no-graphics mode).
  • Loads and starts the SMARTAnnotate auxiliary application.
  • Optional: Registers and activates a Windchill server including authentication via provided credentials.
  • Retrieves and displays the job models into session either
    • from common space into a pre-existing workspace or
    • from a local directory.
  • Performs all tasks for all models (jobs) defined via input file.
  • Shuts batch session down
    • Erase retrieved models from session.
    • Unregister the Windchill server.
    • Unload the SMARTAnnotate auxiliary application.
    • Terminate the Creo session.
Invoking the batch run
The folder x86e_win64 within the SMARTAnnotate installation directory, contains the asynchronous Toolkit application as binary file san_api.exe. This file can be used to invoke the batch run via command line call. For instance, this can be done using a batch file (*.bat). The call takes one input parameter, which is the file path to the so called “Jobs-File” (for more details see section Jobs-File).

This call of the API binary file will start the batch run:
<SmartAnnotate Installation directory>\x86e_win64\san_api.exe <Any accessible path>\san_jobs.xml
Jobs-File
The ”Jobs-File” is to be created as XML and defines which model(s) shall be processed and which tasks are to be performed for each of them. This file has to be created at runtime by the calling application, for instance a Windchill worker. The following elements and attributes are supported:
  • <?xml>: The declaration element of the XML file has two attributes:
    • version (attribute): Use the value “1.0” for this attribute.
    • encoding (attribute): Use the value “UTF-8” for this attribute. In general, the file should be encoded in UTF-8 to avoid errors, which might be caused by non-ascii characters.
  • <batch_process>: Root element of the XML file. This element may contain one <session> element, one <server> element, one <application> element and an arbitrary number of <job> elements.
  • <session>: Information required for the batch process to start an asynchronous Creo Parametric session.
    • <creo_exec_path>: Path to the executable (parametric.exe) or batch file (parametric.bat), which shall be used to start the Creo process. These files are located within the Creo installation folder under ”<Creo Install Dir>\Parametric\bin”.
    • <creo_start_path>: The start directory path for the Creo Parametric process. This folder might contain configuration files like the file config.pro. If the batch process is not intended to connect to a Windchill server, the models to be processed should be contained within this folder. Alternatively, the config.pro defines other folders via the option search_path, where Creo will look for models.
    • <no_graphics_mode>: Possible values “true” or “false”. Using “true”, the batch process will append the arguments ”-g:no_graphics -i:rpc_input” to the file path defined under <creo_exec_path>. This will start a Creo Parametric session in non graphics mode. The value “false” will use the <creo_exec_path> as it is.
  • <server>: Information required to register, activate and connect the session to an existing Windchill server.
    • <name>: Server name (alias).
    • <location>: Server URL (address).
    • <workspace>: Name of the pre-existing workspace to use.
    • <user_name>: User login for the authentication.
    • <password>: Password for the authentication.
  • <application>: Paths required to load the SMARTAnnotate application within the Creo Parametric session.
    • <appl_exec_path>: File path to SmartAnnotate.dll, which is stored within the folder “x86e_win64” of the SMARTAnnotate installation.
    • <appl_text_path>: Directory path to the SMARTAnnotate installation folder, which contains the folder “text”.
  • <job>: A job-element always relates to one model. If, for instance, five different models shall be processed, five job-elements are required within the XML file. This element type has two mandatory attributes and contains at least one “task”-element.
    • model_name (attribute): Name of the model to be processed without the file extension. E.g. for the drawing ”demo_drawing.drw” the value ”demo_drawing” has to be specified for this attribute.
    • model_type (attribute): This attribute defines the type of the model to be processed. Specify “DRW” for drawings, “PRT” for parts and “ASM” for assemblies.
  • <task>: A task-element calls one designated method to be performed for the job model. This element type has one attribute (“function_name”) and may contain a variable number of child elements. The amount and types of these child elements are dependent of the called method. For instance, such a child element may define the output path for a PDF file to be created.
    • function_name (attribute): Name of the task. See section API Function Overview for a complete list of supported tasks.
Example
The following shows an example for a Jobs-file which translates a drawing using English (usascii) as primary language and German as secondary language. After translation the drawing is exported to the formats PDF, Creo View and TIF giving the output file paths.
<?xml version="1.0" encoding="UTF-8"?>
<batch_process>
	<session>
		<creo_exec_path>C:\Creo 4.0\M100\Parametric\bin\parametric.bat</creo_exec_path>
		<creo_start_path>C:\temp\batch_start_dir</creo_start_path>
		<no_graphics_mode>true</no_graphics_mode>	
	</session>
	<server>
		<name>Windchill</name>
		<location>https://wf.company.com/Windchill</location>
		<workspace>my_workspace</workspace>
		<user_name>root</user_name>
		<password>1234</password>	
	</server>
	<application>
		<appl_exec_path>C:\SMARTAnnotate\x86e_win64\SmartAnnotate.dll</appl_exec_path>
		<appl_text_path>C:\SMARTAnnotate</appl_text_path>
	</application>
 	<job model_name="demo_drawing" model_type="DRW">
		<task function_name="SANTranslateModel">
			<languages>usascii;german</languages>
		</task>
		<task function_name="SANCreatePDF">
			<output_path>C:\temp\my_created_file.pdf</output_path>
			<orientation>landscape</orientation>
			<paper_size>A3</paper_size>
			<resolution>300</resolution>
		</task>
		<task function_name="SANCreatePVZ">
			<output_path>C:\temp\my_created_file.pvz</output_path>
		</task>
		<task function_name="SANCreateTIF">
			<output_path>C:\temp\my_created_file.tif</output_path>
		</task>
	</job>
</batch_process>