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 05-09-2011, 07:05 PM
 
Join Date: Jan 2005
Location: usa
Posts: 15
dry run is on a distinguished road
julian date engraving

I need to make parametric prog to engrave julian date on a long run production job. The machine is a mazak nexus 6000 horz mill. running in EIA. I know there are parameters to read the date and time. but I'm not sure how to utilize them to change date automatically.
Reply With Quote

  #2   Ban this user!
Old 05-12-2011, 07:36 AM
christinandavid's Avatar  
Join Date: Aug 2009
Location: New Zealand
Posts: 573
christinandavid is on a distinguished road

As no one else has responded, I will stick my oar in....I know bugger all about Mazaks, but on Fanuc the date is stored in #3011 this format: - yyyymmdd or 20110512 for today. So, to extract each individual digit, in custom macro b format you could do something like: -

#101=FIX[[[[#3011]/10]]*10] (2)
#102=FIX[[[[#3011]/100]]*10] (1)
#103=FIX[[[[#3011]/1000]]*10] (5)
#104=FIX[[[[#3011]/10000]]*10] (0)
#105=FIX[[[[#3011]/100000]]*10] (1)
#106=FIX[[[[#3011]/1000000]]*10] (1)
#107=FIX[[[[#3011]/10000000]]*10] (0)
#108=FIX[[#3011]/10000000] (2)

Then run the corresponding engraving cycle for each digit at the appropriate position. Hope I got the right end of the stick there...

DP
Reply With Quote

  #3   Ban this user!
Old 05-22-2011, 06:16 PM
christinandavid's Avatar  
Join Date: Aug 2009
Location: New Zealand
Posts: 573
christinandavid is on a distinguished road





Uh oh....sorry dryrun, but I've just had chance to check this and what I typed previously is complete bollocks - I'm surprised no-one picked me up on it....


Originally Posted by christinandavid View Post
...something like: -

#101=FIX[[[[#3011]/10]]*10] (2)
#102=FIX[[[[#3011]/100]]*10] (1)
#103=FIX[[[[#3011]/1000]]*10] (5)
#104=FIX[[[[#3011]/10000]]*10] (0)
#105=FIX[[[[#3011]/100000]]*10] (1)
#106=FIX[[[[#3011]/1000000]]*10] (1)
#107=FIX[[[[#3011]/10000000]]*10] (0)
#108=FIX[[#3011]/10000000] (2)

Should have known it wouldn't look that simple...this, I believe, is both correct and bullet-proof: -

#101=[#3011-[FIX[[#3011]/10]*10]] (2)

#102=FIX[[#3011]/10]-[FIX[[[#3011]/10]/10]*10] (1)

#103=FIX[[#3011]/100]-[FIX[[[#3011]/100]/10]*10] (5)

#104=FIX[[#3011]/1000]-[FIX[[[#3011]/1000]/10]*10] (0)

#105=FIX[[#3011]/10000]-[FIX[[[#3011]/10000]/10]*10] (1)

#106=FIX[[#3011]/100000]-[FIX[[[#3011]/100000]/10]*10] (1)

#107=FIX[[#3011]/1000000]-[FIX[[[#3011]/1000000]/10]*10] (0)

#108=FIX[[#3011]/10000000]-[FIX[[[#3011]/10000000]/10]*10] (2)


Hope this info is still useful...

DP
Reply With Quote

  #4   Ban this user!
Old 05-22-2011, 09:07 PM
 
Join Date: Jan 2005
Location: usa
Posts: 15
dry run is on a distinguished road
Unhappy julian date

Thanks for the update DP! I hope to put it to use soon. I need to have this done by 6/1/11. However I verified with customer what julian date means. It seems they want it in a ddd/yy format (ie..1/1/2011= 001_11). I think I can keep a running total of day of the year per month and adjust every four years for leap year. But this is pretty far from my comfort zone. AND, with so little time remaining and since I have so many more problems on my plate I may just pay someone to make a program.

I tried a test of #100=#3011, and it gave me an exponential number...so I'm throwing in the towel.
Reply With Quote

  #5   Ban this user!
Old 05-22-2011, 09:39 PM
christinandavid's Avatar  
Join Date: Aug 2009
Location: New Zealand
Posts: 573
christinandavid is on a distinguished road

Hmmmm.....

Assuming you can find the correct system variable for the date, you could approach the macro program something like this....

Extract the last two digits of the year and use logic statements to determine if its a leap year, setting a variable for the number of days in february accordingly.

Extract the month digits and according to the result GOTO the correct line in the remainder of the macro program, eg: -

(DAY)=(extracted digit 1 + 10x extracted digit 2)

IF (extracted digit 3 + 10x extracted digit 4) EQ 12 GOTO10
IF (extracted digit 3 + 10x extracted digit 4) EQ 11 GOTO20
IF (extracted digit 3 + 10x extracted digit 4) EQ 10 GOTO30
IF (extracted digit 3) EQ 9 GOTO40
IF (extracted digit 3) EQ 8 GOTO50
IF (extracted digit 3) EQ 7 GOTO60
IF (extracted digit 3) EQ 6 GOTO70
IF (extracted digit 3) EQ 5 GOTO80
IF (extracted digit 3) EQ 4 GOTO90
IF (extracted digit 3) EQ 3 GOTO100
IF (extracted digit 3) EQ 2 GOTO110
GOTO120
N10 (DAY)=(DAY)+30(TOTAL FOR NOVEMBER)
N20 (DAY)=(DAY)+31(TOTAL FOR OCTOBER)
N30 (DAY)=(DAY)+30(TOTAL FOR SEPTEMBER)
N40 (DAY)=(DAY)+31(TOTAL FOR AUGUST)
N50 (DAY)=(DAY)+31(TOTAL FOR JULY)
N60 (DAY)=(DAY)+30(TOTAL FOR JUNE)
N70 (DAY)=(DAY)+31(TOTAL FOR MAY)
N80 (DAY)=(DAY)+30(TOTAL FOR APRIL)
N90 (DAY)=(DAY)+31(TOTAL FOR MARCH)
N100 (DAY)=(DAY)+(chosen variable you set before) (TOTAL FOR FEBRUARY)
N110 (DAY)=(DAY)+31(TOTAL FOR JANUARY)
N120
(DAY) should now be correct - I would then multiply that result by 0.001 and extract the digits from the first three decimal places - I feel that would be the easiest way to get your leading zeroes. Make sense?

DP
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 06-01-2011, 07:22 PM
 
Join Date: Feb 2006
Location: United States
Posts: 273
dpuch is on a distinguished road

Here is some working code for Fanuc Macro B with pretty good comments.

Code:
N0010 (DATE CODE)
(DATE SOURCE = #3011  IN YYYYMMDD FORMAT)
(TIME SOURCE = #3012  IN HHMMSS FORMAT)
(4 DIGIT YEAR  = #1)
(YEAR TENS DIGIT = #2)
(YEAR ONES DIGIT = #3)
(MONTH = #4)
(DAY   = #5)
(DAYS THIS YEAR = #6)
(DAYS HUNDREDS DIGIT = #7)
(DAYS TENS DIGIT = #8)
(DAYS ONES DIGIT = #10)
(TEMP = #12)
(HOUR TENS DIGIT = #13)
(HOUR ONES DIGIT = #14)

N0020
(YEAR)
#1 = FIX[#3011 / 10000.] (4 DIGIT YEAR)
#2 = FIX[[#1 - 2000.] / 10.](YEAR TENS DIGIT)
#3 = FIX[[#1 - 2000.] - [#2 * 10.]](YEAR ONES DIGIT)
(MONTH)
#4 = FIX[[#3011 - [#1 * 10000.]] / 100.]
(DAY)
#5 = #3011 - [#1 * 10000.] - [#4 * 100.]
(HOUR)
#13 = FIX[#3012 / 100000.] (HOUR TENS DIGIT)
#14 = FIX[[#3012 / 10000.] - [#13 * 10]] (HOUR ONES DIGIT)

N0030(ARRAY TO COUNT DAYS)
#6 = #5 (DAYS IN CURRENT MONTH)
IF [#4 LE 1.] GOTO 40
#6 = #6 + 31. (DAYS IN JANUARY)
IF [#4 LE 2.] GOTO 40

N0032(DAYS IN FEBRUARY CHECK FOR LEAP YEAR)
#12 = [[#1 / 4.] - FIX[#1 / 4.]]
#6 = #6 + 28. (FEB. HAS 28 DAYS)
IF [#12 EQ 0] THEN #6 = #6 + 1. (LEAP YEAR FEB. HAS 29 DAYS)

IF [#4 LE 3.] GOTO 40
#6 = #6 + 31. (DAYS IN MARCH)
IF [#4 LE 4.] GOTO 40
#6 = #6 + 30. (DAYS IN APRIL)
IF [#4 LE 5.] GOTO 40
#6 = #6 + 31. (DAYS IN MAY)
IF [#4 LE 6.] GOTO 40
#6 = #6 + 30. (DAYS IN JUNE)
IF [#4 LE 7.] GOTO 40
#6 = #6 + 31. (DAYS IN JULY)
IF [#4 LE 8.] GOTO 40
#6 = #6 + 31. (DAYS IN AUGUST)
IF [#4 LE 9.] GOTO 40
#6 = #6 + 30. (DAYS IN SEPTEMBER)
IF [#4 LE 10.] GOTO 40
#6 = #6 + 31. (DAYS IN OCTOBER)
IF [#4 LE 11.] GOTO 40
#6 = #6 + 30. (DAYS IN NOVEMBER)
N0040

(SPLIT DIGITS FOR DAYS)
#7 = FIX[#6 / 100.] (DAYS HUNDREDS DIGIT)
#8 = FIX[[#6 - [#7 * 100.]] / 10.] (DAYS TENS DIGIT)
#10 = FIX[#6 - [#7 * 100.] - [#8 * 10.]] (DAYS ONES DIGIT)

Mazak should use the same variables with one exception. It uses a 2 digit year format. (well check your machine) so you may have to modify that part.
Date and time (Year-month-day and hour-minute-second)
Variables numbered 3011 and 3012 can be used to read date and time data.
Variable Nos. Description
#3011 Date (Year-month-day)
#3012 Time (Hour-minute-second)
Example: If the date is December 15, 1995 and the time is 16:45:10, data is set as follows in
the corresponding system variables:
#3011 = 951215
#3012 = 164510
Also I saw the option to turn off exponential display of macro numbers
Go to the macro variable page, and mouse up to the "Setup" drop down window. Click the "Not Exponential Display" option.
Reply With Quote

  #7   Ban this user!
Old 06-08-2011, 08:07 PM
 
Join Date: Jan 2005
Location: usa
Posts: 15
dry run is on a distinguished road

The "not exponential display" IS checked, but the it defauts to exponential when the number is too large to be displayed. I wonder if it will work anyway? I'll be trying your program soon, if it works I'll let you know...Thanks
Reply With Quote

  #8   Ban this user!
Old 06-08-2011, 08:19 PM
 
Join Date: Feb 2006
Location: United States
Posts: 273
dpuch is on a distinguished road

A side note about the code I posted. It does not take into account the 100 and 400 year variations in leap year. But that isn't an issue unless your dealing with dates between 1900 and 2100 since those are the previous and next years for the exception. The code is hard coded for years after 2000 anyhow.
Reply With Quote

  #9   Ban this user!
Old 06-08-2011, 08:51 PM
 
Join Date: Jan 2005
Location: usa
Posts: 15
dry run is on a distinguished road

Thanks for your help. I'll be trying the Date engraving later this week.
I also have a question about helical-spiral interpolation. I wish to both at the same time. I wondered if G91G03X0Y0I[#100-#101]Z[#102]L106F.5 would decrease the value in #100(starting radius) by the amount in #101, and also move Z at the same time. rinse and repeat 106 times.... Or am I going about this the wrong way....I was hoping G03.1 (spiral interpolation) would work but I'm not sure..what to add to make it move z at the angle I need (.125 per 1.00). Thanks again for your help
Reply With Quote

  #10   Ban this user!
Old 06-08-2011, 09:07 PM
 
Join Date: Feb 2006
Location: United States
Posts: 273
dpuch is on a distinguished road

I have used G03 for helical-spiral interpolation (pipe threads) when milling. On fanuc controls you may have to loosen the arc tolerance parameter for it to work.

You can't use L to repeat the command, the variables will not change each time it repeats. Use looping logic (FOR, WHILE, ect. with a counter) I also imagine you want the X Y end point to change as well as the distance to center to keep the same center point.

#101=0 (counter)
#102=0.005 (radial stepover)
WHILE [#101 LT 106] DO
G91 G3 X#102 Y0 I[2.5-#101*#102] J0.0 Z-0.040 F0.5
#101=#101 + 1
LOOP

Last edited by dpuch; 06-08-2011 at 10:31 PM. Reason: Fixed loop counter (0-105 instead of 1-106) so center distance value was not off by one loop
Reply With Quote

Sponsored Links
  #11   Ban this user!
Old 06-08-2011, 09:31 PM
 
Join Date: Jan 2005
Location: usa
Posts: 15
dry run is on a distinguished road

sorry I'm such a bother, I'm very new at parametrics, I've only used GOTO commands..lol never seen a LOOP command. I don't understand the I[2.5-#101*#102]. So, if I g41 to my starting diameter. then do this loop it would move .005 smaller in diameter and .04 deeper in z each time?
Reply With Quote

  #12   Ban this user!
Old 06-08-2011, 10:25 PM
 
Join Date: Feb 2006
Location: United States
Posts: 273
dpuch is on a distinguished road

Another way to code the logic with just an IF GOTO I also added a little more to put everything in context.

#101=0 (counter)
#102=0.005 (radial stepover)
#103=2.5 (starting radius)
G90 G0 X1.5 Y2.75 (position to center)
G91 G0 X-#103 (go to starting radius)
N10
G91 G3 X#102 Y0 I[#103-#101*#102] J0.0 Z-0.040 F0.5
#101=#101 + 1
IF [#101 LT 106] GOTO 10

Yes, starting at a 2.5" radius, and decreasing in radius by 0.005 at the end of each revolution as well as Z-0.04 So the actual start/end point moves by 0.005, and the distance from the center point to the start is 2.5 and then decreases 0.005 each time through the loop. You will notice I had to make a correction in this example so it starts at 2.5 and not 2.495 (loop counter now starts at 0 instead of 1) Similarly watch the logic on the goto for the right number of total loops.
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
Problem- julian date engraving dry run Mazak, Mitsubishi, Mazatrol 1 05-13-2011 11:03 AM
X3 release date foxsquirrel Mastercam 21 09-19-2008 07:17 AM
X7 release date ? acidcustom Syil Products 9 07-08-2008 04:15 AM
How to set the time and date DomB Haas Mills 7 03-10-2007 05:03 PM
Date for 3000 mem. toolmkrman CNCzone Club House 6 11-06-2003 03:02 PM




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