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 03-02-2009, 12:17 PM
 
Join Date: Oct 2008
Location: USA
Posts: 25
JMECKES is on a distinguished road
Changing signs using variables

We are using Custom Macro B extensively on a CNC lathe. When trying to change the sign of a variable from positive to negative, we seem to only be able to change it using a two line formula. In the example below, we are trying to change variable #527 to a negative value. I would like to do it on one line, but either MacroB doesn't follow all algebraic rules or my algebra just plain sucks (and that may very well be the case). The fact that we can't use parenthesis doesn't help either, since the control ignores it like any comment in the code.

#6=#527-.12
#6=-#6

I've tried things like #6=[-]#527-.12 and #6=[[#527*-1]-.12]

Any suggestions from the sharp folks on here?
Tweet this Post!Share on Facebook
Reply With Quote

  #2   Ban this user!
Old 03-02-2009, 12:48 PM
beege's Avatar  
Join Date: Feb 2008
Location: USA
Posts: 510
beege is on a distinguished road

As far as I understand it, 1-33 are reserved for argument transfers from the G65 macro call line to the macro. I'd use either the common variables 100-199 (which reset to null on power off/on cycle) or 500-599 (which stay put when powered is cycled).

#100=-[#6]

of course, you could try #6=-[#6], but i wouldn't because I don't like using those variables as a matter of personal taste.
Tweet this Post!Share on Facebook
Reply With Quote

  #3   Ban this user!
Old 03-02-2009, 04:20 PM
 
Join Date: Nov 2006
Location: UK
Posts: 121
ChattaMan is on a distinguished road
Or maybe...

You could try...

#6=[#527*[-1]]-0.12
Tweet this Post!Share on Facebook
Reply With Quote

  #4   Ban this user!
Old 03-02-2009, 07:09 PM
 
Join Date: Jul 2003
Location: New Zealand
Posts: 992
Kiwi is on a distinguished road

Or this
#6=[0-#527]-0.12
Tweet this Post!Share on Facebook
Reply With Quote

  #5   Ban this user!
Old 03-03-2009, 08:40 AM
 
Join Date: Jun 2008
Location: United States
Posts: 1,503
stevo1 is on a distinguished road

What number is #527 usually set to? Are you trying to get a negative value for the result of #527-.12? Where is #6 playing a factor into your calculation? There is a few ways to do this. If the value of #527 is normally greater than .12 you can reverse the calculation. Ex #527 is set to .7 #6=.12-#527=-.58

I guess you didn’t need all of that but anyway if you want #527 set to a negative value program #527=[-#527]. This works on all of my Fanuc’s. Or you can use as Beege has formatted #527=-[#527]

Beege,
FYI….you can use #1-#33 anytime that you want. You don’t have to use them exclusively as a passing of variables with the G65 command.

Stevo
Tweet this Post!Share on Facebook
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 03-03-2009, 09:36 AM
 
Join Date: Apr 2008
Location: sweden
Age: 39
Posts: 3
perkulator is on a distinguished road
how i did it on an Okuma

VC10=VC10*-1 when using global variables.
Hope this helps you.
Tweet this Post!Share on Facebook
Reply With Quote

  #7   Ban this user!
Old 03-03-2009, 09:42 AM
beege's Avatar  
Join Date: Feb 2008
Location: USA
Posts: 510
beege is on a distinguished road

Originally Posted by stevo1 View Post
Beege,
FYI….you can use #1-#33 anytime that you want. You don’t have to use them exclusively as a passing of variables with the G65 command.

Stevo
Yup, knew it; just don't as "a matter of personal taste". Thanks for the reaffirmation.
Tweet this Post!Share on Facebook
Reply With Quote

  #8   Ban this user!
Old 03-03-2009, 09:54 AM
 
Join Date: Jun 2008
Location: United States
Posts: 1,503
stevo1 is on a distinguished road

Perkulator,
Jmeckes never told us what control he was using. Now this could depend on what control he is using but none of my 15 series Fanucs support #527=[#527*-1] it is an improper format. I am assuming that he is using a Fanuc and this statement will not work. However I have seen this format in other threads so it must work on different controls.

Beege,
I am just opposite. I like to use the #1-#33 just for the fact they clear at reset or program end. No chance for opps forgot to set it to 5 in the second program when it was used as 1 before that. I also like the fact that if I want to go 2 subs deep I can use them again in the second program set to a different number and they return to the previous value when coming back to the 1st sub. As you know with macros there is dozens of ways to approach it. No 1 way is right or wrong.

Stevo
Tweet this Post!Share on Facebook
Reply With Quote

  #9   Ban this user!
Old 03-03-2009, 04:43 PM
 
Join Date: Oct 2008
Location: USA
Posts: 25
JMECKES is on a distinguished road

It's a 21i on a sub-spindle lathe. We are using it to control the depth of a drill at the end of a peck cycle. That's where the - comes in. The positive values used for the sub were no problem for the calculation. We ended up using Kiwi's formula, but both that one and Chattaman worked for what we needed. Thanks all!
Tweet this Post!Share on Facebook
Reply With Quote

  #10   Ban this user!
Old 03-03-2009, 10:38 PM
 
Join Date: Mar 2005
Location: Silicon Valley, CA
Posts: 976
psychomill is on a distinguished road

Why bother with the math? so to speak....

Just say...

-#527


But without knowing what the conditions are...

Are you trying to use #527 as a negative function?
-#527

or you just simply want to insert a negative value in #527?
#527=-#527
__________________
It's just a part..... cutter still goes round and round....
Tweet this Post!Share on Facebook
Reply With Quote

Sponsored Links
  #11   Ban this user!
Old 03-04-2009, 08:47 AM
 
Join Date: Oct 2008
Location: USA
Posts: 25
JMECKES is on a distinguished road

The program is variable loaded so I was trying to simplify and reduce program size. By keeping the sign change on one line of code instead of two, we are able to greatly reduce the size of the program. This also helps when it comes to training employees who are new to parametric programming. We've found that loading a control with a series of "variable" programs and having the operators copy and merge these mini programs is much less time consuming than using CAM software, and definitely more efficient than writing line by line G code. For almost everything we do now, we just have to input numbers without writing the entire program.
Tweet this Post!Share on Facebook
Reply With Quote

  #12   Ban this user!
Old 03-04-2009, 09:49 AM
 
Join Date: Mar 2005
Location: Silicon Valley, CA
Posts: 976
psychomill is on a distinguished road

....

edit...

never mind... missed one of your posts....
__________________
It's just a part..... cutter still goes round and round....
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
Need Help!- Carving Signs Sam A BobCad-Cam 2 05-04-2008 10:01 PM
Painting wooden signs? abomb55076 WoodWorking 26 08-07-2007 11:39 PM
RFQ Billet superman signs clarq_kent Employment Opportunity 21 05-26-2007 12:40 PM
wood signs Pugster WoodWorking 1 07-08-2006 12:21 AM
Top Ten Signs wms CNCzone Club House 19 06-21-2003 08:04 PM




All times are GMT -5. The time now is 07:34 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