NX CAM Customization
Tips and Tricks
Mark Rief
Product Manager
Manufacturing Engineering Solutions
http://plmworld.org/ © Siemens AG 2012. All Rights Reserved.
Page 1 Siemens PLM Software
NX CAM Customization
Tips and Tricks
Mark Rief
Product Manager
May 2012
© Siemens AG 2012. All Rights Reserved.
Abstract
We will review some of the many ways you can
customize NX CAM for your users. First we will
show how to set up a maintainable environment
for your customizations. We will demonstrate how
to create and publish templates, including setting
default values, customizing the dialogs, and
changing the icons, pictures, and tool tips that pop
when you create an operation. We'll create and
edit a simple journal, and add it to a new tool bar
that we'll also create.
© Siemens AG 2012. All Rights Reserved.
Page 3 Siemens PLM Software
Topics
Customization Environment
Template customization
Icons and tooltips
Setups
Setup Library
Assembly Templates
File New
Journaling and Automation
Recording journals
Generalizing to create API programs
Selected objects, All objects, Wizard object
Tool bars
© Siemens AG 2012. All Rights Reserved.
Page 6 Siemens PLM Software
Setting up a safe environment for
customization
© Siemens AG 2012. All Rights Reserved.
Create a Safe Customization Environment
Preserve the Out of the Box (OOTB) installation
There are many ways to do this. I will show you one.
Create a home folder for each release
Copy the mach\resource folder to the home folder, remove read only
Create a usertools\bitmaps folder in the home folder
Create a usertools\startup folder in the home folder (toolbars, pax)
Create a ugii_env.dat file in the folder (copy OOTB)
Define variables to point to the folders you created
Create/copy the shortcut to run NX
Set the “Start In” folder to your home folder
© Siemens AG 2012. All Rights Reserved.
Page 8 Siemens PLM Software
Tips on Environment Variables
Decide where to define variables, and remember where:
System
ugii_env.dat file Today
Script or batch file
When id doubt, check the syslog file
© Siemens AG 2012. All Rights Reserved.
Page 9 Siemens PLM Software
The ugii_env.dat file
Use ugii_env.dat to define ONLY the variables you are changing
It will include the default file
Never touch the ugii_env_ug.dat file.
Start with a copy of the one in UGII_ROOT_DIR
The system searches until if finds a ugii_env.dat file:
1. Defined by environment variable UGII_ENV_FILE.
2. ugii_env.dat file in the directory that UG is started from. Today
3. ugii_env.dat file in the users home directory as specified by the HOME
environment variable.
4. ugii_env.dat in UGII_ROOT_DIR.
© Siemens AG 2012. All Rights Reserved.
Page 10 Siemens PLM Software
Sample Customization Environment
# Copy ugii_env.dat file to Shortcut “Start in:” folder
#
# Override any variables here.
# My resource area
# -----------------------------------------------------
UGII_CAM_RESOURCE_DIR=d:\users\rief\nx85\resource\
#
# My bitmaps
# -----------------------------------------------------
UGII_USER_DIR=d:\users\rief\nx85\usertools\
UGII_BITMAP_PATH=${UGII_USER_DIR}bitmaps
#
# Do not define any variables after the #include below. They
must be defined
# before the #include in order to override the NX defaults.
#
#if FILE ${UGII_BASE_DIR}\ugii\ugii_env_ug.dat
#include ${UGII_BASE_DIR}\ugii\ugii_env_ug.dat
#endif
© Siemens AG 2012. All Rights Reserved.
Page 11 Siemens PLM Software
Test the customization environment
Run NX from the shortcut
Check the syslog
© Siemens AG 2012. All Rights Reserved.
Page 12 Siemens PLM Software
Demo
© Siemens AG 2012. All Rights Reserved.
Page 13 Siemens PLM Software
Plan Ahead for Updating to the next release
Merge your changes in to the OOTB files
Do not just move old files up from the last release – you will miss
PR fixes and enhancements
Seeing new functionality
New environment variables
Keep track of the changes you make
Template Parts
ASCII Tool Library
If no class changes, use the upgrade program
If you edit the classes, compare the tcl, def, dat files.
© Siemens AG 2012. All Rights Reserved.
Page 14 Siemens PLM Software
A Brief Primer on CAM Objects
and Templates
© Siemens AG 2012. All Rights Reserved.
CAM Objects and
Inheritance
Setup
Program Tool Geometry Method
Output Machine MCS Stock
Grouping Turret Geometry Tolerance
Order Pocket Boundaries Feedrates
Tool Clearance Display
Operation
Tool
Generate
Path
© Siemens AG 2012. All Rights Reserved.
Page 16 Siemens PLM Software
Some Basic Concepts and Terms
Objects are operations, tools, geometry, methods, programs
Every object in CAM is created from a template object (Type template)
Template objects have:
Default parameters
Customized dialogs
Attributes for the Create dialog
Any object or group of objects can be reused as a template
Setups are a collection of objects (Setup template)
Initial starting point
Can create assembly structure
© Siemens AG 2012. All Rights Reserved.
Page 17 Siemens PLM Software
Object Creation
Common Dialog for Programs, Tools, Geometry,
Methods, Operations
Select Type (part)
Select Subtype (object)
Select Location (parent objects)
4 for Operations, 1 for groups
Objects are create from “Type” Templates
Custom icons and tool tips based on templates
Browse for testing, add to library and opt file when
ready
© Siemens AG 2012. All Rights Reserved.
Page 18 Siemens PLM Software
Tool Libraries
Tool libraries are an additional way to create tools
Parameters come from the library
Dialog comes from a template
Library_dialogs.prt
Includes UDEs
© Siemens AG 2012. All Rights Reserved.
Page 19 Siemens PLM Software
Getting confused
Don’t edit and use a template at the same time
Always restart NX or…
Edit in one place and copy/rename to the real place
© Siemens AG 2012. All Rights Reserved.
Page 20 Siemens PLM Software
Demo – operation templates
Copy an OOTB template
Customize an operation
Dialog – Customize, Customize From…
Default values
Picture in dialog
Icon
Tooltip attributes
© Siemens AG 2012. All Rights Reserved.
Page 21 Siemens PLM Software
Add a new setup assembly to File
New
© Siemens AG 2012. All Rights Reserved.
Setup Libraries
History
Introduced in NX 1, Palettes in NX 2, File New access in NX 6
List of setup templates is in a library, not an opt file
Why?
Setups are classified and organized
Each setup can have a unique set of type templates, which is used
whenever the setup is opened. No need to change configuration or template
set.
Assemblies can be created automatically
Setup assemblies can use File New to access
© Siemens AG 2012. All Rights Reserved.
Page 23 Siemens PLM Software
Setup Classification with Libraries
Classify setups with
NX libraries
Associate type templates
with setups, not .opt file
Setup reference is stored
in the part, not session
Library is in resource\template_dir\template.dat
Optional – use configuration cam_library.dat
• LIBRARY_SETUP_TEMPLATE
© Siemens AG 2012. All Rights Reserved.
Page 24 Siemens PLM Software
Configuration file
• Cam_library.dat contains this line
…
LIBRARY_SETUP_TEMPLATE,
${UGII_CAM_LIBRARY_TEMPLATE_DIR}template.def,
${UGII_CAM_LIBRARY_TEMPLATE_DIR}template.tcl
• Do not switch between library mode and regular mode
• If you use setup libraries, add this to cam_general,
or change the default to cam_library
• Cam_library.dat also classifies output files.
…
LIBRARY_CAM_OUTPUT,
${UGII_CAM_LIBRARY_TEMPLATE_DIR}cam_output.def,
${UGII_CAM_LIBRARY_TEMPLATE_DIR}cam_output.tcl
© Siemens AG 2012. All Rights Reserved.
Page 25 Siemens PLM Software
Setup Assemblies
Setup template part is an assembly
Contains a target component
Can contain other geometry and components
Mating conditions
Creating a setup for your part
Open the part you want to machine
New part with a setup is created
Your work part is now a component (replaces the target)
Setup templates provided for General and CAM Express
General uses mill_planar_assy.prt mill_planar_target.prt
New Template includes machine
© Siemens AG 2012. All Rights Reserved.
Page 26 Siemens PLM Software
Creating your own setup assembly
Create an assembly
Create setup in the top level part
Add components
Assign attribute to target component
CAM_COMPONENT_TYPE=Target
File Export Setup Template
Assign attributes
Select Type templates
Entry will be added to template.dat
© Siemens AG 2012. All Rights Reserved.
Page 27 Siemens PLM Software
Manually Editing the Setup Library -
resource\template_dir\template.dat
For each setup in the library
LIBRF is a unique identifier
Stored in the setup
Inch 0-100, Metric 101-200, User 201+
TMPL_CLASS identifies the complete class hierarchy of the template
Sorted by functionality AND by units (for Palettes)
SETUP_TEMP is the complete path for the setup template part file
TYPE_TEMP is a list of type template associated with SETUP_TEMP
Replaces the opt file
Restored using LIBRF
ATT1 is attribute 1 (description), used only for selection
ATT2 is attribute 2 (units), used only for selection
© Siemens AG 2012. All Rights Reserved.
Page 28 Siemens PLM Software
What’s in the Setup Library File?
LIBRF TMPL_CLASS SETUP_TEMP
# Inch 001 - 100
DATA | 001| general.| ${UGII_CAM_TEMPLATE_PART_ENGLISH_DIR}mill_planar.prt|
${UGII_CAM_TEMPLATE_PART_ENGLISH_DIR}mill_planar.prt
${UGII_CAM_TEMPLATE_PART_ENGLISH_DIR}mill_contour.prt
${UGII_CAM_TEMPLATE_PART_ENGLISH_DIR}mill_multi-axis.prt
${UGII_CAM_TEMPLATE_PART_ENGLISH_DIR}drill.prt TYPE_TEMP
${UGII_CAM_TEMPLATE_PART_ENGLISH_DIR}hole_making.prt
${UGII_CAM_TEMPLATE_PART_ENGLISH_DIR}turning.prt
${UGII_CAM_TEMPLATE_PART_ENGLISH_DIR}wire_edm.prt| General | Inch
…
# Inch palette for NX2 ATT1 ATT2
DATA | 001| inch.| ${UGII_CAM_TEMPLATE_PART_ENGLISH_DIR}mill_planar.prt|
${UGII_CAM_TEMPLATE_PART_ENGLISH_DIR}mill_planar.prt
${UGII_CAM_TEMPLATE_PART_ENGLISH_DIR}mill_contour.prt
${UGII_CAM_TEMPLATE_PART_ENGLISH_DIR}mill_multi-axis.prt
${UGII_CAM_TEMPLATE_PART_ENGLISH_DIR}drill.prt
${UGII_CAM_TEMPLATE_PART_ENGLISH_DIR}hole_making.prt
${UGII_CAM_TEMPLATE_PART_ENGLISH_DIR}turning.prt
${UGII_CAM_TEMPLATE_PART_ENGLISH_DIR}wire_edm.prt| General | Inch
#
# Metric 101 - 200
…
© Siemens AG 2012. All Rights Reserved.
Page 29 Siemens PLM Software
File New
Add your own .pax file with your
setup assemblies to
UGII_USER_DIR\startup
Read all the help, or just copy
what we do
CAM is different that the other
templates
Only Master Model
Must be a library setup
assembly
© Siemens AG 2012. All Rights Reserved.
Page 30 Siemens PLM Software
Sample File New .pax file entry
<Presentation name="Manufacturing Templates" bitmap="sheet_and_block.bmp"
FileNewTab="Manufacturing" application="All" UsesMasterModel="Yes"/>
<PaletteEntry id="d1">
<References/>
<Presentation name="My Test Setup" description="What a Great Demo Setup">
<PreviewImage type="UGPart"
location="${UGII_CAM_TEMPLATE_PART_ENGLISH_DIR}mill_planar_assy.jpg"/>
</Presentation>
<ObjectData class="CamTemplate“>
<Filename>
${UGII_CAM_TEMPLATE_PART_ENGLISH_DIR}mill_planar_assy.prt</Filename>
<Configuration>${UGII_CAM_CONFIG_DIR}cam_library.dat</Configuration>
<LibraryClassPath>GENERAL</LibraryClassPath>
<Units>English</Units>
<UsesMasterModel>Yes</UsesMasterModel>
</ObjectData>
</PaletteEntry>
© Siemens AG 2012. All Rights Reserved.
Page 31 Siemens PLM Software
Journals and Toolbars
© Siemens AG 2012. All Rights Reserved.
Journaling and Automation
Journaling = recording a program
Better than Macros
Basis of an automation program
© Siemens AG 2012. All Rights Reserved.
Page 33 Siemens PLM Software
Toolbars
Make your programs easy for the user to find
Toolbars can be created and maintained two ways
Text file - .tbr
Load automatically from UGII_USER_DIR\startup
Load manually with customize
Better for sharing and maintenance
Interactively
Create with customize
Save with a role
Easier for individual users
© Siemens AG 2012. All Rights Reserved.
Page 34 Siemens PLM Software
Toolbars
Toolbar buttons can have many actions
Built in NX menu command
Look in the syslog or .men files.
Your own program
Vb, Grip, Macro
System commands
© Siemens AG 2012. All Rights Reserved.
Page 35 Siemens PLM Software
Demonstration
Make a toolbar
Make a program to edit selected tools
Add to a toolbar
Program to set attributes
© Siemens AG 2012. All Rights Reserved.
Page 36 Siemens PLM Software
Thank You!
www.siemens.com/plm
Siemens PLM Connection 2012
Las Vegas, NV
May 7-10
#PLMCONX
http://plmworld.org/ © Siemens AG 2012. All Rights Reserved.
Page 38 Siemens PLM Software