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:

Buffer help


Acro Engineering
 Share

Recommended Posts

I think buffers are the only way to get this to work? Output needs to look like this:

 

X, Y, Bow, Feedrate

 

Bow is a calculation TAN of sweep/4 but for the next move...

 

Feedrate is the feed and offset of the next move, negative for left positive for right...

 

Here is my current code:

code:

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

# Buffer Functions

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

rc1 : 1

wc1 : 1

size1 : 0

gcode_1 : 0

ccomp_1 : 0

x_1 : 0

y_1 : 0

sweep_1 : 0

fr_1 : 0

 

fbuf 1 0 6 0 0

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

# POSTLINES

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

pfr # Feedrate

if fr$ = -1, fr$ = prv_fr$

if fr$ = -2, fr$ = zero

quality = fr$

if ccomp$ = 2, neg_feed = 1

if neg_feed = 1, quality = -quality

if ccomp$ = 4, neg_feed = 0

*quality

!fr$

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

# Buffer Read / Write

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

pwritbuf1 # Write buffer number 1

gcode_1 = gcode$

ccomp_1 = ccomp$

x_1 = x$

y_1 = y$

sweep_1 = sweep$

fr_1 = fr$

gcode_1 = wbuf(one,wc1)

 

preadbuf1 # Read buffer number 1

gcode_1 = rbuf(1,rc1)

gcode$ = gcode_1

ccomp$ = ccomp_1

x$ = x_1

y$ = y_1

sweep$ = sweep_1

fr$ = fr_1

 

preadnext # Read buffer number 1

gcode_1 = rbuf(one,rc1)

 

preadbuf

size1 = rbuf(one,zero)

preadbuf1

preadnext

if gcode_1 > one, bow = tan(sweep_1/four)

else, bow = zero

rc1 = rc1 - 1

if gcode$ = zero, prapidout

if gcode$ = one, plinout

if gcode$ > one, pcirout

 

preadlast

size1 = rbuf(one,zero)

preadbuf1

bow = zero

if gcode$ = zero, prapidout

if gcode$ = one, plinout

if gcode$ > one, pcirout

 

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

# Axis linear/circular motion

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

prapidout # Linear line movement - at rapid feedrate

*x$, *y$, *bow, pfr, e$

 

plinout # Linear line movement - at feedrate

prapidout

 

pcirout # Circular interpolation

prapidout

 

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

# POSTLINES, PRE-DEFINED

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

pheader$ # File header

 

psof0$ # Start of file for tool zero

psof$

 

psof$ # Start of file for non-zero tool

 

ptlchg0$ # Null tool change

ptlchng$

 

ptlchg$ # Tool change

 

peof0$ # End of file for tool zero

peof$

 

peof$ # End of file for non-zero tool

size1 = rbuf(1,0)

while rc1 < size1, preadbuf

if rc1 = size1, preadlast

 

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

# Axis motion

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

prapid$ # Linear line movement - at rapid feedrate

pwritbuf1

!x$, !y$

 

plin$ # Linear line movement - at feedrate

prapid$

 

pcir$ # Circular interpolation

prapid$

Now for the problems:

 

1. If selecting approach or retract positions I can't get them output to the NC code? They are in the NCI... I don't think the buffer is getting them?

 

The code is assembled as such:

X, Y, Bow, FeedRate

 

Bow is calculated, Tan of Sweep/4. Bow is output on the line previous to the arc move...

 

FeedRate is negative for left offset and positive for right offset. FeedRate is output on the line previous to the move...

 

2. I can't get the feedrate for the next move on the line previous, somehow I got it to work for bow but can't get feedrate to work?

 

 

Is there a way to retrieve next line information from the NCI without using buffers?

Link to comment
Share on other sites

I figured out how to get my approach point but do have a question to set my if statements...

 

What variables are used for approach = true and retract = true? Here is what I want:

 

psof$

if approach = true,

pwritbuf1

 

pretract

pwritbuf1

 

peof$

if retract = true, pretract

size1 = rbuf(1,0)

while rc1 < size1, preadbuf

if rc1 = size1, preadlast

 

Still trying to figure out how to get my feedrates backed up a line?

Link to comment
Share on other sites

I did the keep bit to read the buffer... I think I have everything working now with the buffer method but would love to go a step further and try the variable method...

 

ak762,

I think what your saying is to save the NCI line to variables like prvx, prvy, etc then run the next line and output prvx and prvy on that line?

Link to comment
Share on other sites

quote:

I think what your saying is to save the NCI line to variables like prvx, prvy, etc then run the next line and output prvx and prvy on that line?

it is similar as look ahead at one step of next move

you will find description in MP postprocesor reference guide

it my favorite approach when I try to catch next x y z movement for special purpose

Link to comment
Share on other sites

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...