Page 1 of 2 12 LastLast
Results 1 to 12 of 18

Thread: julian date engraving

  1. #1
    Registered
    Join Date
    Jan 2005
    Location
    usa
    Posts
    15
    Downloads
    0
    Uploads
    0

    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
    Registered christinandavid's Avatar
    Join Date
    Aug 2009
    Location
    New Zealand
    Posts
    654
    Downloads
    0
    Uploads
    0
    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
    Registered christinandavid's Avatar
    Join Date
    Aug 2009
    Location
    New Zealand
    Posts
    654
    Downloads
    0
    Uploads
    0




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

    DP


  4. #4
    Registered
    Join Date
    Jan 2005
    Location
    usa
    Posts
    15
    Downloads
    0
    Uploads
    0

    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
    Registered christinandavid's Avatar
    Join Date
    Aug 2009
    Location
    New Zealand
    Posts
    654
    Downloads
    0
    Uploads
    0
    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
    Registered
    Join Date
    Feb 2006
    Location
    United States
    Posts
    293
    Downloads
    0
    Uploads
    0
    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
    Registered
    Join Date
    Jan 2005
    Location
    usa
    Posts
    15
    Downloads
    0
    Uploads
    0
    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
    Registered
    Join Date
    Feb 2006
    Location
    United States
    Posts
    293
    Downloads
    0
    Uploads
    0
    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
    Registered
    Join Date
    Jan 2005
    Location
    usa
    Posts
    15
    Downloads
    0
    Uploads
    0
    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
    Registered
    Join Date
    Feb 2006
    Location
    United States
    Posts
    293
    Downloads
    0
    Uploads
    0
    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 11:31 PM. Reason: Fixed loop counter (0-105 instead of 1-106) so center distance value was not off by one loop


  • #11
    Registered
    Join Date
    Jan 2005
    Location
    usa
    Posts
    15
    Downloads
    0
    Uploads
    0
    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
    Registered
    Join Date
    Feb 2006
    Location
    United States
    Posts
    293
    Downloads
    0
    Uploads
    0
    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.


  • Page 1 of 2 12 LastLast

    Similar Threads

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

    Posting Permissions


     


    About CNCzone.com

      We are the largest and most active discussion forum from DIY CNC Machines to the Cad/Cam software to run them. The site is 100% free to join and use, so join today!

    Follow us on

    Facebook Dribbble RSS Feed


    Search Engine Friendly URLs by vBSEO ©2011, Crawlability, Inc.