Sunteți pe pagina 1din 15

NX 9 Shop Docs Template Customization Tutorial

by billstorrs

on 10-30-2013 05:19 PM - edited on 10-30-2013 05:20 PM by


Basics - Fundamentals


Tech Tip Articles

What's New in NX 9


Documenting the manufacturing plan and the specifics of the NC program are important pieces of the part manufacturing process. This Tech Tip
describes the steps to generate shop documentation, then to customize templates to tune the shop docs to your needs.

To do this tutorial, you need to save the following files and folders locally:

Shop_doc folder containing templates

Folder containing part files with operations

Empty folder for shop doc output

Copy the folders to your desktop

1. Unzip the attached Templates and Part files.7z file and copy the attached shop_doc folder onto your desktop. This is the same folder as the one
in your \MACH\resource\ directory:

Example: C:\Program Files\Siemens\NX 9.0\MACH\resource\shop_doc

A local copy will allow you to edit and save your own templates.

2. Copy the attached Die and Shop Doc output folders to your desktop.
The Die folder contains the part files you will use and the Shop Doc output folder is an empty folder in which you will save the output.

3. Add an Environment Variable that tells Shop Docs where to find the templates:

Start-->Control Pane-->System and Security-->system-->Advanced System Settings-->Advanced (tab)-->Environment Variables-->New

Fill in the following Variable name and Variable value:

Click OK twice.

4. Restart NX if it is currently running so the new environment variable will be applied.

Be sure Shop Docs can find where Excel is installed

The shopdoc_excel.tcl file inside the excel_templates folder specifies where Shop Docs will look for the excel.exe file. Example:
set execute_file {C:\\apps\\MSOffice\\Office14\\excel.exe}

If you have Excel installed, be sure this path is correct. If Shop Docs does not find Excel (or if you dont have it), then the output will be displayed
by the HTML browser only.

Output Shop Docs

1. In NX, open housing_cover_setup.prt in the Die folder.
2. In the Program Order View of the Operation Navigator, select 1234.
3. Click the Shop Documentation icon in the toolbar.
4. Select Operation List Select (HTML/Excel) in the Report Format list.
5. Click the Browse for an Output File folder and browse to the Shop Doc outputfolder on your desktop.
6. Click OK.
7. Click OK in the Shop Documentation dialog to begin processing.
8. Click Yes in the Microsoft Office Excel dialog.
Two output files have been created: and html file and an html file displayed in Excel.

9. Close the html file so that only the Excel output is displayed.

Notice that the title block has been populated with data and a part image. The operation table has cycled for each operation in the selected

Note: Other platforms (MacOS, Linux) will not display the output automatically.
Click one of the images in the Path Image column.

10. The image is enlarged and displayed in your default graphic viewer.

Close the image and the Excel output window.

Note: You must close all output windows before generating the next output or you will receive an error.
Repeat the above steps to output a single operation or a group in the Machining Method View. Also, try using other templates in the Report Format

Editing an Existing Template

First, you will make a simple text edit to the template and then generate the output to see the edit. Then, you will edit a MOM variable and change
the page formatting.

1. On your desktop, open the /shop_doc/excel_templates/ folder.

2. Double-click to open shopdoc_template_English_operation_list_select.xlsx

3. In the Excel file, change Program Sheet in the title to Die.

4. Do not save the change.
Update the template
5. In Excel, File-->Save As-->Save as type: Web Page (*.htm;*.html)-->Republish: Sheet.

Note: Shop Docs supports Excel 2007 and later. The above illustration shows Excel 2010. Other versions of Excel may vary slightly.

6. Check to be sure you are saving in your local copy of the /shop_doc/excel_templates/ directory on your desktop.
7. Select Save.
8. In the Publish as Web Page dialog box, select Publish.
9. Leave the edited shopdoc_template_English_operation_list_select.xlsx file open for now.

Generate output using the updated template

10. In NX, Select 1234Shop DocumentationOperation List Select (HTML/Excel)OK
Notice the output reflects the change you made (Program Sheet to Die) to the Excel file.

11. Close the output windows.

Edit the Excel file

Next, you will edit a MOM variable. Sheet 2 in the Excel file contains many MOM variables with descriptions that are available to customize the
template. Filtering by Class, Sorting alphabetically, and Finding key words are useful in navigating this list.

12. Click the mom_vars tab at the bottom of the shopdoc_template_English_operation_list_select.xlsx file.
13. Pick Class at the top of column B and select Filter
14. At the top of column B, pick the
15. Scroll down and check

in the toolbar.

button next to Class and uncheck


16. Click OK.

17. Pick the A at the top of column A and select Find
18. Type Dia in the Find what field and click Find All.

in the toolbar.

Select All.

19. In the Find and Replace window, pick mom_tool_diameter in the Value column.
20. Type Dia in the Find what field and click Find All.
21. In the Find and Replace window, pick mom_tool_diameter in the Value column.

22. Close the Find and Replace window.

23. Click the shopdoc_template_English tab at the bottom of the Excel file.
24. Paste mom_tool_diameter in place of mom_oper_tool (be sure to retain the brackets).

25. Change Tool Name in the column heading to Tool Dia.

26. Change### REPEAT TITLE### to Yes.

REPEAT TITLE allows you to repeat the title block (defined between ###BODY START### and the ###TABLE START### markers) on each

27. Do not save changes.

Generate output using the updated template

28. In NX, Select 1234Shop DocumentationOperation List Select (HTML/Excel)OK
Notice the title block is repeated on page one and two and that the Tool Dia column now reflects the diameter of each tool.
29. Close the output window.
Here is an overview of the types of edits you can make to the template:

Creating a New Template

Heres what you will do:

Save the edited Excel file under a new name

Create a new template

Create a new .tcl file. This determines which template to process when you select an option in the UI

Edit the .dat file to determine what you see in the user interface and which .tcl file to use

Generate output using the new template

Save a new .xlsx file

Begin by saving the .xlsx file you edited under a new name.

1. File-->Save As--> File name: my_template.xlsx-->Save

Create a new .htm file

Now, create a new template with the same content as the .xlsx file.

2. File-->Save As-->Save as type: Web Page (*.htm;*.html)-->Republish: Sheet -->Save-->Publish

Look in the excel_templates folder (your local copy) and notice that you have created two files and the system has created a folder to support
the .htm file:

Create a new .tcl file

The .tcl file for the new template must have the same name as the .htm file so that the system knows which .htm file to process. This common file
name connects the .tcl and .htm files.

3. In the excel_templates folder, Copy and Paste shopdoc_template_English_operation_list_select.tcl

4. Rename it my_template.tcl
5. You should have three files:

.xlsx: The Excel file containing your edits on sheet 1 and all available mom variables on sheet 2. This is your working file.
.htm: The template the system uses to create the shop doc output.
.tcl: The .tcl file that determines which .htm file to process when you select an option in the UI.

Edit the.dat file

shop_doc.dat file determines what you see in the Shop Doc user interface and specifies which .tcl file to use.

6. Go back one level in the directory.

7. Find shop_doc.dat and remove RO if necessary.
8. Open shop_doc.dat in a text editor.
Each line corresponds to an existing template. # are templates that are commented out and do not appear in the NX user interface. You can copy
and edit any line.

9.Copy all the text from line 1:

Operation List Select (HTML/Excel), ${UGII_CAM_SHOP_DOC_DIR}excel_templates\shopdoc_template_English_operation_list_select.tcl, $


10. Paste as a new line at the bottom of the list.

11. Key in what you wish to appear in the UI - My Operation List Select (HTML/Excel)

12. Key in the name of the .tcl file you just created - my_template.tcl. This connects the .tcl file to the UI selection.

My Operation List Select (HTML/Excel), ${UGII_CAM_SHOP_DOC_DIR}excel_templates\my_template.tcl, $


13. Save and Close shop_doc.dat

14. Create Shop Doc output using the new template: