Distributed Pro/BATCH—Power for Free

 

Distributed Pro/BATCH Stand Alone, a new and improved version of the now-retired Pro/BATCH, made its debut in Wildfire 1.0 as a module of Pro/ENGINEER. This free product can be configured to perform a number of Pro/ENGINEER tasks and has direct access to Pro/INTRALINK 8.0 and PDMLink 8.0 workspaces.

The expanded functionality available in Distributed Pro/BATCH is quickly clear from the following comparison. Since Distributed Pro/BATCH is a relatively new product, its out-of-the-box capabilities will expand even more over the next few releases.

Figure 1. Comparison of Out-of-the-Box Capabilities

 

Distributed Pro/BATCH—

Networked Mode

In addition to the free Distributed Pro/BATCH Stand Alone package, PTC offers a product for purchase that is simply called Distributed Pro/BATCH. This version offers network capabilities and includes a Distributed Applications Framework (API), allowing companies to write their own distributed services to perform any desired task. Distributed Pro/BATCH can be used to drive third-party analysis software, other CAD systems, or anything that can be controlled from a C/C++ service application.

As many users know, configuring Pro/BATCH to perform certain operations was very challenging. The use case for this article therefore demonstrates how Distributed Pro/BATCH Stand Alone simplifies one such task—converting drawings to PDF format.

 

 

 

Stand-Alone Architecture

With the Stand Alone version of Distributed Pro/BATCH, all components must reside on the same computer (Fig. 2). While there is usually one client, multiple services can exist. The Distributed Services Manager Light (DSM Light) acts as a broker collecting client requests and ensuring services process those requests.

 

 

Figure 2. Distributed Pro/BATCH Stand Alone architecture.

 

  

Requirements

All Distributed Pro/BATCH versions reside on the Pro/ENGINEER installation CDs. Distributed Pro/BATCH Client, Distributed Services Manager Light, and the out-of-the-box Distributed Services are part of the Pro/ENGINEER installation, but they are not installed by default. Check the options for Distributed Pro/BATCH Stand-Alone and Pro/TOOLKIT when installing Pro/ENGINEER. The Distributed Services Manager, required for Distributed Pro/BATCH (networked mode), is a separate installation on the Pro/ENGINEER CDs.

 

Setup

1. Create a shortcut on the desktop and configure it as shown below (Fig. 3).

 

Figure 3. DCAD Setup Shortcut.

 

Some third-party applications, like Groove, use DCAD services by default. The command line option -force shuts down any running services before starting this service.

 You must execute this shortcut before starting Distributed Pro/BATCH Stand Alone. Once initialized, it continues to run until the computer is rebooted. For frequent use, schedule this shortcut to run at computer startup. 

2. The command to start the Distributed Pro/BATCH client is <Pro/ENGINEER load point>\bin\ptcdbatch.bat. This generates a std.out file, along with log files for each executed batch process. For this reason, starting this command from another directory (such as the Pro/ENGINEER startup directory) is recommended so the files don’t appear in the Pro/ENGINEER bin directory.

3. Create a shortcut for ptcdbatch.bat and place it on the desktop. Modify its “Start in” directory so it doesn’t write the temporary files into the Pro/ENGINEER bin directory. In this example, ptcdbatch Shortcut uses the Pro/ENGINEER startup working directory (Fig. 4).

 

 

 

Figure 4. ptcdbatch shortcut.

 

4. Manually execute the new shortcut to start the Distributed Pro/BATCH client interface (Fig. 5).

 

Figure 5. Distributed Pro/BATCH client user interface.

 

Note: The dialog box title is Distributed Pro/BATCH because both the networked and stand-alone versions use the same client software.

 

Use Case: Converting Pro/ENGINEER Drawings into PDFs

The following Distributed Pro/BATCH example uses the embedded PDF export functionality available in Wildfire 3.0 to convert Pro/ENGINEER drawings into PDF files. No external distiller is necessary. No plotter configuration or pen table file is used. Only a config.pro file may be used to automatically turn off datums, layers, etc.

 

1. Build Configuration Files

For this example, the config.pro file is stored in C:\dbatch\plot_configs. The directory structure is shown below. In a production environment, these folders could be anywhere.

 

2. Configure a Distributed Pro/BATCH Task

In the Distributed Pro/BATCH client, the first step to building tasks is setting the preferences. Select Edit > Preferences (Fig. 6). Globally applied preferences act as the default values for all batch processes. Each batch process can, however, override any or all global settings.

Figure 6. Preferences window.

 

Select Standalone from the “Default DSM” drop-down list. This will eliminate the network component from DSM and facilitate troubleshooting. 

Because the Distributed Pro/BATCH client cannot intelligently sort files by their names or other attributes, each task writes all files to a single location. You must do the sorting ahead of time or write it into a custom service. Under the “Directory for Output Files,” the options are:

·       Current Working Directory. This is where the Distributed Pro/BATCH client was started. In our example, it is C:\Workspace but it can be any location specified in the ptcdbatch.bat shortcut.

·       Same as Source Object Location. This option writes each file back to the same folder from which it was opened.

·       Other Directory. This option can be any directory you choose.

Choose “Other Directory” and enter C:\dbatch\pdfs.

 

Select the drop-down menu under “Search Options” and change it to TTD Search Directories (Fig. 7).

 

Figure 7. TTD Search Directories.

 

DSM Light uses XML-formatted files called Task Type Definitions (TTDs) to communicate which files to process, what service to use, and where to place the results.

“Search Options” tell Distributed Pro/BATCH where to look for TTDs. Pro/ENGINEER comes with a series of default TTDs found under <Pro/ENGINEER load point>\text\tdds. You don’t have to enter the default location in this field, but you should move the TTDs to a more secure location.

  • Moving the TTDs to a network location makes them available to everyone.
  • Moving them out of Pro/ENGINEER keeps modifications from being overwritten during software updates. 

Move the files to C:\dbatch\ttds and add them to the search list. If you copy the files, Distributed Pro/BATCH will list the files from both locations. 

TTDs are written to interact with custom toolkit applications commonly referred to as services. Each service performs a specified task or set of tasks. The default services are installed in Pro/TOOLKIT under <Pro/ENGINEER load point>\protoolkit. You do not have to own Pro/TOOLKIT or have a toolkit access license to use a service.

It is important to understand the format of TTDs. The sample code presented here is for a TTD file that exports PDF files of drawings (Fig. 8).

 

Figure 8. DRW-to-PDF task.

 

  • The first three lines are header information in XML comments. This information should never be modified because XML must remain well formed or it will not function. (If you want to learn more about XML syntax, many resource books and websites are available on this subject.)
  • The <DESCRIPTION> value appears in the TTD list. The TTD list is accessible from the Distributed Pro/BATCH client. Select Action > New Task Group…(Fig. 9).

Figure 9. New Task Group list.

 

  • Scroll down and pick the desired action. This example opens specified drawings and plots them to PDF.
  • Although you can select multiple task groups at the same time, TTDs execute concurrently. Future functionality may allow chaining of task groups to make them execute in a specific order and only if the previous task groups completed successfully.
  • The <DETAILS> field is only visible in the TTD definition. It is useful if you are attempting to read a TTD developed by someone else.
  • The <SERVICE> corresponds with the process in the Task Manager. It appears once the service is started (Fig. 10).

 

Figure 10.  Distributed Pro/BATCH processes.

 

  • <TKFUNC> is the Pro/TOOLKIT function to call. Each function has a different set of inputs. The fields within this block are the inputs for the function.

 

Note: While no direct documentation exists for the options and capabilities of each TTD, you can glean some information about the inputs and their values from the Pro/TOOLKIT API documentation.

TTD files are only read during Distributed Pro/BATCH startup. If you make changes to a TTD, you must close and restart the Distributed Pro/BATCH client. Select Actions > New Task Group… and choose the TTD PLOT DRW to PDF. Select OK to accept it. The newly created task should already be highlighted (Fig. 11).

 

Figure 11. PDF-to-DRW task.

 

The red box means this is a newly created, unexecuted task. These are general settings taken from the TTD we specified. The TTD file name shows the path and file name of the associated TTD.  Progress remains blank until the task is executed.

Select Objects to change the display of the pane on the right (Fig. 12).

Figure 12. Objects pane.

 

Use the folder and cabinet browser icon at the right (or the bucket icon in the top toolbar) to find components on the hard drive.

Wildfire 3.0 can look directly into PDMLink 8.0 and Pro/INTRALINK 8.0 workspaces. Register Windchill servers using Tools > Server Registry, and then add files to the processing list using either the cabinet browser icon or the file cabinet icon. (Distributed Pro/BATCH cannot see into Pro/INTRALINK 3.x.)

The “Task Status Legend” near the bottom of this window describes the indicators that appear next to each drawing.

Select Configuration Files (Fig. 13).

 

Figure 13. Configuration pane.

 

Use the folder browser icon at the right of this window to track down any desired configuration files such as search path file, pen table file, plotter configuration file, or *.properties files. For our example, pick the config.pro file.

Finally, select Output (Fig. 14).

 

Figure 14. Output pane.

 

Since C:\dbatch\pdfs is the global preferences default, you don’t have to enter it here. Be sure this location exists.

Select File > Save and give it to C:\dbatch\dxcs\pdf.dcx. Select OK to save it.

Saving the task group captures the batch process, along with the list of files to process. Under the current functionality, it cannot accept a text list of files to process. With proper manipulation, however, you can manually modify the saved task group to add or remove as many files as desired.

Open the saved Task Group file. The contents of our example pdf.dxc file appear below (Fig. 15).

 

Figure 15. pdf.dcx file.

 

The <Object> tags capture the files to process. Note that the configuration file uses a different tag. This file can be manually edited to add more drawings, or it can be re-opened, edited, and saved from the Distributed Pro/BATCH client UI. 

Close the Task Group file.

Batch scripts can be written to capture a list of drawings and update the pdf.dcx file. The result is a freshly generated pdf.dxc file without the manual process of running the Distributed Pro/BATCH Client UI. You can also write other, more complicated DOS, VisualBasic, Java or C/C++ applications to perform tasks like sorting files between folders or renaming files.

 

3. Execute the Task

Returning to the Distributed Pro/BATCH client, execute the active task. Move the cursor over the task, RMB > Start (Fig. 16).

 

Figure 16. Start task.

 

Starting the task turns the red box into a green circle. Select Objects to watch the progress. The tasks take some time to execute. When finished, all the Task Status Indicators will be blue or red.

 

  • If blue, check the C:\dbatch\pdfs folder PDF files.
  • If red, execution failed. Review the log and the std.out files in the Distributed Pro/BATCH startup directory (i.e., C:\Workspace) for warnings or errors. Also watch the message area at the bottom of the Distributed Pro/BATCH window.

 

4. Schedule the Task

You can schedule tasks in the Distributed Pro/BATCH client interface and execute them from the command line. Move the cursor over the task and RMB > Schedule. Scheduling the task gives it a stopwatch icon (Fig. 17). It also prompts for the date and time to run the task.

 

Figure 17. Scheduling the task.

 

The time cannot be less than five minutes from the current time. Scheduling cannot be saved.  When scheduling through the Distributed Pro/BATCH client, the client must remain open or the scheduled process will not execute. If you plan to run it after hours, be sure not to unload the task or close the client after scheduling.

Once a scheduled task group has run successfully, try it from the command line. Use the syntax shown below in a batch file to execute the task group (Fig. 18).  If it runs, put this in a batch file and schedule it with the appropriate operating system scheduler.

 

Figure 18. dBATCHSchedule.bat.

 

The nographics command line option executes the task without starting the Distributed Pro/BATCH UI. The process command line option executes the specified *.dcx file. You can tell if files failed processing from the log file generated in the Distributed Pro/BATCH (C:\Workspace) startup directory.

 

Recap

Distributed Pro/BATCH Stand Alone is significantly more powerful than Pro/BATCH, and that power comes for free. You can use this tool to batch process Pro/ENGINEER files in a folder or in Windchill 8.0 to perform tasks such as file conversion, save display, and Pro/ENGINEER release updates.

If this version isn’t powerful enough for your needs, buy Distributed Pro/BATCH and gain networking and customization capabilities. Use the API to write your own services to batch execute analysis tasks, web publishing, file manipulation, software installation, and much more.

Distributed Pro/BATCH products promise huge benefits. How will you use it?

 

Matt Meadows is solutions architect at Sequoia Etc.

Revving Up Your Experience in Pro/ENGINEER Wildfire 2.0

All About Mathcad–Q&A with Jim Heppelmann

From Product Design to Custom Delivery Drawing in One Integrated Step

Roundup from Dallas

Technical Committee News

Migrating to Windchill–Why Reducing Part Count Involves Adding Lots of New Parts

New OCUS Utilities for Your Toolbox

Cabling 101–What You Can Do with Routed Systems Designer Lite & Pro/ENGINEER Wildfire 2.0

Windchill 8.0 Cluster Configuration– Battle for Performance

Distributed Pro/BATCH– Power for Free