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:

mpmaster g10 output!


Recommended Posts

Hi

 

I have been modding the mpmaster post to suit a mori seiki nh5000 dcg!

i pretty much have done all the main things i wanted but cannot get it to output the g10(workoffsets) lines at head of prog!

Also copied bits and peices from an old post, that wont run on the m/c but outputs ok for that post but does not work when copied into mpmaster!

what is the best way to acheive the g10 lines!

 

thanks in advance

Link to comment
Share on other sites

I have this in my post,

 

#Add in after psof

pbld, n$, "G10", p_num, *tox$,*toy$,*toz$, e$

 

#Add in after pwcs

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

# WKORK OFFSETS G10 OUTPUT

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

p_num #G10"P" Number

if wcstype = two | wcstype > three,

[

pnum = workofs$

if sav_mi8 = 1, workofs$ = sav_pnum

]

if pnum < 6,

[

pnum = workofs$ + 1

"L2", *pnum

]

else,

[

plnum = pnum - 5

"L20", *plnum

]

 

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

 

#Add in after Variable Formats

fmt P 4 pnum #"P" Number

fmt P 4 plnum #"P" Number

fmt X 2 tox$ #X position output

fmt Y 2 toy$ #Y position output

fmt Z 2 toz$ #Z position output

 

Add in after General Output Settings

sav_pnum : 0 #saved "P" number (Not a switch)

 

 

Hope this helps

Link to comment
Share on other sites

Hey Craig, how/where are you generating the numbers from/for the G10 calls?

 

We use G10 calls in all of our programs, but they are usually just entered manually by measuring in Solidworks, or with our offset spreadsheet. I've always wondered if there was a decent way to get them to come straight out of Mastercam, since the data is all there (we bring in the complete tombstone/fixtures/everything).

Link to comment
Share on other sites

All of my programs output G10 values. I use buffers to sort and output them

The end up like so in the program:

(***********************************************)

(*********** WORK COORDINATES START **********)

G90 G10 L20 P1 X-5.56 Y-12.3871 Z2.8 B0. ( B0. )

G90 G10 L20 P2 X-2.8 Y-12.3871 Z-5.56 B0. ( B90. )

G90 G10 L20 P3 X5.56 Y-12.3871 Z-2.8 B0. ( B180. )

G90 G10 L20 P4 X2.8 Y-12.3871 Z5.56 B0. ( B270. )

G90 G10 L20 P5 X-1.9516 Y-12.3871 Z5.9114 B0. ( B315. )

G90 G10 L20 P6 X5.9114 Y-12.3871 Z1.9516 B0. ( B225. )

 

G11

(*********** WORK COORDINATES END **********)

 

 

Here are the post blocks to get it.

A preloadwcs in psof starts it...

 

 

 

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

Craig and Zoober, so right now we bring stuff in with center of the pallet as the main origin and WCS, and create Tplanes with origins wherever we need them.

 

If I'm reading correctly, that post block will calculate the distance from the center of the pallet to whichever Tplane I'm using, taking into account the B axis angle of that Tplane? That is fantastic. :o

 

Zoob, from your example of posted code, I can tell the Toyodas are configured differently than my machines. The machine I'm using right now has a center of rotation of:

 

X-14.3718

Y-32.6772

Z-31.88039

 

Where would I plug those into that post block to make it output correct numbers?

Link to comment
Share on other sites

Joe, look above where I format tox, toy, and toz

On our machines, X and Z are CL of pallet. Y is 25.5905 above top of pallet. I use the calc in the formatting below to do it.

 

 

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

Link to comment
Share on other sites
My setup guys

You have setup guys? :unsure:

We have guys that will enter anything but the right numbers.

That is why I do the calcs inside the post.

As long as fixture stackups are held, these G10 numbers are "good to go".

I give them a dimension or two to prove, but they change NOTHING.

Link to comment
Share on other sites

Joe, look above where I format tox, toy, and toz

On our machines, X and Z are CL of pallet. Y is 25.5905 above top of pallet. I use the calc in the formatting below to do it.

 

 

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

 

So if I do:

 

 

 

tox3 = tox6 - 14.3718 #Figures X Offset from machine zero

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

toz3 = toz6 - 31.8804 #Figures Z Offset from machine zero

 

 

Will that add those negative numbers to whatever distance it calculates from the WCS to the Tplane? If I posted a program that had the Tplane with the exact same origin as the main WCS (center of pallet), would it output G90G10L2P1X-14.3718Y-32.6772Z-31.8804 ?

Link to comment
Share on other sites

Yes. Because the tox values are the values from WCS.

WCS zero is equal to:

tox = 0

toy = 0

toz = 0

 

So.........

0-(+14.3718) = -14.3718

0-(+32.6772) = -32.6772

0-(+31.8804) = -31.8804

 

Hope this makes sense.

 

Also, if you do not need the G11, you can omit.

Link to comment
Share on other sites

Hey Zoober

 

have added this to my post! bearing in mind i'm a bit new to post editing(i can see the math/ logic in the statements) but can only get it to output

 

(***********************************************)

(*********** WORK COORDINATES START **********)

 

G11

(*********** WORK COORDINATES END **********)

 

i also get pst errors :-The formula/boolean does not terminate properly and :-Label has not been defined[34]about six or seven times!(the (34) is different in each case)!

 

Any Ideas,

 

Jason

Link to comment
Share on other sites

Check to see if these variables are initialized:

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

 

make sure these postblocks exist:

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

# Buffer 2 - Holds the tool comment info for tool list at beginning of program

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

rc2 : 1

wc2 : 1.

fbuf 2 0 80 0 1 # Buffer 2

 

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

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

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

rc3 : 1

wc3 : 1

fbuf 3 0 1 0 0 # Buffer 3

 

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

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

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

rc4 : 1

wc4 : 1

size4 :1

fbuf 4 0 1 0 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 0 #Min / Max

******************************************************************************************************

 

make sure these postblocks exist:

 

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

if rotaxis$ > 0 | rotary_type$ > 0 | mill5$ <> 0,

[

sav_rot_on_x = rot_on_x

output_z = no$

]

if vmc = 0 & tlplnno$ <> 2, sav_rot_on_x = rot_on_x

if vmc = 1 & tlplnno$ > 1, sav_rot_on_x = rot_on_x

sav_rot_on_x = rot_on_x #Uncomment this line to output rotary axis value even when it's not used

 

# Buffer info for tool list

tlplnno$ = wbuf(3,wc3) #Buffers out tool plane values

if t$ > zero,

[

wc2 = t$

strtool$ = wbuf(2, wc2)

wc4 = t$

t$ = wbuf(4, wc4) #Buffers out tool number values

]

ptravel

pwritbuf5

pg10wcs_writbuf

 

 

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

# Modified 8-11-09 RB to place tools in numeric orderusing Buffer 2 and 4

tnote = t$

toffnote = tloffno$

tlngnote = tlngno$

spaces$=0

size4 = rbuf(4, 0)

rc4 =1

while rc4 <= size4,

[

t$ = rbuf(4, rc4)

 

if t$ > zero,

[

rc2 = t$

strtool$ = rbuf(2, rc2)

if tcr{:content:}gt;0, "(", *t$, ptspace, " * ", plistcomm, " * ", ")", e$

if tcr$=0, "(", *t$, ptspace, " * ", plistcomm, " * ", ")", e$

!tcr$

]

]

rc4 =1

**********************************************************************

Make sure all variables are initialized.

If you get errors of Label has not been defined[34],

check line #34, where the line # is those inside the bracket. Here, it is line 34.

 

Always back up post before editing, always prove out post!

The info above may not be complete for your post! TEST IT!

Link to comment
Share on other sites

I posted a zip file containing a V9 pst and txt file along with a sample mc9 file for G10 output that outputs the origin of each plane relative to the mastercam origin (centerline of pallet). You could simply update it to X5 and use it. It outputs a sorted G10 list and only outputs the offsets used in the file.

Link to comment
Share on other sites

buffers are not for the new post writer in my opinion. They can be a little tricky. I wrote that original code in the post zoober is using many moons ago, interesting to see that it is still in use.

 

Jason, try posting the actual lines from the ERR file as well as the offending lines of code. One of my pet peeves is anytime you post code or anything that you are copying from a file use the full reply form and the CODE feature so everything stays nice and neat and lined up like in zoobers original post. Any other way makes reading code difficult. While I am on pet peeves, turn on line numbers in your editor so we can see the line numbers as well.

 

Label not defined usually means you did NOT define the variable trying to be used. [XX] is the column number of the offending variable in the post line referenced by (XXX). If it comes up the same line multiple times that tells me it is in a postblock that is called repeatedly.

 

Post editing can be easy when you follow some simple rules and the right information it given.

Link to comment
Share on other sites

I posted a zip file containing a V9 pst and txt file along with a sample mc9 file for G10 output that outputs the origin of each plane relative to the mastercam origin (centerline of pallet). You could simply update it to X5 and use it. It outputs a sorted G10 list and only outputs the offsets used in the file.

 

Roger,

 

given up trying to mod my post(thinking its a little over my head!) had a look around for the V9 pst and files but cant seem to find it! would appreciate it if you could let me know!

 

cheers Jason

Link to comment
Share on other sites

Basically, something like this:

 

(WORK OFFSETS) 
G90G10L2P1(G54)X-2.5034Y-13.7655Z7.68B0. 
G90G10L2P4(G57)X-2.5034Y-12.2655Z7.6857B0.(B0) 
G90G10L2P5(G58)X-7.6857Y-12.2655Z-2.5034B90.(B90)
G90G10L2P6(G59)X7.6857Y-12.2655Z2.5034B270.(B270)
(CUTTER COMPS) 
G90G10L12P90R0.(TOOL - 40) 
G90G10L12P92R0.(TOOL - 42) 
G90G10L12P93R0.(TOOL - 43) 
G90G10L12P97R0.(T43-.4 DIA)
G90G10L12P94R0.(TOOL - 44) 
G90G10L12P95R.0015(TOOL - 45)
G90G10L12P96R0.(TOOL - 46) 

Link to comment
Share on other sites

ok, that's pretty straight forward, I'll put it on my list but it won't be any time soon.

 

I see you are putting B values in your G10 work offset list. Doesn't this cause problems if your outputing angle values in the code, I typically otuput B0. in the G10 list which can be edited, but edited to "tweak" the output code plus or minus a small angle value to account for the fixturing. Just wondering how your machine handles it.

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