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:

G143 Z/W syncing macro


Recommended Posts

First of all, I want to thank you all for your support. I've learned a great deal about editing posts from reading through the forums. however, I am now stuck....lol

I'm programming a Kuraki HBM, Fanuc style code, with a rotating table. The spindle moves in "Z" and the entire column moves in "W". The machine came with a built in macro that synchronizes Z and W so that we can choose which axis we want to move when drilling, tapping, etc. What I'm trying to set up is a "miscellaneous function" (mi4) switch so I can choose which positioning method I want to apply so I don't have to manage two posts(I also program a Femco HBM, Fanuc, with the same definition/post). Below is the NC statement as we want it to read for our purposes, a copy of the edits I have made attempting it and a copy of the NC code it is generating. A little more info to help....the controller uses G143 in place of G43, and A54.(55.,56.,etc) (with decimal) in place of G54 (55.,56.,etc) when it sets up the macro. I also have to disengage the macro with G149 instead of G49. The NC statement as we want it to read:

 

G90

G143 A54. X-19.135 Y7.355 Z2. W-5. H1 S1000 M3

 

 

Z and W would be commented in as "0", so that the operator has control over the spindle projection

 

The NC code it is generating:

 

G20

G0 G17 G40 G49 G80 G90

G0 G90 A54 X-19.135 Y7.355 S1000 M3

G43 H1 Z2. M8

G98 G81 Z-.01 R.1 F2.

X-16.043 Y12.762

X-11.559 Y16.931

X-6.049 Y19.587

X0. Y20.5

X6.049 Y19.587

X11.559 Y16.931

X16.043 Y12.762

X19.135 Y7.355

G80

M5

G149 Z15. M9

G91 G30 Y0.

M00

 

G90

G143 A54 X17.7535 Y10.25 Z2. W-5. H1 S1000 M3

G0 Z2. M8

G98 G81 Z-.01 R.1 F2.

X10.25 Y17.7535

X4.4139 Y20.0192

X-4.4139

X-10.25 Y17.7535

X-17.7535 Y10.25

G80

M5

G149 Z15. M9

G91 G30 Y0.

M30

 

Note I have several problems here...The first block is supposed to use a normal positioning technique, but I changed the sign for G_WCS to "A" to get the macro to post correctly. I can change this back to "G" and comment in the "A54." (barely have need of more than one work coordinate), but I don't know how to make the decimal appear in this location only. Second, the first block of code should have canceled cutter length with the normal G49 but it seems to be reading from the next operation? The second block posts correctly, except for that decimal point. Here are the sections of my post as I have it now:

 

psof$ #Start of file for non-zero tool number

pcuttype

toolchng = one

if ntools$ = one,

[

#skip single tool outputs, stagetool must be on

stagetool = m_one

!next_tool$

]

pbld, n$, *smetric, e$

pbld, n$, *sgcode, *sgplane, scc0, sg49, sg80, *sgabsinc, e$

sav_absinc = absinc$

if mi1$ <= one, #Work coordinate system

[

absinc$ = one

pfbld, n$, sgabsinc, *sg28ref, "Y0.", e$

#pfbld, n$, *sg28ref, "X0.", "Y0.", e$

pfbld, n$, sg92, *xh$, *yh$, *zh$, e$

absinc$ = sav_absinc

]

pcom_moveb

pcheckaxis

c_mmlt$ #Multiple tool subprogram call

ptoolcomment

comment$

pcan

#pbld, n$, *t$, sm06, e$

pindex

if mi1$ > one, absinc$ = zero

if mi4$ = one,

[pbld, n$, *sgabsinc, e$

pcan1, pbld, n$, sg143, pwcs, pfxout, pfyout, "Z2.", "W-5.", pfcout,

*tlngno$, [if nextdc$ <> 7, *speed, *spindle], pgear, strcantext, e$

pbld, n$, *sgcode, pfzout, scoolant, e$]

else,

[pcan1, pbld, n$, *sgcode, *sgabsinc, pwcs, pfxout, pfyout, pfcout,

[if nextdc$ <> 7, *speed, *spindle], pgear, strcantext, e$

pbld, n$, sg43, *tlngno$, pfzout, scoolant, e$]

absinc$ = sav_absinc

pbld, n$, sgabsinc, e$

pcom_movea

toolchng = zero

c_msng$ #Single tool subprogram call

 

ptlchg$ #Tool change

pcuttype

toolchng = one

if mi1$ = one, #Work coordinate system

[

#pfbld, n$, *sg28ref, "X0.", "Y0.", e$

pfbld, n$, sg92, *xh$, *yh$, *zh$, e$

]

if prog_stop = 1, pbld, n$, *sm01, e$

if prog_stop = 2, pbld, n$, *sm00, e$

pcom_moveb

pcheckaxis

c_mmlt$ #Multiple tool subprogram call

ptoolcomment

comment$

pcan

result = newfs(15, feed) #Reset the output format for 'feed'

#pbld, n$, *t$, sm06, e$

pindex

sav_absinc = absinc$

if mi1$ > one, absinc$ = zero

pcan1, pbld, n$, *sgabsinc, e$

if mi4$ = one,

[pbld, n$, pcan1, pbld, sg143, pwcs, pfxout, pfyout, "Z2.", "W-5.", pfcout,

*tlngno$, [if nextdc$ <> 7, *speed, *spindle], pgear, strcantext, e$

pbld, n$, *sgcode, pfzout, scoolant, e$]

else,

[pcan1, pbld, n$, *sgcode, *sgabsinc, pwcs, pfxout, pfyout, pfcout,

[if nextdc$ <> 7, *speed, *spindle], pgear, strcantext, e$

pbld, n$, sg43, *tlngno$, pfzout, scoolant, e$]

pbld, n$, e$

absinc$ = sav_absinc

pbld, n$, sgabsinc, e$

pcom_movea

toolchng = zero

c_msng$ #Single tool subprogram call

!xnci$, !ynci$, !znci$

 

# if nextop$ = 1003, #Uncomment this line to leave coolant on until eof unless

[ # explicitely turned off through a canned text edit

if all_cool_off,

[

#all coolant off with a single off code here

if coolant_on, pbld, n$, sall_cool_off, e$

coolant_on = zero

]

else,

[

local_int = zero

coolantx = zero

while local_int < 20 & coolant_on > 0,

[

coolantx = and(2^local_int, coolant_on)

local_int = local_int + one

if coolantx > zero,

[

coolantx = local_int

pbld, n$, scoolantx, e$

]

coolantx = zero

]

coolant_on = zero

]

]

 

#cc_pos is reset in the toolchange here

cc_pos$ = zero

gcode$ = zero

pbld, n$, sccomp, *sm05, psub_end_mny, e$

if mi4$ = one,

[pbld, n$, sg149, "Z15.", scoolant, e$

pbld, n$, sgabsinc, sgcode, *sg28ref, "Y0.", e$]

else,

[pbld, n$, sg49, "Z15.", scoolant, e$

pbld, n$, sgabsinc, sgcode, *sg28ref, "Y0.", e$]

 

#if nextop$ = 1003 | tlchg_home, pbld, n$, *sg28ref, "X0.", "Y0.", protretinc, e$

else, pbld, n$, protretinc, e$

absinc$ = sav_absinc

coolant$ = sav_coolant

 

Any help to get this completed would be greatly appreciated!!

Link to comment
Share on other sites
  • 1 year later...

Hi Catching Chrome, I saw your post that you have Kuraki HBM. Now  I am retrofitting a Kuraki KBH with Mitsubishi Controller and I am stucked with how to compensate tool length when W and Z axis move.

I noticed in your post that you mentioned about Macro program that synchronize Z and W axis. Is it possible if you could send me this macro program. Thank you very much.

Link to comment
Share on other sites

My suggestion to control the format in a specific place only:  Create a variable that is formatted the way that you need, and assign the value of g_wcs$.  Force the output of this variable where you want it instead of using the p_wcs call.

 

For the G49 output, you are correct in assuming that the next tool path has been read.  You can overcome this by using a 'flag' variable to keep track of the state of the output (whether you have called the sync macro) and use the value of that flag to control when the G149 is output.

 

What you are trying to do is not easy.  But with persistence, you will get workable code.  :cheers:

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