CNCzone.com-The Largest Machinist Community on the net!



Home Page Mark Forums Read Today's Posts My Replies Classifieds Reviews Photo Gallery Web Links Share Files Advertise With Us Ad List
Go Back   CNCzone.com-The Largest Machinist Community on the net! > Machine Controllers Software and Solutions > G-Code Programing


G-Code Programing Discuss G-code programing and problems here!


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 02-15-2009, 09:16 AM
VWbmx's Avatar  
Join Date: Nov 2008
Location: USA
Posts: 19
VWbmx is on a distinguished road
Unhappy Subroutine and Absolute/Incremental

Hey everybody.
My company has a Haas VF2SS and I'm new to g-code and am wondering how to use a subroutine on a mill patern.

I'm trying to write a code for one mill patern about the origin and then move the mill patern using subroutines to 3 locations.

My question is:
How do I write the code? Absolute or Incremental?

Right now I have it writen in Absolute and I'm trying to move the subroutine in absoulte.
Something like this:

G00 G55 G90 X-1. Y0;
M97 P1000;
G00 G55 G90 X-.2 Y0;
M97 P1000;
G00 G55 G90 X.9 Y0;
M97 P1000;
M30;

N1000;
G00 G91 X0 Y0;
G00 Z.25;
G01 Z-.25 F10.;
G01 X-1. Y-2. F20.;
G02 X1. R1.;
G01 Y2.;
G02 X-1. R1.;
G01 Y-2.;
G01 Z.25 F100.;
M99;

Do I need to rewrite this Subroutine in Incremental?

Thanks in advance for your help!
__________________
jettawagonautocross.blogspot.com
Reply With Quote

  #2  
Old 02-15-2009, 09:30 AM
HuFlungDung's Avatar
Moderator
 
Join Date: Mar 2003
Location: Canada
Posts: 4,825
HuFlungDung is on a distinguished road

Easiest way is to use a unique workshift for each location. Run the first part at G54, second one at G55, third at G56.

This makes it easy to adjust the datum of each pattern simply by studying the values in the offset register and adjusting the X and/or Y values to reflect how far the patterns are from each other.

You might also research the usage of G52, as this permits setting a datum at any point you like, then jumping to a subroutine written in absolute and the absolute code will regard the G52 as the absolute zero until it is cancelled. I call that an advanced technique because I have not used it myself yet
__________________
First you get good, then you get fast. Then grouchiness sets in.

(Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)
Reply With Quote

  #3   Ban this user!
Old 02-15-2009, 09:39 AM
 
Join Date: Jul 2005
Location: Canada
Posts: 11,565
Geof will become famous soon enough

Write it in absolute and either use three work zeroes, G54, G55, G56 each located for the positions of three parts as Hu suggests or use G52 also as Hu suggests. It is six of one half a dozen of the other really; G52 sets a supplementary work zero with reference to your main work zero.

EDIT: Hu's reply wasn't there when I clicked on REPLY; obviously great minds think alike.
__________________
An open mind is a virtue...so long as all the common sense has not leaked out.
Reply With Quote

  #4   Ban this user!
Old 02-15-2009, 09:45 AM
VWbmx's Avatar  
Join Date: Nov 2008
Location: USA
Posts: 19
VWbmx is on a distinguished road

Thanks for the sppedy Sunday replies!!!

In the back of my head I was thinking I should use the different work coords.

I'll try that now and let ya know.
__________________
jettawagonautocross.blogspot.com
Reply With Quote

  #5   Ban this user!
Old 02-15-2009, 10:06 AM
 
Join Date: Mar 2005
Location: Silicon Valley, CA
Posts: 982
psychomill is on a distinguished road

On the flip side ,... there's nothing wrong with your original thought process of using an incremental sub either. You can simply position your pattern where ever you want based on one work offset. You don't need to keep calling the workoffset either. And you still maintain the same adjustability as G52 or other methods...

There are a number of ways to accomplish the same task... Hu's offset method allows to adjust from Work offset page. The others are updated by positioning in the program.. You can also set your positions to variables and simulate Work offset page function but that may be 'advanced' for now as well....
__________________
It's just a part..... cutter still goes round and round....
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 02-15-2009, 10:27 AM
VWbmx's Avatar  
Join Date: Nov 2008
Location: USA
Posts: 19
VWbmx is on a distinguished road

YES!!! That worked!!! I used G55 as the center of my part. In MDI, I moved over the distances to the center of each patern and called them G56, G57 and G58 respectivly in OFFSETS and ran the program in the GRAPHICS screen. It looks great!

Thanks again for your help!
Allan
__________________
jettawagonautocross.blogspot.com
Reply With Quote

  #7   Ban this user!
Old 02-20-2009, 11:39 AM
 
Join Date: Nov 2007
Location: Libya
Posts: 69
nabil_elbadri is on a distinguished road

hi all , i just wonder about the sub rotine start (M97) ???
in the program that vw bmx already written!!!!!
as i know it should be M98 to call sub program , if there is another code (M code ) to call sub programme pls let me know
thnx all
Reply With Quote

  #8   Ban this user!
Old 02-20-2009, 12:31 PM
 
Join Date: Apr 2006
Location: usa
Posts: 128
JWK42 is on a distinguished road
M97 Local Sub

The M97 is a local Sub Routine call. The local sub is included in the main program and is located after the M30 and before the % at the end of the program file and always ends with a M99
In "M97 P1000" the P1000 is the first line number of the Sub as in VWbmx's example. This may be a Haas only feature. I don't know if Fanuc controls use local subs.

I like to use G97 local subs because all the code for a part is included in one file. It makes backup a lot easier.
Reply With Quote

  #9   Ban this user!
Old 02-20-2009, 12:52 PM
 
Join Date: Jul 2005
Location: Canada
Posts: 11,565
Geof will become famous soon enough

Originally Posted by nabil_elbadri View Post
hi all , i just wonder about the sub rotine start (M97) ???
in the program that vw bmx already written!!!!!
as i know it should be M98 to call sub program ....
It's a Haas thing. Very convenient as mentioned above you have all the code in one file. Haas also allows almost unlimited nesting of subroutines.
__________________
An open mind is a virtue...so long as all the common sense has not leaked out.
Reply With Quote

  #10   Ban this user!
Old 02-20-2009, 11:34 PM
 
Join Date: Mar 2005
Location: Silicon Valley, CA
Posts: 982
psychomill is on a distinguished road

The M97 is a local Sub Routine call......This may be a Haas only feature. I don't know if Fanuc controls use local subs.
FANUC = NO
YASNAC = YES
MAZATROL = YES
MITSUBISHI = YES

OTHERS= ???

Although it's not M97 on the other controls but the way it works is all the same...
__________________
It's just a part..... cutter still goes round and round....
Reply With Quote

Sponsored Links
  #11   Ban this user!
Old 02-22-2009, 08:54 AM
 
Join Date: Feb 2009
Location: UK
Posts: 3
COOLSKODA is on a distinguished road

im studying programming and just wondered how sub routine G97 for hass worked with rgards to drilling, i center drill, drill and ream several different holes. is this possible in sub-routine, if so how would it be inputted?

regards
Reply With Quote

  #12   Ban this user!
Old 02-22-2009, 09:41 AM
 
Join Date: Jul 2005
Location: Canada
Posts: 11,565
Geof will become famous soon enough

I seem to recall I used M97 (I think this is what you mean but you typed G97) in a drill canned cycle.

I was spotting, drilling and tapping and had all the hole coordinates in a subroutine which I called after setting up the canned cycle.

I will play with one of my machines and see if it works I could be remembering it incorrectly.

EDIT: Yes it works here is how to set up the program (with some stuff missing of course).

Blah
Blah
Spot Drill
G82 Z-.2 F? R? L0
M97 P1000
G80
Blah
Blah
Drill
G83 Z-2. Q? F? R? L0
M97 P1000
G80
Blah
Blah
Tap
G84 Z-.2 F? R? L0
M97 P1000
G80
Blah
Blah
M30
N1000 All the hole coordinates
M99

Some things to note:

The L0 in the canned cycle command means that the machine does not perform the cycle until it reads the first set of coordinates in the subroutine.

SETTING 28; CAN CYCLE ACT W/O X/Y has to be turned ON so you can omit the X and Y coordinates in the canned cycle line.
__________________
An open mind is a virtue...so long as all the common sense has not leaked out.

Last edited by Geof; 02-22-2009 at 10:02 AM.
Reply With Quote

Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Example of a Subroutine? donl517 Fadal 14 06-27-2007 10:05 AM
Offsets: Changing between absolute and incremental MotorCityMinion Haas Mills 11 03-04-2007 10:57 AM
Absolute or Incremental mikede Haas Mills 1 02-03-2007 05:02 PM
Need help with subroutine 2_jammer General CAM Discussion 1 01-17-2005 10:46 PM
Absolute and Incremental ACME G-Code Programing 3 09-04-2004 05:45 PM




All times are GMT -5. The time now is 12:11 AM.





Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO
Template-Modifications by TMS

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361