Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

z_min z_max


kkominiarek
 Share

Recommended Posts

I've put many hours into this over this past week and I can't figure it out.

 

I want to post each tool z_min z_max value in the tool table at the start of program.

(i have the tool table)

 

....what I want....

(TOOLS LIST)

( TOOL-1. - .75" ROUGHER )

( Z_MIN -.500 )

( Z_MAX - 2.50 )

( TOOL-2. - .75 E MILL )

( Z_MIN -.900 )

( Z_MAX - 3.50 )

( TOOL-3. - .75 OD X 45 DEG C'SNK )

( Z_MIN -.753 )

( Z_MAX -.753 )

 

Here are some portions of my post.....

 

 

tooltable : 1 #Read for tool table and pwrtt - use tool_table to disable

output_z : yes #Output Z Min and Z Max values (yes or no)

 

 

z_min : 99999 # Min Z

z_tmin : 99999 # Overall min Z

z_max : -99999# Max Z

z_tmax : -99999# Overall max Z

 

 

fmt Z 2 z_tmin # Total z_min

fmt Z 2 z_tmax # Total z_max

fmt Z 2 min_depth # Tool z_min

fmt Z 2 max_depth # Tool z_max

 

code:

# --------------------------

# Tooltable Output

# ------------------------

pwrtt # Write tool table, scans entire file, null tools are negative

tnote = t

strtool = ucase(strtool)

if t >= 0, "(", tnote, "-", strtool, ")"

if t >= 0, tcnt = tcnt + 1

 

 

 

 

 

ptravel # Tool travel limit calculation

if z_min < z_tmin, z_tmin = z_min

if z_max > z_tmax, z_tmax = z_max

 

 

if output_z = yes & tcnt > 1,

[

"(OVERALL MAX - ", *z_tmax, ")", e

"(OVERALL MIN - ", *z_tmin, ")", e

]

 

 

# -------------------------------

# Buffer 5 Read / Write Routines

# -------------------------------

pwritbuf5 # Write Buffer 1

b5_gcode = gcode

b5_zmin = z_min

b5_zmax = z_max

b5_gcode = wbuf(5, wc5)

 

preadbuf5 # Read Buffer 1

size5 = rbuf(5,0)

b5_gcode = 1000

min_depth = 99999

max_depth = -99999

while rc5 <= size5 & b5_gcode = 1000,

[

if rc5 <= size5, b5_gcode = rbuf(5,rc5)

if b5_zmin < min_depth, min_depth = b5_zmin

if b5_zmax > max_depth, max_depth = b5_zmax

]

As always, your guidance is greatly appreciated.

Link to comment
Share on other sites

if you give us an idea of what is coming out currently and what is wrong with it we might be able to get you a little closer.

 

With tooltable set to 1, you would need to add a call to capture the min/maz of the last tool at the PSOF postblock. Set tooltable to 3 and it will call pwrtt when the 1003 end of file line is read making the call from PSOF unnecessary.

 

Again without a few more details as to what you are currently getting for output and what is incorrect about that output we are only guessing.

Link to comment
Share on other sites
  • 2 weeks later...

Haven't had too much time to work on post this past week.

 

Here is a whole lot of info...

 

**This is what I want.**

 

(TOOLS LIST)

(TOOL-1 - .75" ROUGHER)

(Z_MAX - Z-.900)

(Z_MIN - Z .100)

(TOOL-2 - .75 END MILL)

(Z_MAX - Z-.900)

(Z_MIN - Z .100)

(TOOL-3 - .75 OD X 45 DEG C'SNK)

(Z_MAX - Z-.753)

(Z_MIN - Z .100)

 

**This is what my post outputs now.**

 

(TOOLS LIST) pheader 42

(MAX - Z-99999.) pheader p__13:968 42

(MIN - Z99999.) pheader p__13:968 42

(TOOL-1.-.75" ROUGHER) pwrtt 42

(TOOL-2.-.75 E MILL) pwrtt 42

(TOOL-3.-.75 OD X 45 DEG C'SNK) pwrtt 42

 

Portions of my post......

code:

# -------

# GENERAL OUPUT SETTINGS

# -------

tooltable : 1 #Read for tool table and pwrtt - use tool_table to disable

output_z : yes #Output Z Min and Z Max values (yes or no)

 

 

# -------

# MISC VARIABLES

# -------

z_min : 99999 # Min Z

z_tmin : 99999 # Overall min Z

z_max : -99999# Max Z

z_tmax : -99999# Overall max Z

 

bldnxtool : yes # Build next tool table

 

 

# -------

# Buffer 3 - Holds the variable 'tlplnno' for each toolpath segment

# -------

rc3 : 1

wc3 : 1

fbuf 3 0 1 0 # Buffer 3

 

 

# -------

# Buffer 4 - Holds the variable 't' for each toolpath segment

# -------

rc4 : 1

wc4 : 1

fbuf 4 0 1 0 # Buffer 4

 

 

# ------

# Buffer 5 - Min / Max

# ------

b5_gcode : 0

b5_zmin : 0

b5_zmax : 0

rc5 : 2

wc5 : 1

size5 : 0

 

fbuf 5 0 3 0 #Min / Max

 

 

# ------

# Toolchange / NC output Variable Formats

# ------

fmt Z 2 z_tmin # Total z_min

fmt Z 2 z_tmax # Total z_max

fmt Z 2 min_depth # Tool z_min

fmt Z 2 max_depth # Tool z_max

 

 

 

# ------

# Tool Comment / Manual Entry Section

# ------

 

pspc # Creates spaces based tool level setting

if sav_spc = one & omitseq = no, " "

 

 

# ------

# Start of File and Toolchange Setup

# ------

 

psof #Start of file for non-zero tool number

 

ptravel

pwritbuf5

pcuttype

toolchng = one

if ntools = one,

[

#skip single tool outputs, stagetool must be on

stagetool = m_one

!next_tool

]

 

 

# ------

# Tooltable Output

# ------

pwrtt # Write tool table, scans entire file, null tools are negative

tnote = t

strtool = ucase(strtool)

if t >= 0, "(", tnote, "-", strtool, ")"

if t >= 0, tcnt = tcnt + 1

PWRITBUF5

 

ptravel # Tool travel limit calculation

if z_min < z_tmin, z_tmin = z_min

if z_max > z_tmax, z_tmax = z_max

 

 

pheader

 

"(TOOLS LIST)

 

 

if met_tool = one, #Metric constants and variable adjustments

[

ltol = ltol_m

vtol = vtol_m

maxfeedpm = maxfeedpm_m

]

 

#spaces=0

if output_z = yes & tcnt > 1,

[

"(OVERALL MAX - ", *z_tmax, ")", e

"(OVERALL MIN - ", *z_tmin, ")", e

]

#spaces=sav_spc

 

ptlchg_com

 

ptlchg_com #Tool change common blocks

pcom_moveb

c_mmlt #Multiple tool subprogram call

#ptoolcomment

 

spaces=0

if output_z = yes,

[

preadbuf5

if (opcode > 0 & opcode < 16) | opcode = 19,

[

n, pspc, "(", "MAX - ", *max_depth, ")", e

n, pspc, "(", "MIN - ", *min_depth, ")", e

]

]

spaces=sav_spc

 

 

# ------

# Buffer 5 Read / Write Routines

# ------

pwritbuf5 # Write Buffer 1

b5_gcode = gcode

b5_zmin = z_min

b5_zmax = z_max

b5_gcode = wbuf(5, wc5)

 

preadbuf5 # Read Buffer 1

size5 = rbuf(5,0)

b5_gcode = 1000

min_depth = 99999

max_depth = -99999

while rc5 <= size5 & b5_gcode = 1000,

[

if rc5 <= size5, b5_gcode = rbuf(5,rc5)

if b5_zmin < min_depth, min_depth = b5_zmin

if b5_zmax > max_depth, max_depth = b5_zmax

]


It seems as if I'm close, but not quite there yet.

Link to comment
Share on other sites

This should not matter but think you might need lower case here:

code:

pwrtt     # Write tool table, scans entire file, null tools are negative

tnote = t

strtool = ucase(strtool)

if t >= 0, "(", tnote, "-", strtool, ")"

if t >= 0, tcnt = tcnt + 1

PWRITBUF5 <-------------

I would take everything that is realted to the buffers and save them as a different varaibles. I would copy all of the other stuff that goes with the tooltable and remane them as well like pwrtt2, ptooltable2 and so forth. Now you would put the new variable here in the pheader:

code:

pheader 

pwritbuf7

"(TOOLS LIST)

 

 

if met_tool = one, #Metric constants and variable adjustments

[

ltol = ltol_m

vtol = vtol_m

maxfeedpm = maxfeedpm_m

]

 

#spaces=0

if output_z = yes & tcnt > 1,

[

"(OVERALL MAX - ", *z_tmax, ")", e

"(OVERALL MIN - ", *z_tmin, ")", e

]

#spaces=sav_spc

 

ptlchg_com


I would also go as far as renaming all of the z_tmax, and Z_tmin to z_max2, and z_tmin2 as well so you create your own little things if you are looking to have the max mins at the toolchage respectivly. I would wait for Roger and Jim to see what you posted before going on the task I just mentioned. I would not want you to waste time with something you may not need to do.

 

HTH

Link to comment
Share on other sites
  • 2 weeks later...

quote:

---------

...also is there switch I can set so that when I post a program it tells me what part of the post did what?

----------

 

Set fastmode in the post to 'no' or 'off' (forget which one)

 


I want to have the mill.set output which line does what....I changed the fastmode setting but did not get the result I wanted.

 

Is there a switch to for the mill.set file to output which line does what?

Link to comment
Share on other sites

This is from the Cd and will be in parts:......................................................................................

quote:

The post processor contains several pre-defined switch variables that can be used to display a listing of the

NC code and/or append useful information to the NC output file. The variable bug1 provides the option of

listing the NC file after post processing. The variables bug2, bug3 and bug4 will help you debug the post

processor by adding extra information into the NC output file. This output is essential for tracing the code

execution if debugging the post becomes necessary.

bug1 : 2 # 0=No display, 1=Generic list box, 2=Editor

bug2 : 30 # Append postline labels (column position)

bug3 : 0 # Append whatline no. to each NC line?

bug4 : 1 # Append NCI line no. to each NC line?

Note: You must set the fastmode variable to no or 0 to enable these debug switches. Also note that

when fastmode is set to 1, the post processor displays no progress-indicator dots on the monitor to let

you know the program is still running. Make sure to give the post sufficient time to complete processing

before assuming there is a fault in the post.

fastmode : 0 # Posting speed optimization (set to 0 for debug)

You can leave bug1, bug2, bug3, bug4 set according to your preferences and toggle all debugging off or

on by setting the fastmode switch to 0 or 1, respectively.

The bug1 variable

The variable bug1 can be used to control the option to display the NC program after posting. If bug1 is set

to 1, a program listing will be displayed in a generic scrollable window. A setting of 2 lists the program in

the default text editor as specified in Mastercam’s configuration. Setting bug1 to 0 turns this function off.

Note: When posting through the Operations Manager in Mastercam, the edit checkbox in the post

processor dialog (shown below) will override this variable.

 

The bug2 variable

The bug2 variable is one of the most useful tools for debugging a post. When this variable is set to a

positive value, it can be used to append postblock labels to the NC file. When set to a positive value,

this variable appends the label of the first postblock called and, if additional postblocks are called,

displays the last postblock called to each NC output line. The appended information starts in the

column after the value specified.

If bug2 is set to a negative value, it will display all the postblock labels that have been called in the post

even if output did not occur as a result of executing the instructions in that postblock. Setting this

variable to 0 will omit the postblock label.

 

Bracketed postblocks are identified in debugging by the post line number of the occurrence of the open

bracket (starting at zero).

In the following example, notice the postline label appended to the output line is p__1:250.

N10 G01 X1.0 Y2.0 Z3.0 p__1:250

In this example, p__1 indicates the second occurrence of the open bracket ( [ ) and that the bracket was

located on post line number 250.

The bug3 variable

The bug3 variable is rarely used. Setting bug3 to 1 adds the value of the variable whatline to the end of

each line of NC code displayed on the screen. The use of the variable whatline is no longer

recommended. The pre-defined variable whatno can be set to yes to ignore the whatline branching

structure in the post.

Note: It is strongly recommended that the variable whatno be set to 1 to ignore the whatline branching

feature.

See Volume 3, Numeric Variables for more information

The bug4 variable

Like bug2, the bug4 variable is extremely useful for debugging a post. Setting this variable to 1 adds

the current NCI file line number to the end of each line of NC code displayed on the screen (0 = no, 1 =

yes). You can then open the NCI file to verify the NCI line responsible for the output.

Note: The NCI line number is the actual physical row number that the NCI line is located on in the

editor.

When set to a negative value, bug4 alters the forced output of variables prefixed with the tilde character

(~). The variable is output with the variable name and unformatted. This allows the post writer to see

the value as it is stored in memory (the precision is not altered).

Link to comment
Share on other sites

...............................................................................................................................

code:

Error messages in MP

When an error is detected in the .PST file, a warning is posted on the screen in the form of:

Message 1

Error message...

Message 2 Postline number...and/or postblock label...

Press Enter

Message 3 Program execution halted due to error(s) in .pst

Press Enter

The first message indicates what kind of error has been encountered. The second message tells you

where to look in order to fix it and describes this location by providing:

♦ the exact line number where the error occurred

♦ the postline label

♦ line number and the postline label

Note: The “line number” referenced by the error message is the number of the line in the post file

where the error occurred. Some text editors display the line number, or can be configured to display

these numbers.

The third message tells you that post execution has been halted if a fatal error has occurred.

Common error messages

This section lists common error messages, describes their causes, and suggests a response.

Two arguments (comma) expected.

postline number...

This error most commonly occurs when a function requiring two arguments is passed a single

argument.

Open the post file for editing and go to the postline number listed in the error message.

Post Functions for more information on the correct syntax for the function in question.

Close parenthesis expected for single argument function.

postline number...

This error can occur when you provide more than one argument to a single argument function

Open the post file for editing and go to the postline number listed in the error message.

Post Functions for more information on the correct syntax for the function in question.

Cannot write record 0. in buffer..., records start at number 1.

Postblock label...

This error usually occurs when you initialize a "write counter" variable to zero.

To correct this problem, locate the write counter in the initialization list and change it from

an initial value of zero to one.

wc1 : 1

Cannot read record... in buffer...buffer is too small.

Postblock label...

This error typically occurs when you attempt to read beyond the last record in a buffer file.

To correct this problem, consider checking the size of the buffer by reading record 0, and

testing the value of your "read counter" before attempting to read from the buffer. For

example:

size1 = rbuf(1, 0)

if rc1 <= size1, preadbuf1

Variable not defined: ...

Postline number...

This message indicates that the variable has not been declared in the post. This error can also occur if a

variable name is misspelled.

To declare a user defined variable in the post, it must be formatted or initialized.

Divide by zero error: -1.0E-8 < divisor < 1.0E-8"

Postblock label...

This message indicates that a division by zero was attempted and a math error generated, probably by a

postblock formula. It is not legal to divide by zero.

Check whether the formula contains a variable that is used in the divisor. If so, make sure

that the variable has been read in and is not 0.

The following example shows a while loop with a user-defined question inserted to ensure that the user

enters a non-zero number.

fq 1 tpi Enter Number of Threads Per Inch...

ptap # Rigid Tap Cycle

while tpi = 0, q1

frplunge = ss / tpi

...

Unknown g code: ...

Postblock label...

This error message indicates that the Gcode read from the NCI file is not recognized by the post

executable.

The NCI file may be corrupt or the wrong MP executable may have been specified in

question 91.

Variable prv_ ... not defined.

Postline number...

Typically this error occurs when you attempt to force out the previous value of a variable using the ‘*’

or ‘~’ symbols.

*prv_ccomp

Postblock cannot be forced with '*' or '!'.

postline number…

Postblock calls can be controlled with Boolean tests, but are not considered to be modal or non-modal.

The symbols ‘*’ or ‘!’ are only to be used on variables and strings

Go to the line number indicated. Look for a postblock call prefixed with ‘*’ or ‘!’ and

remove that symbol.

Selector variable gcode = ...

out of range for string select.

postblock label…

This error message is given when the post attempts to access a string select table that contains less

elements than the value of the selector variable.

First try to find out what string select table(s) use the variable gcode as the selector variable.

Next, try to locate the target string in the postblock label listed. Finally, use one of the

three methods below to fix the problem:

1. Change the value of the selector variable prior to accessing the table.

gcode = 0

*sgcode

2. Consider using one of the strings defined in the table directly.

*sg00

3. Use a literal string.

"G00"

Subprogram cannot be merged with itself.

Postblock Label...

This error can occur when using the mergesub, mergeaux, and mergeext commands.

 

Subprograms and Lathe canned cycle output

With the addition of subprograms and Lathe canned turning cycles in Mastercam Version 8, it became

necessary to stop the NC output to produce the correct machine code. Mastercam continues to produce

the tool motion in the NCI for backplot and verify, and the post executable stops the NC output when

the data is redundant. Using the debugging switches overrides the default behavior of the post

executable and forces the output of all NCI data to the NC output file.

See Volume 2, How Subprograms Work for more information on subprograms.

Debugging posts with buffer files

When working with more complex posts, it is often necessary to use buffers to store and retrieve data.

Buffers can be saved as text for debugging by activating the second parameter in the fbuf function.

fbuf 1 1 9 0 # Declare buffer one (9 Reals, Save text)

In the code example above, the second parameter in the fbuf function is set to 1. This tells the post

executable to write the buffer to disk as an ASCII text file using the file name specified by the predefined

string sbufname1. The resulting file can be opened in a text editor to examine the records.

See Volume 2, How Buffer Files Work for detailed information on using buffers.

Notes on no_updprv and nc_lout

The variables no_updprv and nc_lout allow control on the updating of the previous (prv_) variable by

testing a prv_ value while the output line is being generated and preventing MP from writing over the

value until after the line is output. 25 variables can be collected internally for the update. These

include:

♦ grave accent (`) variables

♦ variables associated with string selects

♦ undressed variables (variables without a prefix)

♦ forced (*) output variables

no_updprv set to 1 automatically updates the previous variables when the line is output.

no_updprv set to 2 does not perform any previous update on the variables and the post must update the

variables with the exclamation update (!).

To help determine if output occurred, the variable nc_lout is set to the current internal call level

immediately after the output postline. If no output was generated, nc_lout is set to -1.

Note: The post must test the postline immediately after the output postline.

nc_lout is reset to -1 after the postline is output and the output string is empty. no_updprv also prevents

MP from updating x, xr, xh with themselves.

Note: Bug statements (bug2, bug3 and bug4) disrupt this function.

Link to comment
Share on other sites

thanks crazy.....

 

I still don't have zmin zmax for each tool posting, but i'm pecking away at it..... banghead.gif

 

I just noticed that I have 2 BUFFER 5 sections.

 

1) BUFFER 5 read write routines

2) BUFFER 5 min/max

 

I didn't rec. any error specific to this yet, but is this a problem waiting to happen?

Link to comment
Share on other sites
  • 5 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...