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 > Parametric Programing


Parametric Programing (custom macro b, fadal macro, okuma user task)


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 06-04-2008, 08:36 AM
 
Join Date: Jun 2008
Location: USA
Posts: 66
gtrrpa is on a distinguished road
Cool Newbie to Forum and Macros "Need Help"

Hello everyone, this is my 1st Post so Hello #1. I'm new to Macros and am programming a takisawa using an older Fanuc control.What series,Don't know?
Anyways I'm using th "WHERE" DO1 and END1 in a facing routine in a very small part and it is looping, but it doesn't come out of the loop? I know I'm doing something very small that needs to be changed. All I've read is Shmitz's book on Macros and jumping in and started writing. I've got this far and know I'm having trouble.If someone can help please let me know and I can send the program. Thx gtrrpa
Tweet this Post!Share on Facebook
Reply With Quote

  #2   Ban this user!
Old 06-04-2008, 12:02 PM
ImanCarrot's Avatar  
Join Date: Nov 2005
Location: UK
Posts: 1,468
ImanCarrot is on a distinguished road

Ello mate, and welcome to the boards.

I'm sure someone will correct me if I'm wrong- folk know a lot here, but...

Are you sure the "WHERE" command is right.. isn't it "WHILE"

eg:
WHILE [#00LT#101]DO1
...
...
END1

I'm not too sure about your particular settup and only have a couple of mins before I leave work.. will look at it more tomorrow, sorry I only have a couple of mins to spare, but I'm sure the conditional loop is "WHILE" not "WHERE"?

Search on here or Google the Web for the rather excellent Macro Programming guide by Scott Martinez, but I dunno if this pertains to your particular settup.

Also.. beware of global and local variables- some change with every call or exit from a subroutine (some stay the same).

Will post more tomorrow, and welcome here again!
__________________
I love deadlines- I like the whooshing sound they make as they fly by.
Tweet this Post!Share on Facebook
Reply With Quote

  #3   Ban this user!
Old 06-04-2008, 03:02 PM
 
Join Date: Jun 2008
Location: USA
Posts: 66
gtrrpa is on a distinguished road

Sorry "Corrrection" >>>>>>WHILE<<<<<<<<
Tweet this Post!Share on Facebook
Reply With Quote

  #4   Ban this user!
Old 06-04-2008, 04:38 PM
 
Join Date: Mar 2006
Location: United States
Age: 31
Posts: 153
chrisryn is on a distinguished road

Lets see the code then we can go from there.
__________________
No matter how good you are, there is always someone better!!!
Tweet this Post!Share on Facebook
Reply With Quote

  #5   Ban this user!
Old 06-04-2008, 06:29 PM
 
Join Date: Jun 2008
Location: USA
Posts: 66
gtrrpa is on a distinguished road
Talking Here it is.Does the problem lie on the incremental moves?

%
:O6807(LG M.C. C/B.843)
G28U0W0
#1=#26
#1=-.1
#3=#1+.002
T0303(FACE)
G97
G99
M03S850
/M08
G0X.1
G0Z.02
G1F.01Z[#1+.015]
WHILE[#1+.015GE[#1+.002]]DO 3
G1F.01W-.007
G1F.002X.84
G1G99F.002W.005
F.01X.1
END 3
G0Z4.
M01
M30
%
Dont forget, I'm in a counterbore with a .105 bore. Gong to finish c/bore at
.843 dia. THX all for the help.................

Last edited by gtrrpa; 06-04-2008 at 06:37 PM. Reason: spelling add on
Tweet this Post!Share on Facebook
Reply With Quote

Sponsored Links
  #6  
Old 06-04-2008, 06:54 PM
*Registered*
 
Join Date: Jan 2006
Location: Seattle
Age: 52
Posts: 883
Mike Stevenson is on a distinguished road

Man that is some bad code. Why on earth would you use a Macro to do that?
Tweet this Post!Share on Facebook
Reply With Quote

  #7   Ban this user!
Old 06-04-2008, 08:43 PM
 
Join Date: Jun 2008
Location: USA
Posts: 66
gtrrpa is on a distinguished road
Reason Being:

Have all sorts of parts where the Z depth changes on the c/bore and want to have the operator only change value of #1, which will have a note stateing that this will be Z depth.of other parts. This is the reason to stay away .002 from bottom of c/bore to take 2 passes of .001 because the intersection of the bore and the wall of the face of the c/bore has to be very sharp. Any other Ideas?
Tweet this Post!Share on Facebook
Reply With Quote

  #8  
Old 06-04-2008, 08:58 PM
*Registered*
 
Join Date: Jan 2006
Location: Seattle
Age: 52
Posts: 883
Mike Stevenson is on a distinguished road

Well I think you should write individual cnc programs so your operator does not have to remember this wacky macky (macro.)
Tweet this Post!Share on Facebook
Reply With Quote

  #9   Ban this user!
Old 06-05-2008, 02:59 AM
 
Join Date: Jun 2008
Location: USA
Posts: 66
gtrrpa is on a distinguished road

Only thing he has to change is #1 once it's done for all tools.As it's shown it's already been rough c/bored leaving .01
Tweet this Post!Share on Facebook
Reply With Quote

  #10   Ban this user!
Old 06-05-2008, 07:00 AM
ImanCarrot's Avatar  
Join Date: Nov 2005
Location: UK
Posts: 1,468
ImanCarrot is on a distinguished road

Right, I'm by no means an expert at Macro programming, but if I recall correctly when you call a subroutine the variables are reset. So in your line

WHILE[#1+.015GE[#1+.002]]DO 3

#1 will start as zero and so the Greater than or Equal to statement will always be true and the loop will never end.

To pass variables into a sub- routine I think you need to use the G65 command.

Hang on.... might be a simpler solution...Try something for me please? instead of using variables #1 and #3 change these to #101 and #103- that should work since anything from #100 to #999 are Common Variables and, unlike Local Variables (#1 to #99), retain their values on entering and exiting to/ from a sub- routine. Variables #1 to #99 get reset on every subroutine call, so your conditional loop will (I think) always be true cos #1 will always start at zero.

PS- don't mess about with #0, it cannot be set and is neither zero or anything, it's always empty (not zero, but empty)

Also! don't mess with variables #1000 to #5999- unless you know what your up to LOL.
__________________
I love deadlines- I like the whooshing sound they make as they fly by.
Tweet this Post!Share on Facebook
Reply With Quote

Sponsored Links
  #11   Ban this user!
Old 06-05-2008, 07:16 AM
 
Join Date: Mar 2006
Location: United States
Age: 31
Posts: 153
chrisryn is on a distinguished road

I suggest changing to the common variables like Imancarrot mentioned but you might want to change your while statement to this.

WHILE[[#1+.015]GE[#1+.002]]DO 3
__________________
No matter how good you are, there is always someone better!!!
Tweet this Post!Share on Facebook
Reply With Quote

  #12   Ban this user!
Old 06-05-2008, 09:08 AM
ImanCarrot's Avatar  
Join Date: Nov 2005
Location: UK
Posts: 1,468
ImanCarrot is on a distinguished road

Chris is right, that is neater. But, it still won't work cos of the passing of variables from the main program to the sub- routine.

You need to change variable #1 and #3 to #101 and #103 (or whatever # as long as it aint #0 or anything between #1000 to #5999). Variables #100 to #999 will keep their values on a subroutine call. I beleive that's where your problem is- the conditional loop will never end 'cos the value in #1 is not getting passed from the main program to the sub- routine and so variable #1 is always zero on entering the sub- routine and hence your conditional WHILE is always TRUE.

Every time you call or return a subroutine the (local) #variable will be reset to zero UNLESS you G65 the variables prior to the start of the program which allows keeping their values (system variables). Even nested loops will reset the variable at that level of sub- routine

My second suggestion in my previous post will work (ie: change the variables to above #99)... I think! but again, I'm not an expert.

I would definately use Chris's format for the equation- it's neater and simpler and intuitively right. Yours would probably work ok, but best to cover all the bases.

Please let us know if this works? If it does, you owe me a beer, lol: my mates down the pub at lunchtime were accusing me of being a workaholic as I scribbled over my notes with a pint of Stella

I'll try and find a link to Scott Martinez's excellent explanation of Macro Programming. It's incredibly good.
__________________
I love deadlines- I like the whooshing sound they make as they fly by.
Tweet this Post!Share on Facebook
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
Newbie here, can anybody explain what "swing", etc. means? squale Mini Lathe 4 11-09-2007 12:59 PM
tracking down MDI "hang" with loops & macros howling60 CamSoft Products 7 03-02-2006 03:28 PM
How about a seperate "Linear motion" forum rashid11 Suggestions for the CNCzone.com site. 3 06-03-2005 07:01 PM




All times are GMT -5. The time now is 10:10 PM.





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