Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Workoffset G54, G55 outputing from post builder every operation ? 1

Status
Not open for further replies.

bassplaya69er

Electrical
Dec 28, 2011
11
0
0
GB
Hi,

i am in the process of working the kinks out of a DIY post i've made for a BOSCH cc120 used to control a router.

i use G54 - G57 as references for the 4 corners of the machines bed, and regularly use 54 and 55 when flipping a sheet over to machine on both sides.

i have a custom command in my post to output the fixture offset +53 and to stop the machine and move to a position for easy loading.

the custom command is placed in start of operation.

problem is this outputs the reference in between every operation, which is quite annoying when on G55 !

i have tried puting the whole thing in to something like: "if {$workoffset != [expr $mom_fixture_offset_value +53]} type s


#Set work offset & stop machine to alow for part repositioning at G55 and above
#
global mom_fixture_offset_value
global workoffset
global workoffsetchange



set workoffset [expr $mom_fixture_offset_value +53]

if {$workoffset >= 55} {


MOM_output_literal "M05"
#Stop spindle
MOM_output_literal "M09"
#Raise Head
MOM_output_literal "G53"
#Switch to MCS
MOM_output_literal "G0X1220Y1220Z0"
#move to loading postion
MOM_output_literal "M55"
#UnClamp Right
MOM_output_literal "M57"
#UnClamp Left
#MOM_output_literal "M51"
#VacPump 1 off
#MOM_output_literal "M53"
#VacPump 2 off
MOM_output_literal "M00"
#Stop program
MOM_output_literal "(FLIP/REPOSITION STOCK TO G$workoffset)"
#Operator message

}


MOM_output_literal "G$workoffset"




i have tried puting the whole thing in to something like:

"if {$workoffset != [expr $mom_fixture_offset_value +53]}

but im guessing the global variables are only global to the custom command, not the whole post?

anyone have a good idea of another way around this?

i would also like to change stop conditions, so rather than being >= g55, it will stop on the first offset change, allowing me to use G55 as the first side and G54 as the second side, purly for flexibility realy.


any help very appreciated.
 
Replies continue below

Recommended for you

You are fighting yourself with output literals. Create a block template (actually there probably already is one) for fixture offset and make sure it is modal and you are set. It will then only output when it changes. output literals should only be used when necessary otherwise you have to condition your code more than necessary. Good luck.
 
hey there shags72,


thank you very much, there fixture offset block was not all ready there, but it was easy enough to make one.

so that solves the first problem, but now i need to get the post to output something to the effect of the below output literals every time the offset changes except the first time. ( maybe the first time just a stop and operator message with the offset number)

MOM_output_literal "M05"
#Stop spindle
MOM_output_literal "M09"
#Raise Head
MOM_output_literal "G53"
#Switch to MCS
MOM_output_literal "G0X1220Y1220Z0"
#move to loading postion
MOM_output_literal "M55"
#UnClamp Right
MOM_output_literal "M57"
#UnClamp Left
#MOM_output_literal "M51"
#VacPump 1 off
#MOM_output_literal "M53"
#VacPump 2 off
MOM_output_literal "M00"
#Stop program
MOM_output_literal "(FLIP/REPOSITION STOCK TO G$workoffset)"
#Operator message

can this also be done in block templates?

thanks a lot - at least now i am on the right track.
 
How bout setting a previous fix value and then compare the current to it and use this to trigger the output. You would have to set the prev in a commandi in the start of program area I think it was called so it only sets it once and then set it to the current offset after the check. Been awhile since I wrote but this should be close.
START OF PROGRAM COMMAND
set prev_offset 0

START OF PATH COMMAND
if {$offset != $prev_offset} {

code here
}

set prev_offset $offset
 
Using a block template is the easiest way to go.

Add it to the initial move event so that the G54 is in a block with an X and Y set the output to forced. Add any other blocks you want after each tool change. Then you will get the desired output. Without writing a lot of custom commands. The fixture offset is a G code word that is available in PB.

John Joyce
N.C. Programming Supervisor
Barnes Aerospace, Windsor CT
NX6.0.5.3
 
thanks a lot again shags,

that seems to be along the right lines, defining a global variable in the program start seems to make it truly global, which is what i was stuck with in my inital post.

i think i need 2 global variables for the start of path "IF" command to check. as there are 2 things that need to be true, before i want to output the list of stop / housekeeping commands

ie it needs to not be the first offset, and there needs to be a change in offset.

i think i will be able to work it out from here, thanks a lot for your help.

i will post the solution when its all working.

thanks again.
 
Status
Not open for further replies.
Back
Top