586,094 active members*
3,993 visitors online*
Register for free
Login
Results 1 to 19 of 19
  1. #1
    Join Date
    Jan 2005
    Posts
    15

    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.

  2. #2
    Join Date
    Aug 2009
    Posts
    684
    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. #3
    Join Date
    Aug 2009
    Posts
    684




    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....


    Quote 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...:wave:

    DP

  4. #4
    Join Date
    Jan 2005
    Posts
    15

    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.

  5. #5
    Join Date
    Aug 2009
    Posts
    684
    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

  6. #6
    Join Date
    Feb 2006
    Posts
    338
    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.

  7. #7
    Join Date
    Jan 2005
    Posts
    15
    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. #8
    Join Date
    Feb 2006
    Posts
    338
    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. #9
    Join Date
    Jan 2005
    Posts
    15
    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. #10
    Join Date
    Feb 2006
    Posts
    338
    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

  11. #11
    Join Date
    Jan 2005
    Posts
    15
    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. #12
    Join Date
    Feb 2006
    Posts
    338
    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.

  13. #13
    Join Date
    Apr 2010
    Posts
    486
    Quote Originally Posted by dry run View Post
    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.
    Assuming you're running a Linux machine, you can install the php language. Just ask php to return the current date, then feed that to a single php function, and it will return the date in Julian, or in any other formate you specify.

    The php language can also be installed on a Windows machine.

    I suspect that other languages have direct date functions built in, but php is the language I use daily on websites.

    Tom

  14. #14
    Join Date
    Feb 2006
    Posts
    338
    Tom, he was talking about on the mazak CNC control.

    Dry Run, you should not have to worry about the exponential display except for readability. Calculations will be based on the actual number, not the exponential display. When you test the code I posted, single block thru it and check the 1-14 values as they should be one or two digit numbers.

  15. #15
    Join Date
    Jan 2005
    Posts
    15

    Julian date

    Thanks! I suspected the non-exponential number would be used for calculations, but I haven't had time to try it.
    The same part requires the tapered bores I've been asking about. It a heavy truck steering knuckle and the tapers are 1-1/2" per foot, we had carbide brazed reamers made but are having trouble getting them to cut and at this late date I had hoped to interpolate as a temporary solution. The tolerance on the 1-1/2 taper is +/- .01, so I thought it would be feasible. The machine is in metric so I have to convert everything, but that isn't a problem. I sent you a private msg detailing my latest attempt. I'd like to make a one-liner using a G65 macro call, that way I can do different sizes or angles, but that may be a pipe dream. I was thinking G65P9301XYZIJKA, and having 9301 do the calculations mathematically, but I haven't the skills..
    So if you have any ideas I'm game to try them. I need to be making tapered bores and julian dates in 3-4 days!...Quanity is starting out at 2000/month and may double quickly...
    Thanks for all your help.

  16. #16
    Join Date
    Aug 2009
    Posts
    684
    Quote Originally Posted by dpuch View Post
    ... unless your dealing with dates ... 2100 ...
    That might be an issue if this does not get resolved soon...

    Let us know if you have no satisfactory conclusion to conical interpolation using G2/G3 (a rough cone might just be enough of a head start to finish it with the reamer). We can also explore the linear increment method if all else fails...

    DP

  17. #17
    Join Date
    Feb 2006
    Posts
    338
    With the sign correction in the code you PM'd me I think it will work. If not try taking out the Z portion and check function then, alternatively take out the taper. See if you can narrow down the error.

    A fall back is to remove the conical moves, and program up plane circles that decrease radius. Not as clean, but a simple set of moves.

    As for wrapping it up in a macro call that too is relatively easy. Just separate out the values to change with macro values, then figure out how you want to specify them in the call. Then if you need to add the math to do any conversions. Like specify an angle and have it calculate the stepover ect. Just manually verify the values and calculations via the macro value page.

    also you mentioned your machine is set to metric, You can always use G20 in the macro, and G21 at the end to switch internally to inch then back to metric. The downside is if you stop it during the macro, it will leave the machine in inch. A hazard if you do not have G21 at the start of all your programs. Alternatively you could just add the math to the macro to do the conversions for you.

  18. #18
    Join Date
    Feb 2006
    Posts
    1792
    Switching G20/G21 inside a program is not without problems. Better to use math conversion.

  19. #19
    Join Date
    Feb 2023
    Posts
    3

    Re: julian date engraving

    hello friends,
    In the Fanuc system;
    #3011 (YYYYMMDD)
    #3012 (minute seconds to hour)
    working as
    I use #101=#3011 and #102=3012.

    Okuma Osp-p 300MA
    What is the equivalent and how should I define it?

    Thanks in advance

Similar Threads

  1. julian date engraving
    By dry run in forum Mazak, Mitsubishi, Mazatrol
    Replies: 1
    Last Post: 05-13-2011, 05:03 PM
  2. X3 release date
    By foxsquirrel in forum Mastercam
    Replies: 21
    Last Post: 09-19-2008, 01:17 PM
  3. X7 release date ?
    By acidcustom in forum Syil Products
    Replies: 9
    Last Post: 07-08-2008, 10:15 AM
  4. How to set the time and date
    By DomB in forum Haas Mills
    Replies: 7
    Last Post: 03-11-2007, 12:03 AM
  5. Date for 3000 mem.
    By toolmkrman in forum Community Club House
    Replies: 6
    Last Post: 11-06-2003, 10:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •