![]() | |
| Home Page | Mark Forums Read | Today's Posts | My Replies | Classifieds | Reviews | Photo Gallery | Web Links | Share Files | Advertise With Us | Ad List |
| |||||||
| Parametric Programing (custom macro b, fadal macro, okuma user task) |
| This forum is sponsored by: |
![]() |
| | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
| |||
| |||
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. |
|
#2
| ||||
| ||||
| 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 |
|
#3
| ||||
| ||||
![]() ![]() 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....
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 |
|
#4
| |||
| |||
| 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. |
|
#5
| ||||
| ||||
| 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 |
| Sponsored Links |
|
#6
| ||||
| ||||
| 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.
|
|
#7
| |||
| |||
| 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 |
|
#8
| |||
| |||
| 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. |
|
#9
| |||
| |||
| 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 |
|
#10
| |||
| |||
| 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 |
| Sponsored Links |
|
#11
| |||
| |||
| 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? |
|
#12
| |||
| |||
| 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. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
| |
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 |