You are on page 1of 46

MP/EMP Post Debugger

Users Guide

Mastercam X3
MP-EMP Post
Debugger Users
Guide
[Preliminary Review Version]

July 2008

ii MASTERCAM X3 / MP-EMP Post Debugger Users Guide

Mastercam MP-EMP Post Debugger Users Guide


Date: July 2008
Copyright 2008 CNC Software, Inc. All rights reserved.
Software: Mastercam X3
ISBN: 1-883310-86-5

IMPORTANT NOTICE!

PLEASE READ THIS STATEMENT AND THE SOFTWARE LICENSE AGREEMENT


COMPLETELY BEFORE USING THIS SOFTWARE. YOU MUST ACCEPT THE TERMS
OF THIS LICENSE BEFORE YOU CAN OPERATE THE SOFTWARE PROGRAM.
BY CONTINUING TO USE THIS SOFTWARE, YOU (EITHER AN INDIVIDUAL OR A
SINGLE ENTITY) INDICATE YOUR INTENTION TO BE BOUND BY AND ACCEPT
THE TERMS AND CONDITIONS OF THIS SOFTWARE LICENSE. IF YOU DO NOT
AGREE TO THESE TERMS AND CONDITIONS, YOU MAY NOT ACCESS OR
OTHERWISE USE THIS SOFTWARE AND WILL IN FACT BE PROHIBITED FROM
DOING SO. THIS COMPUTER SOFTWARE MAY BE USED ONLY PURSUANT TO
THE TERMS AND CONDITIONS SET FORTH BELOW, AND SOLELY IN
CONJUNCTION WITH THE ACCOMPANYING SECURITY MECHANISM (UNLESS
OTHERWISE SPECIFIED IN THE "EXCEPTIONS TO SECURITY MECHANISM
REQUIREMENTS" SECTION OF SUCH TERMS AND CONDITIONS) WHICH MUST
BE PRESENT ON YOUR COMPUTER (OR NETWORK AS APPLICABLE) AT ALL
TIMES DURING SUCH USE.
Please Note: Your company may have additional restrictions and guidelines in place
regarding the use of this Software that are in addition to those found within this
Software License. If you have any questions or concerns as to the existence of any
such additional restrictions or guidelines, you should consult with your supervisor
or your IT Department before using this Software.
Read This If You Have Received This Software From A Third Party: If you received
this Software from someone other than an authorized CNC Software, Inc. reseller,
you do not have a legal software license. (For example, if you acquired this Software
simply by buying a machine or Software from the former owner or from an auction,
you do not have a valid license.) You should contact CNC Software, Inc. (860-8755006) in order to obtain a new and valid license. Use of this Software without a
valid software license is unlawful, a violation of the Copyright Act and may expose
you to criminal liability under 17 United States Code Sec. 506, including fines and
damages.

Software License

If you have paid a license fee, CNC Software, Inc. ("CNC") a Connecticut
corporation with its principal place of business at 671 Old Post Road, Tolland,
Connecticut, 06084 hereby grants to you a non-exclusive, non-transferable license
(the "License") to use this software program and its accompanying documentation
(and, if applicable, to permit your authorized employees to use them), solely in
accordance with the terms and conditions of this Software License Agreement. You
may use the Software solely for your internal business purposes and solely in
conjunction with the accompanying hardware or software device, method, scheme
or other security measure provided by CNC which allows a user to access the
Software and prevents unauthorized access to the Software (the "Security
Mechanism"). The Software, any updates to the Software through purchase or due
to enrollment in an authorized software Maintenance program (including any that
you download through the Internet), and the Documentation in printed or
electronic form shall hereinafter collectively be referred to as the "Software" and are
all governed by this License.

iii

Restrictions

You may not use the Software without a Security Mechanism provided by CNC or
CNC's suppliers. When CNC or CNC's resellers provide you with a single-user
Security Mechanism, the Software may only be used (in executable code form
only) on a single computer to which the Security Mechanism is physically
attached. In the event CNC or CNC's resellers provide you with a multiple-user
Security Mechanism for use over an internal network (a "Network Security
Mechanism"), the Software may be used: (a) in executable code form only; (b) only
on end-user computers that are connected to the internal network to which the
Network Security Mechanism is attached; and (c) only by the number of users and
accessed by the number of end-user computers for which licenses were purchased
and as further allowed by the Network Security Mechanism. You may physically
transfer the Software from one computer equipped with a single-user Security
Mechanism to another only if the Security Mechanism is included in the transfer
and is installed with the new computer.
You shall not: (a) copy (except as provided below), adapt, modify the Software; (b)
publish, display, disclose or create a derivative work from the Software or any part
thereof; (c) de-compile or translate, disassemble, create or attempt to create, by
reverse engineering or otherwise, the source code form of the Software from the
executable code of the Software; (d) remove any proprietary notices, labels or
marks from the Software; (e) sell, rent, lease, distribute or otherwise transfer or
provide all or any part of the Software to any person or entity without the prior
written consent of CNC; (f) use the Software to provide outsourcing, service
bureau, time sharing or other services to any third party; or (g) sublicense, assign,
delegate or otherwise transfer your rights in the Software, under the Software
License Agreement or any of the related rights or obligations for any reason
without the prior written consent of CNC. You shall not circumvent, bypass,
modify, reverse engineer, disassemble, disable, alter, enhance or replicate the
function of the Security Mechanism in any manner whatsoever. Any attempt to do
so shall result in automatic termination of this License without prejudice to all
other legal rights and remedies of CNC.

Copying Restrictions

You may make one (1) copy of the Software for backup or archival purposes,
provided that you reproduce all proprietary notices of CNC on any such copy.

Non Transferable

You may not transfer or assign the Software or this Software License Agreement or
any rights or obligations hereunder. Any attempt to do so will automatically
terminate this License without the need for notice. This termination is without
prejudice to all other legal rights and remedies of CNC.

Intellectual Property Rights

The Software is and includes intellectual property of CNC. All associated


intellectual property rights, including, without limitation, worldwide patent,
trademark, copyright and trade secret rights, are reserved by CNC. CNC retains all
right, title and interest in and copyrights to the Software, regardless of the form or
media in or on which the original or other copies may subsequently exist. This
Software License Agreement shall not constitute a sale of the Software and no title
or proprietary rights to the Software are transferred to you hereby. You
acknowledge that the Software is a unique, confidential and valuable asset of CNC,
and CNC shall have the right to seek all equitable and legal redress which may be
available to it for the breach or threatened breach of this Software License
Agreement including, without limitation, injunctive relief. Unauthorized copying
of the Software or failure to comply with the above restrictions shall result in
automatic termination of this License and this Software License Agreement
without prejudice to all other legal rights and remedies of CNC.

Confidentiality

You acknowledge that the Software contains proprietary trade secrets of CNC and
you hereby agree to maintain the confidentiality of the Software using at least as
great a degree of care as you use to maintain the confidentiality of your own most

11
12
13
14
15
16
17
18
19
110

iv MASTERCAM X3 / MP-EMP Post Debugger Users Guide

confidential information. You agree to promptly communicate the terms and


conditions of this Software License Agreement to those persons employed by you
who come into contact with the Software, and to use your best efforts to ensure
their compliance with such terms and conditions, including, without limitation,
absolutely preventing such persons to use any portion of the Software for the
purpose of deriving the source code of the Software or defeating the Security
Mechanism.

Enforcement
Obligations

In the event you become aware that any person or entity in your employ or under
your control is using the Software in a manner not authorized by this Software
License Agreement, you shall immediately take all steps necessary to stop such
unauthorized use of the Software. You shall promptly notify CNC in writing of any
unauthorized use of the Software of which you become aware.

Limited Warranties

CNC WARRANTS THAT THE MEDIA ON WHICH THE SOFTWARE IS DISTRIBUTED


WILL BE FREE OF DEFECTS IN MATERIAL OR WORKMANSHIP FOR A PERIOD OF
THIRTY (30) DAYS AFTER PURCHASE. THE FOREGOING LIMITED WARRANTY
EXCLUDES DEFECTS ARISING OUT OF ACCIDENT, NEGLECT, MISUSE, FAILURE
OF ELECTRIC POWER AND CAUSES OTHER THAN ORDINARY AND AUTHORIZED
USE. EXCEPT FOR THE FOREGOING LIMITED WARRANTY, THE SOFTWARE IS
PROVIDED "AS IS, WITH ALL FAULTS." THIS LIMITED WARRANTY IS THE ONLY
WARRANTY PROVIDED BY CNC REGARDING THE SOFTWARE. TO THE
MAXIMUM EXTENT PERMITTED BY LAW, CNC DISCLAIMS ALL OTHER
WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
WITHOUT LIMITATION, IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE. CNC IS NOT OBLIGATED TO PROVIDE
ANY UPDATES TO THE SOFTWARE.
Sole and Exclusive Remedy for Breach of Warranty: YOUR SOLE EXCLUSIVE
REMEDY AND CNC'S SOLE OBLIGATION HEREUNDER SHALL BE, AT CNC'S SOLE
OPTION (i) REPLACEMENT OF THE DEFECTIVE MEDIA; OR (ii) REFUND OF THE
PURCHASE PRICE OF THE SOFTWARE. CNC SHALL HAVE NO OTHER
OBLIGATION OR LIABILITY TO YOU ARISING FROM OR RELATED TO THIS
LICENSE OR YOUR USE OF THE SOFTWARE. ANY USE BY YOU OF THE
SOFTWARE IS AT YOUR OWN RISK.
Note on Documentation: While CNC makes every effort to ensure that its
Documentation for the Software is accurate and up-to-date, it cannot guarantee the
Documentation at all times represents the latest operation and functionality of the
Software. The content of all documentation, in electronic or printed form, for the
Software is provided for informational purposes only. The content of the
Documentation may be changed without notice to you. CNC expressly disclaims
any warranty or representation that the Documentation is an accurate and/or
current reflection of the Software's operation and performance.

Disclaimer of
Consequential
Damages and
Limitation of Liability

IN NO EVENT WHATSOEVER WILL CNC, OR ITS EMPLOYEES, SHAREHOLDERS,


DISTRIBUTORS OR RESELLERS BE LIABLE TO YOU FOR ANY INDIRECT,
INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR IN
CONNECTION WITH THIS SOFTWARE LICENSE AGREEMENT OR THE USE OF
THE SOFTWARE, EVEN IF CNC HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES. WITHOUT LIMITING THE FOREGOING, CONSEQUENTIAL
DAMAGES SHALL INCLUDE, WITHOUT LIMITATION, SPECIAL, PUNITIVE OR
EXEMPLARY DAMAGES, DAMAGES FOR LOSS OF BUSINESS, LOSS OF PROFITS,
BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, AND LOSS OF
OR DAMAGE TO ANY PRODUCTS THAT THE SOFTWARE IS USED IN
CONJUNCTION WITH.

CNC'S ENTIRE LIABILITY WITH RESPECT TO ITS OBLIGATIONS UNDER THIS


SOFTWARE LICENSE AGREEMENT OR OTHERWISE SHALL NOT EXCEED THE
AMOUNT OF THE LICENSE FEE PAID BY YOU FOR THE SOFTWARE. SOME
JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF IMPLIED
WARRANTIES OR LIABILITY FOR INCIDENTAL OR CONSEQUENTIAL DAMAGES,
SO THE ABOVE LIMITATIONS OR EXCLUSIONS MAY NOT APPLY TO YOU.

Indemnification

Educational Pricing

Termination

General

You shall indemnify and hold harmless CNC, its officers, directors, employees,
resellers and agents (the "Indemnified Parties") from and against all losses,
settlements, claims, actions, suits, proceedings, judgments, awards, damages,
liabilities, costs and expenses including, without limitation, reasonable attorneys'
fees (collectively "Losses") which arise out of or are related to any breach of this
Software License Agreement by you or your employees, agents, resellers, dealers or
sub-dealers, and shall reimburse the Indemnified Parties for any and all legal,
accounting and other fees, costs and expenses reasonably incurred by any of them
in connection with investigating, mitigating or defending any such Losses.
If this Software was obtained through or in accordance with a CNC "Educational
Pricing" plan, option, grant, schedule or program, it may not be used by anyone,
including you, to conduct any computer aided design, computer aided drafting,
computer aided machining, or training activities that, directly or indirectly,
generate or otherwise result in monetary revenues for the benefit of any individual
or any entity, other than the school that originally received this Software.
This Software License Agreement is effective until terminated. You may terminate
this Software License Agreement at any time by returning to CNC all copies of the
Software under your control and by returning the Security Mechanism to CNC.
CNC may terminate this Software License Agreement if CNC determines, in its sole
discretion, that you have violated the terms of this Software License Agreement.
Upon termination of this Software License Agreement, you agree to immediately
return to CNC all copies of the Software, return the Security Mechanism to CNC,
and certify to CNC in writing that all known copies, including backup copies, have
been returned. All provisions relating to confidentiality, proprietary rights,
indemnification and non-disclosure shall survive the termination of this Software
License Agreement. You may not transfer this Software to the purchaser of any
equipment on which the Software may be resident. You may not transfer this
Software via liquidation, bankruptcy, auction, close of business, or any other
method that does not involve an authorized Mastercam reseller. This License is
for you alone. In the event you breach the provisions of this Section, CNC shall be
entitled to liquidated damages in the amount of Fifteen Thousand Dollars
($15,000), plus its reasonable attorney's fees and court costs.
This Software License Agreement shall be governed by and construed in
accordance with the laws of the state of Connecticut, USA without regard for
Connecticut's conflicts of law principles. The sole and exclusive jurisdiction and
venue for any litigation arising from or related to this Software License Agreement
or the subject matter hereof shall be in an appropriate state or federal court located
in Hartford, Connecticut. You hereby submit to the personal jurisdiction of the US
District Court for the District of Connecticut and the Superior Court of the State of
Connecticut. This Software License Agreement shall constitute the entire
agreement between you and CNC with respect to the subject matter hereof. Any
waiver or modification of this Software License Agreement shall be valid only if it is
in writing and signed by both parties hereto. If any part of this Agreement is found
invalid or unenforceable by a court of competent jurisdiction, the remainder of
this Agreement shall be interpreted so as to reasonably affect the intention of the
parties.

11
12
13
14
15
16
17
18
19
110

vi MASTERCAM X3 / MP-EMP Post Debugger Users Guide

Attorneys Fees

In the event that CNC is required to take legal action to enforce its rights under this
License Agreement and obtains a ruling or settlement in its favor, you shall be liable
to CNC for its reasonable attorney's fee incurred in investigating and prosecuting its
claim.

U.S. Government
Restricted Rights

The Software provided hereunder is a "commercial item," as that term is defined in


48 C.F.R. 2.101, consisting of "commercial computer software" and "commercial
computer software documentation," as such terms are used in 48 C.F.R. 12.212.
Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4, the
Software made available to the United States of America, its agencies and/or
instrumentalities, is provided with only those rights set forth in this Agreement. Use,
duplication or disclosure of the Software by the government is subject to the
restrictions as set forth in subparagraph (c) (1) and (2) of the Commercial Computer
Software-Restricted Rights clause at 48 C.F.R. 52.227-19, as amended, or any
successor regulations thereto.

Export Restrictions

You represent and warrant that you will not, without obtaining prior written
authorization from CNC and, if required, of the Bureau of Export Administration of
the United States Department of Commerce or other relevant agency of the United
States Government, export or re-export, directly or indirectly, the Software from the
United States to (i) any country destination or entity to which export is restricted by
the Export Administration Regulations of the United States Department of
Commerce; (ii) any country or entity subject to sanctions administered by the Office
of Foreign Assets Control, United States Department of the Treasury; or (iii) such
other countries or entities to which export is restricted by any other United States
government agency. You further agree that you are solely responsible for
compliance with any import laws and regulations of the country of destination of a
permitted export or re-export, and any other import requirement related to a
permitted export or re-export.

Exceptions to Security
Mechanism
Requirements

CNC software programs Mastercam Design LT and Mastercam Demo as well as


printed and electronic documentation do not require the use of Security
Mechanisms, and the provisions in this Software License Agreement relating to
Security Mechanisms do not apply to your use of such programs, provided,
however, that such provisions shall apply to your use of all other Software and
documentation provided hereunder.

Survival

All provisions of this Software License Agreement relating to confidentiality, nondisclosure, CNC's proprietary rights, disclaimers, and limits of liability, or
indemnification by Customer shall survive termination of this License for any
reason.

Reservation of Rights

All rights not expressly granted are reserved by CNC.

Trademarks

Mastercam is a registered trademark of CNC.


Windows, Windows 2000, Windows XP, and Windows Vista are registered
trademarks of Microsoft Corporation. Mastercam Verify is created in conjunction
with MachineWorks Ltd. Mastercam Backplot includes Copyrighted intellectual
property rights owned by NWD.

Printed in the United States of America.


Printed on recycled paper.

vii

Contents
1. The Post Debugger Interface ......................................... 1
X

The Main Window ................................................................ 2


The Menu Bar......................................................................... 4
The Toolbar ............................................................................ 5
Keyboard Shortcuts................................................................ 6

2. Using the Post Debugger.................................................. 7


X
X
X
X
X
X

Enabling the Debugger ......................................................... 8


Running the Debugger........................................................ 11
Running a Post .................................................................... 13
Tracing through a Post ....................................................... 14
Using Breakpoints .............................................................. 18
Watching Variables ............................................................ 21

3. The Debugger Windows ................................................. 25


X
X
X
X
X
X
X

The PST Output Window ................................................... 26


The NCI Output Window .................................................... 27
The NC Output Window ..................................................... 28
The Error Output Window .................................................. 30
The Watches Window ....................................................... 31
The Stack History Window................................................ 32
The Post Lists Window ...................................................... 33

viii Mastercam X3 / MP-EMP Post Debugger Users Guide

chapter 1

The Post Debugger


Interface
This chapter covers the following topics:

The Main Window . . . . . . . . . . . . . . . . . . . . . . . page 2


The Menu Bar . . . . . . . . . . . . . . . . . . . . . . . . . . . page 4
The Toolbar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . page 5
Keyboard Shortcuts . . . . . . . . . . . . . . . . . . . . . . page 6
Mastercams MP/EMP Post Debugger helps you find and
correct errors in your posts. Using the debugger, you can step
through the posting process a line at a time, while watching the
post produce the NC code. As you manipulate the posting
process, you can watch how variables change value and view a
stack trace of the post execution. In this chapter, you explore
the MP/EMP Post Debuggers interface.

2 MASTERCAM X3 / MP-EMP Post Debugger Users Guide

The Main Window


The MP/EMP Post Debuggers main window hosts a menu bar and
toolbar, as well as the debugger windows.
Figure 1-1: The Post Debuggers main window

THE POST DEBUGGER INTERFACE / The Main Window 3

The PST Output, NCI Output, NC Output, and Error Output debugger
windows are housed within the main window, and although they can
be sized and positioned individually, they cannot be dragged outside
of the main window.
The Stack History, Watches, and Post Lists windows, however, can be
moved to any convenient location on your screen (Figure 1-2) or even
to a second monitor.
Figure 1-2: Arranging the debuggers windows

4 MASTERCAM X3 / MP-EMP Post Debugger Users Guide

The Menu Bar


The Post Debuggers menu bar contains the commands you need to
work with the debugger. Table 1 describes each command.
Table 1: The menu bar commands
Menu

Command

File

Quit

Edit

Debug

Configuration
View

Description

Terminates the current session, but


leaves the debugger open
Exit
Terminates the current session, and
closes the debugger
Find
Searches for occurrences of a given
text string
Find Again
Searches for the next occurrence of
the previously searched text string
Run
Runs quickly through the post,
without building a stack history
Run Step
Runs through the post, while
building the stack history (much
slower than the Run command)
Break
Pauses the debuggers processing
Stop
Stops the debuggers processing
Step Into
Enters the currently highlighted
post block, or, if not on a post block,
executes the current line
Step Over
Executes all of the commands that
are part of the highlighted post
block, or, if not on a post block,
executes the current line
Step Statement Moves forward through the post one
statement at a time
Toggle
Adds or removes a breakpoint from
Breakpoint
the currently selected line
Add Watch
Adds the currently highlighted
variable to the Watches window
Displays the Configuration dialog
box
Watch
Turns the Watches window on or off
Stack
Turns the Stack History window on
or off
Post Lists
Turns the Post Lists window on or
off

THE POST DEBUGGER INTERFACE / The Main Window 5

Table 1: The menu bar commands (Continued)


Menu

Command

Description

Window

Cascade

Positions the PST Output, NCI


Output, NC Output, and Error
Output windows so that they
diagonally overlap
Positions the PST Output, NCI
Output, NC Output, and Error
Output windows horizontally
Vertically stacks the PST Output,
NCI Output, NC Output, and Error
Output windows
Activates the window selected in the
list
Displays this document
Displays the About dialog box

Horizontal

Vertical

[Window List]
Help

PDF
About

The Toolbar
The toolbar (Figure 1-3) contains a subset of the commands in the
menu bar. Table 2 describes each command.
Figure 1-3: The Post Debuggers toolbar

Table 2: The toolbar commands


Command

Description

Run

Runs quickly through the post, without


building a stack history
Pauses the debuggers processing
Stops the debuggers processing

Pause
Stop

6 MASTERCAM X3 / MP-EMP Post Debugger Users Guide

Table 2: The toolbar commands (Continued)


Command

Description

Step Into

Enters the currently highlighted post block,


or, if not on a post block, executes the
current line
Executes all of the commands that are part of
the highlighted post block, or, if not on a
post block, executes the current line
Moves forward through the post one
statement at a time
Runs through the post, while building the
stack history (much slower than the Run
command)
Adds or removes a breakpoint from the
currently selected line
Adds the currently highlighted variable to
the Watches window
Searches for occurrences of a given text
string
Searches for the next occurrence of the
previously searched text string

Step Over

Step Statement
Run Step

Break Point
Add Watch
Find
Find Next

Keyboard Shortcuts
For many of the debuggers commands, you can use the keyboard
shortcuts shown in Table 1-3.
Table 3: Keyboard shortcuts
Command

Keystroke

Add Watch
Break
Run
Find
Find Next
Select All
Step Into
Step Over
Step Statement
Stop
Toggle Breakpoint

Ctrl+W
F12
F5
Ctrl+F
F3
Ctrl+A
F11
F10
Ctrl+F11
Shift+F5
F9

chapter 2

Using the Post


Debugger
In this chapter, you will learn about:

Enabling the Debugger . . . . . . . . . . . . . . . . . . . page 8


Running the Debugger . . . . . . . . . . . . . . . . . . page 11
Running a Post . . . . . . . . . . . . . . . . . . . . . . . . . page 13
Tracing through a Post. . . . . . . . . . . . . . . . . . . page 14
Using Breakpoints . . . . . . . . . . . . . . . . . . . . . . page 18
Watching Variables . . . . . . . . . . . . . . . . . . . . . . page 21
The MP/EMP Post Debugger intercepts Mastercams posting
process, letting you take control and analyze, step by step,
whats happening as the post processor reads your parts NCI
file and outputs the NC code. In this chapter, you learn how to
start the debugger, as well as explore ways to use the debugger
to find errors in your posts.

8 MASTERCAM X3 / MP-EMP Post Debugger Users Guide

Enabling the Debugger


Before you can access the debugger, you must activate it in
Mastercam.
X To Enable the debugger
1 On your Windows Start menu, choose All Programs.

USING THE POST DEBUGGER / Enabling the Debugger 9

2 In the Mastercam X3 folder, choose MCAMX Control Panel

Applet.

3 In the Mastercam X Utility window, select Enable Post

Debugger.

10 MASTERCAM X3 / MP-EMP Post Debugger Users Guide

After you have activated the debugger, its button appears in the Post
processing dialog box:

USING THE POST DEBUGGER / Running the Debugger 11

Running the Debugger


The following procedure describes how to run the Post Debugger.
X To run the MP/EMP Post Debugger
1 In Mastercam, open a part that contains toolpaths.
2 In the Operations Manager, click the Post selected

operations button.

3 In the Post Processing dialog, select the NC file check box.

4 Click the Debugger button. The debugger intercepts

Mastercams post processing and displays its main window.

12 MASTERCAM X3 / MP-EMP Post Debugger Users Guide

5 Use the Debug menu (or the toolbar) commands to control

and watch the posting process.

USING THE POST DEBUGGER / Running a Post 13

Running a Post
How you use the debugger depends on what you are looking for in
your post. As you use the debugger, you will discover different ways to
find the information you need. To get you started, the following
sections describe some basic ways to use the debugger.
The simplest way to use the debugger is to click the Run button, which
causes the debugger to run the post at its fastest speed, populating the
various debugger windows with output. When the post finishes, you
can examine the contents of the windows, which provide a convenient
way to view the following files:

The NCI file that Mastercam generated for your parts


operationsMastercam generates this file before the
debugger takes control of the posting process.
The PST instructions that processed the NCI file into the NC
fileThe code in the PST file, which was probably supplied by
your Mastercam Reseller, is specific to the machine that will
cut the part.
The NC file, which is the final code that cuts your part
Mastercam creates this file by interpreting the NCI file as
directed by the PST file.
After running a post, you can also see errors that occurred. Such errors
provide clues to what may be wrong with a malfunctioning post. You
may be able to resolve post issues with the error information alone.

14 MASTERCAM X3 / MP-EMP Post Debugger Users Guide

Tracing through a Post


Instead of just running the post and examining the output, you will
often want to trace through a post step by step. When you do this, as
each instruction executes, you see the resulting output (if any). During
tracing, you can also verify the posts logic, which is the path that the
debugger takes through the post.
When it comes to tracing a post, you have many options. The following
procedures describe some common ways to trace.
X To trace with Step Into
The debuggers Step Into command lets you watch the post execute
one line at a time. Each time you click Step Into, the debugger
executes a line and updates its window to show the results. The
debugger then waits for you to issue another command. This
procedure demonstrates Step Into tracing.
1 Start the debugger. The debuggers NCI Output and PST

Output windows display the intermediate NCI instructions


and the PST file, respectively. The current PST line displays in
bold.

USING THE POST DEBUGGER / Tracing through a Post 15

2 Click the Step Into button. The debugger moves to the first

code line inside of the current post block.

3 Click Step Into again. If the current line is an instruction, the

debugger executes the instruction and moves to the next line,


as shown in the following figure. If the current line calls a post
block or function, the debugger jumps to that post block or
function (thus the name Step Into).

16 MASTERCAM X3 / MP-EMP Post Debugger Users Guide

4 Keep pressing Step Into to trace deeper and deeper into the

post, watching to see that the instructions execute in the order


that you expect.
X To trace with Run Step
The Run Step command Lets you watch the post processing as it
happens, without your having to continually click a button.
1 Start the debugger. The debuggers NCI Output and PST

Output windows display the intermediate NCI instructions


and the PST file, respectively. The current PST line displays in
bold.
2 Click the Run Step button. The debugger starts executing the

post, displaying the process as it converts the NCI file to NC


output.
3 Watch the NCI Output window to see the current line the post

is processing.

USING THE POST DEBUGGER / Tracing through a Post 17

4 Watch the PST Output window to see the debugger quickly

processing post lines.

5 Watch the NC Output window to see the post as it builds each

NC line. The windows main pane shows the previously output


lines. The Current output box shows the current line being
built.

18 MASTERCAM X3 / MP-EMP Post Debugger Users Guide

Using Breakpoints
Often, you dont want to debug an entire post from the beginning.
More likely, you want to trace from a specific location in your post.
Breakpoints make this type of debugging possible.
X To trace with breakpoints
1 Start the debugger. The debuggers NCI Output and PST

Output windows display the intermediate NCI instructions


and the PST file, respectively. The current PST line displays in
bold.
2 Click the Run button to execute the entire post and populate

the debuggers windows with output.


3 In the NC Output window, locate the instruction where you

want to start debugging.

USING THE POST DEBUGGER / Using Breakpoints 19

4 Double-click the NC line. The debugger highlights the NCI

and post lines that generated the code.

5 Right-click the highlighted post line, and choose Toggle

Breakpoint from the pop-up menu. A small arrow appears


next to the selected line.

6 Choose File, Quit to stop the debugging session, but leave the

debugger open.

7 In Mastercam, click the Post selected operations button, and

then click the debugger button in the Post processing dialog.


The debugger reactivates and waits for your command.

20 MASTERCAM X3 / MP-EMP Post Debugger Users Guide

8 Click the Run button. The debugger processes the post until it

gets to the breakpoint you set, where the debugger pauses and
waits for your command.
9 Click the Step Into button to start tracing from the

breakpoint.

USING THE POST DEBUGGER / Watching Variables 21

Watching Variables
Often, an invalid variable value is the cause of a post problem, so an
important part of debugging is watching to see how and where post
variable values change. The MP/EMP Debugger provides the Watches
window for monitoring variable values. When you add a variable to
this window, you can step through a post and see the variables value at
any point in the posting process.
X To watch a variable
1 Start the debugger.

2 If you do not see the Watches window, choose View, Watch

from the debuggers menu.

22 MASTERCAM X3 / MP-EMP Post Debugger Users Guide

3 In the PST Output window, locate the variable that you want

to watch.

4 Right-click the variable, and select Add Watch from the pop-

up menu.

USING THE POST DEBUGGER / Watching Variables 23

5 Trace through your post, watching for variable values and

changes in the Watches window.

24 MASTERCAM X3 / MP-EMP Post Debugger Users Guide

chapter 3

The Debugger Windows


In this chapter, you will learn about:

The PST Output Window. . . . . . . . . . . . . . . . . page 26


The NCI Output Window . . . . . . . . . . . . . . . . page 27
The NC Output Window . . . . . . . . . . . . . . . . . page 28
The Error Output Window . . . . . . . . . . . . . . . page 30
The Watches Window . . . . . . . . . . . . . . . . . . . page 31
The Stack History Window . . . . . . . . . . . . . . . page 32
The Post Lists Window. . . . . . . . . . . . . . . . . . . page 33
The Post Debugger displays debugging information in seven
child windows. This chapter describes each of these windows.

26 MASTERCAM X3 / MP-EMP Post Debugger Users Guide

The PST Output Window


The PST Output window (Figure 3-1) displays the currently active PST
file. As the debugger feeds the NCI file to the post, it works through the
PST Output windows contents, updating and building content in the
other debugger windows. For example, the NCI Output window
bolds the current line being processed by the post, whereas the NC
Output window displays NC code as it is output by the post.
Figure 3-1: The PST Output window

THE DEBUGGER WINDOWS / The NCI Output Window 27

The NCI Output Window


The NCI Output window (Figure 3-2) displays the NCI code that
Mastercam created from your part file. This is the non-machinespecific data that the post processor processes to create the machinespecific NC file. The NCI Output window uses bold text to show the
line currently being processed.
Figure 3-2: The NCI Output window

28 MASTERCAM X3 / MP-EMP Post Debugger Users Guide

The NC Output Window


The NC Output window (Figure 3-3) displays the NC code the post is
generating, along with other information such as the NC line number
and the number of the NCI code line that produced the output. The
Machine Type and Stream information is most useful with EMP posts.
Figure 3-3: The NC Output window

You can resize the columns to suit your needs or even collapse
columns to hide information. To resize a column, drag the vertical line
to the right of the column label. For example, when debugging a
traditional post, you might want to collapse the Machine Type and
Stream columns to hide that information, as shown in Figure 3-4.

THE DEBUGGER WINDOWS / The NC Output Window 29

Figure 3-4: Hiding columns in the NC Output window

30 MASTERCAM X3 / MP-EMP Post Debugger Users Guide

The Error Output Window


The Error Output window (Figure 3-5) shows any errors that occur
during post processing.
Figure 3-5: The Error Output window

THE DEBUGGER WINDOWS / The Watches Window 31

The Watches Window


The Watches window (Figure 3-6) displays the variable values that you
have selected with the Add Watch command. The window displays
both the previous and current values of a watched variable.
Figure 3-6: The Watches window

You can save a set of watch variables (called a watch set) by clicking the
Save button, or load a previously saved watch set by choosing its name
from the watch set drop-down list (Figure 3-7). You can also clear and
delete watch sets.
Figure 3-7: Saving and loading watch sets

32 MASTERCAM X3 / MP-EMP Post Debugger Users Guide

The Stack History Window


The Stack History window (Figure 3-8) shows the posts execution
path, as the debugger goes from one post block to the next.
Figure 3-8: The Stack History window

THE DEBUGGER WINDOWS / The Post Lists Window 33

The Post Lists Window


The Post Lists (Figure 3-9) window contains four tabs of reference
information, including the post group codes, as well as predefined and
user-defined strings, variables, and post blocks.
Figure 3-9: The Post Lists window

34 MASTERCAM X3 / MP-EMP Post Debugger Users Guide

671 Old Post Road


Tolland, CT 06084 USA
www.mastercam.com
Printed in the USA

Post Debugger Guide 1-883310-86-5