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:

Which is Which? Please be pacific, thank you...


Recommended Posts

Hi,

I got a preloadwcs instruction from this forum but I don't know which belongs which please help. Which section belongs to postblock? Which section belong wpc and where do I insert exactly? I tried but they failed may be I put into wrong section. I bold the first section and assum they are one section but where do I put? postblock? How about the other sections? Do we have a better way to present this easier to for understanding?

 

 

Thounsand words of "Thank yous and appriciations",

Steven.L

 

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

# Buffer 6 - G10 work offset preloads write, sort, read, output routines

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

#This section is designed to write the work offsets preloads to a buffer file, then sort them

#into accesding order and eventually output the preloads to the NC output files. These sections

#only get called if the use_g10wcs flag is on.

# Work offset preload buffer

 

test : 0 #Result variable

cnt1 : 0 #Loop counter number 1 for sort

cnt2 : 0 #Loop counter number 2 for sort

wc6 : 1 #Initial count for write buffer 6

rc6 : 1 #Initial count for read buffer 6

size6 : 0 #Buffer 6 size

 

tox3 = tox6 #Figures X Offset from machine zero

toy3 = toy6 - 25.5905 #Figures Y Offset from machine zero

toz3 = toz6 #Figures Z Offset from machine zero

 

fmt W 4 workofs6 #Buffer 6

fmt P 4 pofs6 #Buffer 6

fmt X 2 tox6 #Buffer 6

fmt Y 2 toy6 #Buffer 6

fmt Z 2 toz6 #Buffer 6

fmt B 15 cabs6 #Buffer 6

fmt X 2 tox3 #Buffer 2 X Offset from machine zero

fmt Y 2 toy3 #Buffer 2 Y Offset from machine zero

fmt Z 2 toz3 #Buffer 2 Z Offset from machine zero

 

workofsn : 0 #Temporary data for swap in buffer2

pofsn : 0 #Temporary data for swap in buffer2

toxn : 0 #Temporary data for swap in buffer2

toyn : 0 #Temporary data for swap in buffer2

tozn : 0 #Temporary data for swap in buffer2

coutn : 0 #Temporary data for swap in buffer2

 

fbuf 6 0 6 0 0 #Buffer 6

 

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

preloadwcs #Output G10 preloads from Buffer6

#This postblock is called from the PSOF postblock and is designed to output the WCS

#preloads to the beggining of the NC output file and only if the use_g10wcs flag is

#active.

pg10sort #Sort preload buffer in accesnding order before output

 

#read preload buffer and output preloads

rc6 = 1

size6 = rbuf (six, 0)

#"(***********************************************)", e$

*e$

"(***********************************************)", e$

"(*********** WORK COORDINATES START **********)", e$

while rc6 <= size6,

[

workofs6 = rbuf (six, rc6)

#"workofs6 = " *workofs6, e$ #debug

#"*pofs6 = ", *pofs6, e$ #debug

 

if workofs6 < 6,

[

pofs6 = pofs6 + 6

pbld, n$, *sgabsinc, "G10", "L2", *pofs6, *tox3, *toy3, *toz3,

"(", *cabs6, ")" e$ #Offsets G54 - G59

]

else, pbld, n$, *sgabsinc, "G10", "L20", *pofs6, *tox3, *toy3, *toz3, "B0.", "(", *cabs6, ")", e$

#Extended offsets g54.1 P1 - P48

]

*e$

"G11", e$

 

"(*********** WORK COORDINATES END **********)", e$

 

pg10sort #Sort preload work offsets in accending order

#This postblock is designed to sort the wcs preload buffer in accending order. This

#postblock is called

#from the preloadwcs postblock. DO NOT MODIFY this post block unless you are

#absolutely sure of what you

#are doing.

rc6 = 1

size6 = rbuf (six, 0)

 

cnt1 = 1 #intialize counters

cnt2 = 1 #intialize counters

 

while cnt1 < size6, #loop 1 - loop 1 time less than the size of the buffer

[

size6 = rbuf (six, 0)

while cnt2 <= size6 - cnt1, #loop 2 - loop 1 less every time

[

rc6 = cnt2 #set buffer read counter to current loop counter value

#(Current record to read)

workofs6 = rbuf (six, rc6) #Read current and next record from buffer

workofsn = rbuf (six, rc6)

if workofsn < workofs6, #Check and swap records if next offset is less

#than current

wc6 = cnt2 #initalize write counter to current loop counter value

#(current record to write)

workofsn = wbuf (six, wc6) #Swap records by writing back into buffer.

#Next into current, current into next

workofs6 = wbuf (six, wc6)

]

cnt2 = cnt2 + 1 #increment loop counter 2

]

cnt2 = 1 #Reset loop counter 2 to start at record 1

cnt1 = cnt1 + 1 #increment loop counter 1

]

 

pg10wcs_writbuf #Buffer 6 works offset preload buffer

#This postblock is called from pwrtt and only if the use_g10wcs flag is active.

#This postblock is designed to write out the WCS and tool origin information to the

#preload buffer. The preload buffer will be scanned and checked to see if the WCS was

#already

#written to the buffer, if not the wcs is written to the buffer.

test = 0

size6 = rbuf(six, 0) #Get size of buffer

 

#read buffer and compare current workofs value with one read from buffer.

#If current workofs matches one already in buffer set flag to not process.

 

while rc6 <= size6,

[

workofs6 = rbuf (six, rc6)

if workofs$ = workofs6, test = 1

]

 

#If workofs doesn't match one in the buffer, write it to the buffer

# with the P value and tool origin.

 

if test = 0,

[

cabs6 = atan2 (m7$, m9$)

workofs6 = workofs$

pofs6 = workofs$ - 53

if workofs6 < 54, pofs6 = workofs$ -5 #Extened offsets P1 - P48

tox6 = tox$

toy6 = toy$

toz6 = toz$

#cabs6 = cout

workofs6 = wbuf (six, wc6)

]

rc6 = 1 #reset read counter for next pass

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