Automation Tip
Batch Execution, File Conversion and Exports
Overview
Batch Processing is an essential component of any automation processes for Creo Parametric.

The concepts presented here are not specific to File Conversion/Export.

The same principles can be easily applied for data cleanup/synchronization, cost estimation, or dynamic configuration of product designs.

Below are the recommended Nitro-CELL functions general workflow that can produce amazing results very quickly.
Steps to Success
1
Identify what will be processed
Identify the types of information you want to process.
  • Assemblies - *.asm
  • Parts - *.prt
  • Drawings - *.drw
  • (any combination thereof - *.* wildcard for all files)
All of the APPLICATION_BATCH_LIST/GET functions support wildcards (*) for root file names and extensions.
2
Where is the data located and where does the data go?
Prerequisites:

  • Batch Worksheet - The list of Models/Drawings you want to process,
  • Execution Worksheet - The execution instructions to perform for each batch step.
Consider these functions based on your use case:

  • Active or In-Session:
    • APPLICATION BATCH_GET_FILES
    • APPLICATION BATCH_APPEND_GET_FILES
    • APPLICATION BATCH_LIST_INSTANCES
    • APPLICATION BATCH_LIST_SIMP_REPS
  • Local Working Directory / Search Path
    • APPLICATION BATCH_LIST_FILES
    • APPLICATION BATCH_APPEND_LIST_FILES
  • Windchill
    • APPLICATION BATCH_LIST_FILES
    • APPLICATION BATCH_APPEND_LIST_FILES
The information gathered from the above functions expect to be written to a Nitro-CELL BATCH Worksheet. There is no need to worry about the Worksheet Location for the Data to write with these calls, just the Worksheet Name where the batch list will be written.

PRO-TIP: If you want to batch process Assemblies first, then Parts, you would need two commands to populate the BATCH Worksheet in Excel.

For Example:
  1. APPLICATION BATCH_GET_FILES *.asm
  2. APPLICATION BATCH_APPEND_FILES *.prt
would clear the BATCH Worksheet, write any Assembly Model Names to the Batch, then APPEND the Part Model Names to the Batch (stacking the request results one after the other in Excel)
3
Start / Reset the Batch
If you specified that the Batch Worksheet should be included in the NItro-CELL_MAIN Workflow, every time you press the "Do It" Button, the Batch will be processed (unless excluded manually or by formula in Nitro-CELL_MAIN).

Otherwise, you can force a Batch process to be executed by another Nitro-CELL Worksheet (not the one that will be used to process operations on each file - but earlier in the overall automation). When executing in this way, use the following commands to control the workflow:

  • APPLICATION BATCH_START - to kick off the batch process
  • APPLICATION BATCH_RESET - to reset the start position to the top of the list

PRO-TIP: APPLICATION CLEAR_BATCHSHEET is not a commonly used function, but there are scenarios where your operation sequence may find use of this function.

4
Execution Errors - Skipping Batch Items
Sometimes a model or drawing you are trying to process in a batch may have an error in regeneration or export. By default Nitro-CELL will flag errors in light red on your Batch Worksheet indicating that the item was not processed - but will keep going until the batch ends.

If you detect an intermediate, during execution, problem in your data/expectations, you can stop continued execution on the batch step simply by using:

  • APPLICATION BATCH_SKIP

This will flag an item in your batch list as "skipped".

PRO-TIP: Consider using Nitro-CELL Worksheet Functions to append an log problems when you skip a batch. The following function is particularly handy for logging execution problems in Excel:

  • WORKSHEET APPEND_ROW
5
Converting / Exporting Files
While Batch Processing File Conversion/Export is the subject of this document, ANYTHING you want to do to a file that you are currently batching.

Each Batch Item is available at the top of the Batch Sheet Based on the index that is currently being processed within the Batch. This is determined by a formula in the Batch Sheet.

Simply reference the active model at the top of the batch sheet in your Execution sheet using:

  • MODEL OPEN <batchActiveModelRef>
This will ensure that all executions there after will be using the active model in Creo.

From that you can perform export functions in Nitro-CELL, look at the EXPORT_* functions as a reference for available options.

PRO-TIP: some export functions are not in Nitro-CELL functions, for special export options in Creo you can use a APPLICATION MAPKEY to process them. Search the Automation Advisor for "Mapkeys" to learn more.
6
DONE!