Macro Programming Fundamentals - Page 43
Close
Login to Your Account
Page 43 of 44 FirstFirst ... 3341424344 LastLast
Results 841 to 860 of 876
  1. #841
    Join Date
    Oct 2020
    Country
    IRAN, ISLAMIC REPUBLIC OF
    Posts
    6
    Post Thanks / Like
    Likes (Given)
    5
    Likes (Received)
    0

    Default

    Hi all.
    I have this macro to milling a square part with cutter comp(G41/G42). Step down is 1mm, size of square is 50mm with 30mm height.
    Every time tool reach the end of the cycle it'll retract to start position (X60 Y60) and then follows the shape again.
    Now I wonder if anyone know of a macro to helically step down the cutting process and remove the retracts?

    Code:
    G91 G28 Z0 ;
    G90 G54 X0 Y0 M3 S1200 ;
    G43 Z100 H1 ;
    G0 G40 X60 Y60;
    #1=0 ;
    #2=-30 ;
    N1 G1 Z#1 F2000 ;
    G41 D10 X50 F1200 ;
    Y-50 ;
    X-50 ;
    Y50 ;
    X60 ;
    G0 G40 Y60 ;
    #1=#1-1 ;
    IF [#1 GE #2] GOTO 1 ;
    G91 G28 Z0 ;
    M5 ;
    M30 ;

  2. #842
    Join Date
    Sep 2010
    Location
    Victoria Australia
    Posts
    4,170
    Post Thanks / Like
    Likes (Given)
    0
    Likes (Received)
    1778

    Default

    Quote Originally Posted by Alir3za View Post
    Hi all.
    I have this macro to milling a square part with cutter comp(G41/G42). Step down is 1mm, size of square is 50mm with 30mm height.
    Every time tool reach the end of the cycle it'll retract to start position (X60 Y60) and then follows the shape again.
    Now I wonder if anyone know of a macro to helically step down the cutting process and remove the retracts?

    Code:
    G91 G28 Z0 ;
    G90 G54 X0 Y0 M3 S1200 ;
    G43 Z100 H1 ;
    G0 G40 X60 Y60;
    #1=0 ;
    #2=-30 ;
    N1 G1 Z#1 F2000 ;
    G41 D10 X50 F1200 ;
    Y-50 ;
    X-50 ;
    Y50 ;
    X60 ;
    G0 G40 Y60 ;
    #1=#1-1 ;
    IF [#1 GE #2] GOTO 1 ;
    G91 G28 Z0 ;
    M5 ;
    M30 ;
    Hello Alir3za,
    The following will work for you. If you really want a helical in-feed, I can show you how to do that. The feed rates you have seem way too high.

    Regards,

    Bill

    G91 G28 Z0.0 ;
    G90 G00 G54 X0.0 Y0.0 M3 S1200 ;
    G43 Z100.0 H1 ;
    G40 G00 X60.0 Y60.0;
    #1 = 0 ; (Z START)
    #2 = -1.0 (DOC)
    #3 = -30.0 ; (FINISHED Z COORDINATE)
    #4 = #1 + 1 (RETRACT PLANE)
    G01 Z#4 F2000 ;
    WHILE [#1 GT #3] DO1
    #1 = #1 + #2 (SET NEW DOC)
    IF [#1 LT #3] TH #1 = #3 (ENSURE NO OVER CUT IN Z)
    G01 Z#1 F100 (FEED TO DEPTH OF NEW DOC)
    G41 G01 X50.0 D10 F1200 ;
    G01 Y-50.0 ;
    G01 X-50.0 ;
    G01 Y50.0 ;
    G01 X60.0 ;
    G40 G01 Y60.0 ;
    END1
    G00 Z#4
    G91 G28 Z0.0 ;
    M5 ;
    M30 ;
    Last edited by angelw; 03-24-2021 at 05:15 AM.

  3. Likes Alir3za liked this post
  4. #843
    Join Date
    Oct 2020
    Country
    IRAN, ISLAMIC REPUBLIC OF
    Posts
    6
    Post Thanks / Like
    Likes (Given)
    5
    Likes (Received)
    0

    Default

    Quote Originally Posted by angelw View Post
    Hello Alir3za,
    The following will work for you. If you really want a helical in-feed, I can show you how to do that. The feed rates you have seem way too high.

    Regards,

    Bill
    Thank you angelw for the replay.
    I tried your marco but it wasn't helical moves and after each step down machine retracted to start position and took another step until the end of program so result was the same as macro I did write in my previous post.

  5. #844
    Join Date
    Sep 2010
    Location
    Victoria Australia
    Posts
    4,170
    Post Thanks / Like
    Likes (Given)
    0
    Likes (Received)
    1778

    Default

    Quote Originally Posted by Alir3za View Post
    Thank you angelw for the replay.
    I tried your marco but it wasn't helical moves and after each step down machine retracted to start position and took another step until the end of program so result was the same as macro I did write in my previous post.
    Hello Alir3za,
    Do you mean that you want move down to the next DOC as you navigate the square form? If so, you need to specify whether want to move the DOC, in your example -1.0mm, along the first face only, or all faces, resulting in a 4.0mm DOC by the time the cutter reaches the last corner.



    Regards,

    Bill

  6. #845
    Join Date
    Jan 2014
    Country
    UNITED STATES
    State/Province
    Washington
    Posts
    5,701
    Post Thanks / Like
    Likes (Given)
    1009
    Likes (Received)
    3220

    Default

    Must be a language issue at play here. Helical moves are circular, but the macro is following a square pattern. Probably need to say you want to ramp deeper into the cut



    Quote Originally Posted by Alir3za View Post
    .....
    Now I wonder if anyone know of a macro to helically step down the cutting process and remove the retracts?

    Code:
    G91 G28 Z0 ;
    G90 G54 X0 Y0 M3 S1200 ;
    G43 Z100 H1 ;
    G0 G40 X60 Y60;
    #1=0 ;
    #2=-30 ;
    N1 G1 Z#1 F2000 ;
    G41 D10 X50 F1200 ;
    Y-50 ;
    X-50 ;
    Y50 ;
    X60 ;
    G0 G40 Y60 ;
    #1=#1-1 ;
    IF [#1 GE #2] GOTO 1 ;
    G91 G28 Z0 ;
    M5 ;
    M30 ;

  7. Likes Alir3za, PROBE liked this post
  8. #846
    Join Date
    Sep 2010
    Location
    Victoria Australia
    Posts
    4,170
    Post Thanks / Like
    Likes (Given)
    0
    Likes (Received)
    1778

    Default

    Quote Originally Posted by Alir3za View Post
    Thank you angelw for the replay.
    I tried your marco but it wasn't helical moves and after each step down machine retracted to start position and took another step until the end of program so result was the same as macro I did write in my previous post.
    Hello Alir3za,
    Following are examples ramping on one side only and all sides:

    Ramp on one side only example.
    G91 G28 Z0.0 ;
    G90 G00 G54 X0.0 Y0.0 M3 S1200 ;
    G43 Z100.0 H1 ;
    G40 G00 X60.0 Y60.0;
    #1 = 0 ; (Z START)
    #2 = -1.0 (DOC)
    #3 = -30.0 ; (FINISHED Z COORDINATE)
    #4 = #1 + 1 (RETRACT PLANE)
    G01 Z#1 F2000 ;
    G41 G01 X50.0 D10 F1200 ;
    WHILE [#1 GT #3] DO1
    #1 = #1 + #2 (SET NEW DOC)
    IF [#1 LT #3] TH #1 = #3 (ENSURE NO OVER CUT IN Z)
    G01 Y-50.0 Z#1 F1200
    G01 X-50.0 ;
    G01 Y50.0 ;
    G01 X50.0 ;
    END1
    (FINISH PASS ON FIRST SIDE AT DEPTH STARTS HERE)
    G01 Y-50.0
    G40 G01 X60.0 ;
    G00 Z#4
    G91 G28 Z0.0 ;
    M5 ;
    M30 ;

    Ramp on each side example.
    G91 G28 Z0.0 ;
    G90 G00 G54 X0.0 Y0.0 M3 S1200 ;
    G43 Z100.0 H1 ;
    G40 G00 X60.0 Y60.0;
    #1 = 0 ; (Z START)
    #2 = -1.0 (DOC)
    #3 = -30.0 ; (FINISHED Z COORDINATE)
    #4 = #1 + 1 (RETRACT PLANE)
    G01 Z#1 F2000 ;
    G41 G01 X50.0 D10 F1200 ;
    WHILE [#1 GT #3] DO1
    #1 = #1 + #2 (SET NEW DOC)
    IF [#1 LT #3] TH #1 = #3 (ENSURE NO OVER CUT IN Z)
    G01 Y-50.0 Z#1
    #1 = #1 + #2 (SET NEW DOC)
    IF [#1 LT #3] TH #1 = #3 (ENSURE NO OVER CUT IN Z)
    G01 X-50.0 Z#1
    #1 = #1 + #2 (SET NEW DOC)
    IF [#1 LT #3] TH #1 = #3 (ENSURE NO OVER CUT IN Z)
    G01 Y50.0 Z#1
    #1 = #1 + #2 (SET NEW DOC)
    IF [#1 LT #3] TH #1 = #3 (ENSURE NO OVER CUT IN Z)
    G01 X50.0 Z#1
    END1
    (FINISH PASS AT DEPTH STARTS HERE)
    G01 Y-50.0
    G01 X-50.0
    G01 Y50.0
    G01 X50.0
    G40 G01 Y60.0 ;
    G00 Z#4
    G91 G28 Z0.0 ;
    M5 ;
    M30 ;

    Regards,

    Bill

  9. Likes Alir3za, PROBE, acncguy liked this post
  10. #847
    Join Date
    Jan 2003
    Location
    Tel Aviv, Israel
    Posts
    704
    Post Thanks / Like
    Likes (Given)
    123
    Likes (Received)
    188

    Default

    Quote Originally Posted by angelw View Post
    Hello Alir3za,
    Following are examples ramping on one side only and all sides:

    Ramp on one side only example.
    G91 G28 Z0.0 ;
    G90 G00 G54 X0.0 Y0.0 M3 S1200 ;
    G43 Z100.0 H1 ;
    G40 G00 X60.0 Y60.0;
    #1 = 0 ; (Z START)
    #2 = -1.0 (DOC)
    #3 = -30.0 ; (FINISHED Z COORDINATE)
    #4 = #1 + 1 (RETRACT PLANE)
    G01 Z#1 F2000 ;
    G41 G01 X50.0 D10 F1200 ;
    WHILE [#1 GT #3] DO1
    #1 = #1 + #2 (SET NEW DOC)
    IF [#1 LT #3] TH #1 = #3 (ENSURE NO OVER CUT IN Z)
    G01 Y-50.0 Z#1 F1200
    G01 X-50.0 ;
    G01 Y50.0 ;
    G01 X50.0 ;
    END1
    (FINISH PASS ON FIRST SIDE AT DEPTH STARTS HERE)
    G01 Y-50.0
    G40 G01 X60.0 ;
    G00 Z#4
    G91 G28 Z0.0 ;
    M5 ;
    M30 ;

    Ramp on each side example.
    G91 G28 Z0.0 ;
    G90 G00 G54 X0.0 Y0.0 M3 S1200 ;
    G43 Z100.0 H1 ;
    G40 G00 X60.0 Y60.0;
    #1 = 0 ; (Z START)
    #2 = -1.0 (DOC)
    #3 = -30.0 ; (FINISHED Z COORDINATE)
    #4 = #1 + 1 (RETRACT PLANE)
    G01 Z#1 F2000 ;
    G41 G01 X50.0 D10 F1200 ;
    WHILE [#1 GT #3] DO1
    #1 = #1 + #2 (SET NEW DOC)
    IF [#1 LT #3] TH #1 = #3 (ENSURE NO OVER CUT IN Z)
    G01 Y-50.0 Z#1
    #1 = #1 + #2 (SET NEW DOC)
    IF [#1 LT #3] TH #1 = #3 (ENSURE NO OVER CUT IN Z)
    G01 X-50.0 Z#1
    #1 = #1 + #2 (SET NEW DOC)
    IF [#1 LT #3] TH #1 = #3 (ENSURE NO OVER CUT IN Z)
    G01 Y50.0 Z#1
    #1 = #1 + #2 (SET NEW DOC)
    IF [#1 LT #3] TH #1 = #3 (ENSURE NO OVER CUT IN Z)
    G01 X50.0 Z#1
    END1
    (FINISH PASS AT DEPTH STARTS HERE)
    G01 Y-50.0
    G01 X-50.0
    G01 Y50.0
    G01 X50.0
    G40 G01 Y60.0 ;
    G00 Z#4
    G91 G28 Z0.0 ;
    M5 ;
    M30 ;

    Regards,

    Bill
    Brilliant, as usual.

    Stefan

  11. #848
    Join Date
    Oct 2020
    Country
    IRAN, ISLAMIC REPUBLIC OF
    Posts
    6
    Post Thanks / Like
    Likes (Given)
    5
    Likes (Received)
    0

    Default

    Hi. hope everyone is doing well
    I have a 4 axis program but it's just a single pass so I need a way to put it in a macro to help me have the program in multiple pass in Z direction.
    Is it possible?


  12. #849
    Join Date
    Sep 2010
    Location
    Victoria Australia
    Posts
    4,170
    Post Thanks / Like
    Likes (Given)
    0
    Likes (Received)
    1778

    Default

    Quote Originally Posted by Alir3za View Post
    Hi. hope everyone is doing well
    I have a 4 axis program but it's just a single pass so I need a way to put it in a macro to help me have the program in multiple pass in Z direction.
    Is it possible?
    But of course.

    I understand that your issue involves a 4th Axis, but the following X/Y with Z DOC program example can be manipulated to suit your needs.

    #1 = 0.0 - Z Start Point
    #2 = -3.0 - Incremental DOC with Direction
    #3 = -10.0 - Full Depth

    G90 G00 G54 X0.0 Y0.0 (RAPID TO X/Y START POINT)
    G43 Z10.0 H01 M08
    G01 Z1.0 F1000
    WHILE[#1 GT #3]DO1
    #1 = #1 + #2 (SET NEXT DOC)
    IF[#1 LT #3] THEN #1 = #3 (STOP OVER CUT IN Z)
    G01 Z#1 F_ _ (Z CUT IN)
    --------------
    --------------
    --------------
    Machining Code Goes Here
    --------------
    --------------
    --------------
    END1
    G00 Z10.0 M09
    G53 Z0.0 M05
    G53 X0.0 Y0.0
    M30

    Regards,

    Bill

  13. Likes Alir3za, mountie, SumiSpy liked this post
  14. #850
    Join Date
    Oct 2020
    Country
    IRAN, ISLAMIC REPUBLIC OF
    Posts
    6
    Post Thanks / Like
    Likes (Given)
    5
    Likes (Received)
    0

    Default

    Quote Originally Posted by angelw View Post
    But of course.

    I understand that your issue involves a 4th Axis, but the following X/Y with Z DOC program example can be manipulated to suit your needs.

    #1 = 0.0 - Z Start Point
    #2 = -3.0 - Incremental DOC with Direction
    #3 = -10.0 - Full Depth

    G90 G00 G54 X0.0 Y0.0 (RAPID TO X/Y START POINT)
    G43 Z10.0 H01 M08
    G01 Z1.0 F1000
    WHILE[#1 GT #3]DO1
    #1 = #1 + #2 (SET NEXT DOC)
    IF[#1 LT #3] THEN #1 = #3 (STOP OVER CUT IN Z)
    G01 Z#1 F_ _ (Z CUT IN)
    --------------
    --------------
    --------------
    Machining Code Goes Here
    --------------
    --------------
    --------------
    END1
    G00 Z10.0 M09
    G53 Z0.0 M05
    G53 X0.0 Y0.0
    M30

    Regards,

    Bill
    You're a lifesaver angelw.seems great.
    let me check it out.

  15. #851
    Join Date
    Sep 2010
    Location
    india
    Posts
    1,385
    Post Thanks / Like
    Likes (Given)
    75
    Likes (Received)
    267

    Default

    Bill is a person, not a tool

  16. Likes PROBE, barbter liked this post
  17. #852
    Join Date
    Jun 2009
    Country
    UNITED STATES
    State/Province
    California
    Posts
    164
    Post Thanks / Like
    Likes (Given)
    109
    Likes (Received)
    48

    Default

    Looking for some assistance on a macro program that I am writing. What I am trying to do is search to see what variable corresponds with a value that is in my control. The programming manual skips a huge section, obviously to keep people from messing with things, so here we are.

    Program intent is to pull a system variable's value and reference it against the value in the program. If it doesn't match, add one to the variable and check again. Repeat until its found or count is out of range. This is all assuming the System Variables are all Readable. Whether or not it is Writeable is another story but for now I just need to find it. Ultimate goal is to be able to write to a System Variable via program to eliminate a step in my current process. I've successfully automated the rest of the process but this is the only remaining value I still need to type in manually. I just can't find the system variable number and the MTB will not share the information.

    I just mainly want to get another set of eyes on this and see if things look okay, or if there is a way to simplify it.

    Note, I have already backed up my machine so if things get overwritten, it isn't the end of the world. I would obviously like to avoid that though which is why I'm here. Also, the common variables can be changed to anything, doesn't matter to me, but I do in fact know they are not being used by any probing routines/calibration/etc.

    (SYSTEM VARIABLE SEARCH)
    #550=4.2912 (VALUE BEING SEARCHED)
    #551=1000 (STARTING VARIABLE)
    #552=1 (COUNTER INCREMENT)

    N1 (BEGIN SEARCH)
    #553=#[#551] (VARIABLE VALUE)
    IF [#553EQ#550] GOTO2 (VALUE CONDITION CHECK)
    #551=[#551+#552] (COUNT UP TO NEXT VARIABLE)
    GOTO1 (REPEAT)
    N2 (END SEARCH)
    M30 (END PROGRAM)

  18. #853
    Join Date
    Sep 2010
    Location
    Victoria Australia
    Posts
    4,170
    Post Thanks / Like
    Likes (Given)
    0
    Likes (Received)
    1778

    Default

    Hello couch,
    I'm struggling to see this being a viable Macro program. There is the possibility that there may be more than one variable, perhaps many, that match the number you're searing for. Further, there will probably be System Variables Numbers, corresponding to the System Variables that you're attempting to read that aren't defined and therefore, an alarm will be raised.

    Regards,

    Bill

  19. #854
    Join Date
    Jun 2009
    Country
    UNITED STATES
    State/Province
    California
    Posts
    164
    Post Thanks / Like
    Likes (Given)
    109
    Likes (Received)
    48

    Default

    Thanks Bill,

    I'm not too worried about there being multiple locations of this same value as this programs intent is not to overwrite any of them, just find them. I can test it and if it stops as desired, I'll change the value and retest. If the same System Variable Number is shown then it is the one I'm after. Really just looking to see if I'm writing this correctly. I could just test it on the control and see what happens but would appreciate another set of eyes on it that has a much deeper understanding of this than I do.

    To simplify things I've made a couple changes shown below. In the control I have set up my G54 A-Axis work offset to be 1.985 and set a range to search from #5221-#5226. This way I'm only searching for one specific, easily found value that I know for a fact is in the control, and has a System Variable with a Number. This will at least test the function of the program.

    (SYSTEM VARIABLE SEARCH)
    #550=1.985 (VALUE BEING SEARCHED)
    #551=5221 (STARTING VARIABLE)
    #552=1 (COUNTER INCREMENT)
    #554=5226 (COUNTER RANGE END)

    N1 (BEGIN SEARCH)
    #553=#[#551] (VARIABLE VALUE)
    IF [#553EQ#550] GOTO2 (VALUE CONDITION CHECK)
    IF [#553EQ#554] GOTO3 (RANGE CHECK)
    #551=[#551+#552] (COUNT UP TO NEXT VARIABLE)
    GOTO1 (REPEAT)
    N2#3000=2(VALUE FOUND)
    N3 (END RANGE)
    M30 (END PROGRAM)


    Note, I just tested it after posting this and it worked perfect, however as you mentioned its alarming when searching thru System Variable Numbers that do not exist.

  20. #855
    Join Date
    Jan 2015
    Country
    UNITED STATES
    State/Province
    California
    Posts
    870
    Post Thanks / Like
    Likes (Given)
    129
    Likes (Received)
    458

    Default

    Is there a block delete macro variable on Fanuc 30i equivalent to Haas' #3032?

  21. #856
    Join Date
    Apr 2010
    Country
    UNITED STATES
    State/Province
    Wisconsin
    Posts
    6,218
    Post Thanks / Like
    Likes (Given)
    4263
    Likes (Received)
    3965

    Default

    Floundering trying to accomplish some conditional arithmetic and would appreciate some assistance.

    The issue may well be the NCPlot widget (Macro Expression Calculator) simply doesn't support this, but I would like to figure this out.

    I want to define a mathematical value of a variable based upon the value of another variable.

    For example -

    #501=15

    If #501 is less than 30, then #502 should equal 3*#501. However, if #501 is greater than or (equal to) 30, then #502 should equal ((4*#501)+5).

    I've been writing this (unsuccessfully) as -

    #501=15
    IF [#501 LT 30] THEN [#502=[#501*3]]
    IF [#501 GE 30] THEN [#502=[#501*4]+5]

    How should this be defined correctly? Thank you.

  22. #857
    Join Date
    Nov 2019
    Country
    UNITED STATES
    State/Province
    California
    Posts
    2
    Post Thanks / Like
    Likes (Given)
    0
    Likes (Received)
    0

    Default

    Quote Originally Posted by Zahnrad Kopf View Post
    I've been writing this (unsuccessfully) as -

    #501=15
    IF [#501 LT 30] THEN [#502=[#501*3]]
    IF [#501 GE 30] THEN [#502=[#501*4]+5]

    How should this be defined correctly? Thank you.
    Remove the extra brackets in the THEN statement.

    IF [#501 LT 30] THEN #502=[#501*3]
    IF [#501 GE 30] THEN #502=[#501*4]+5

    It should look like this for FANUC at least.

  23. #858
    Join Date
    Apr 2010
    Country
    UNITED STATES
    State/Province
    Wisconsin
    Posts
    6,218
    Post Thanks / Like
    Likes (Given)
    4263
    Likes (Received)
    3965

    Default How to deal with PI?

    Definition of Irony - Search function doesn't work due to PI having too few characters.

    How to deal with PI in equations driven variables? Is there a standard to go by when one needs to use PI? My understanding is that variables that get used by an axis for position will get rounded to the Imperial four places automatically. But what about/how to handle it when used in equations?

    Normally, I take equations out to 9 places for accuracy when making calculations. Ultimately, these values will get rounded down, but I'm thinking that the calculations could suffer if values are not left longer, at first. Is there a standard for how to keep the numbers/results to nine places UNTIL they are needed for use? Or have I confused myself and am over thinking this?

    Also, what is the best method for specifying PI? Should the first X number of places be placed into a variable that is called upon for use by other calculations?

    Thanks.

  24. #859
    Join Date
    Sep 2010
    Location
    india
    Posts
    1,385
    Post Thanks / Like
    Likes (Given)
    75
    Likes (Received)
    267

    Default

    In equations, calculations are correct up to 8 decimal digits. Rounding is done when a value or a variable containing the value is used as an axis position. I call it "implicit" rounding.

  25. #860
    Join Date
    Jan 2015
    Country
    UNITED STATES
    State/Province
    California
    Posts
    870
    Post Thanks / Like
    Likes (Given)
    129
    Likes (Received)
    458

    Default

    Quote Originally Posted by Zahnrad Kopf View Post
    Also, what is the best method for specifying PI? Should the first X number of places be placed into a variable that is called upon for use by other calculations?
    Not sure what control you're on, but on Fanuc you can use #3101 for PI





    Quote Originally Posted by thesidetalker View Post
    Is there a block delete macro variable on Fanuc 30i equivalent to Haas' #3032?
    Bueller? Bueller? Anyone know if that's possible?


Tags for this Thread

Bookmarks

Posting Permissions

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