Page 8 of 13 FirstFirst ... 678910 ... LastLast
Results 141 to 160 of 248
Like Tree11Likes

Thread: Macro Programming Fundamentals

  1. #141
    sinha is offline Cast Iron
    Join Date
    Sep 2010
    Location
    india
    Posts
    267

    Default

    You may change wear offset on offset screen also.

  2. #142
    dicer is offline Cast Iron
    Join Date
    May 2009
    Location
    wa
    Posts
    271

    Default

    Quote Originally Posted by newg3 View Post
    We have a VMC with OM control and I have been using G10 in the program to set the work and tool length offsets.

    We use preset tools so to make a depth change, we have to alter the value in the G10 line for that tool. I would rather not change the program so I was wondering if there was variable you could add to the G10 line that would act as a wear offset for the tool lengths.

    Thanks for any help....
    The simple answer is yes. Don't have the info in front of me now. Oh but you wouldn't want it on the G10 line, just below it.

  3. #143
    dicer is offline Cast Iron
    Join Date
    May 2009
    Location
    wa
    Posts
    271

    Default I have a question

    Is there another way to call a program from a program? That is not using the
    M98 and M99 stuff? Meaning I don't want a sub and main program. Just the program changing at pallet swap time, with the pallet.
    And the reason for not wanting a main and sub arrangement is because the program may need to be stopped and reset etc. that makes it difficult for someone else running the machine.

  4. #144
    stevo1 is offline Cast Iron
    Join Date
    May 2008
    Location
    Great State Of Wisconsin
    Posts
    435

    Default

    Quote Originally Posted by dicer View Post
    Is there another way to call a program from a program? That is not using the M98 and M99 stuff?
    Aside from hard coding your pallet change code into the main program or using a Haas machine…no not that I know of. What is the problem with having a separate program for calling the pallet? How does someone else get screwed up? You can make your pallet change program call with a custom M or G code so that is all you would need in the main program.

    Stevo

  5. #145
    sinha is offline Cast Iron
    Join Date
    Sep 2010
    Location
    india
    Posts
    267

    Default

    Apart from M98/G65 and custom G/M/T codes, one can also call a sub by a chosen ASCII code such as A. There was a thread on this a few months back.

  6. #146
    jvangelder is offline Aluminum
    Join Date
    Aug 2010
    Location
    Southern NH, USA
    Posts
    176

    Default

    Quote Originally Posted by dicer View Post
    Is there another way to call a program from a program? That is not using the
    M98 and M99 stuff? Meaning I don't want a sub and main program. Just the program changing at pallet swap time, with the pallet.
    And the reason for not wanting a main and sub arrangement is because the program may need to be stopped and reset etc. that makes it difficult for someone else running the machine.

    Not having a pallet machine myself im guessing, however

    Im assuming there is a paremeter that denotes which pallet is where that you can read, that being said, why not write your program so skips to a line number depending on which pallet is in use.

  7. #147
    stevo1 is offline Cast Iron
    Join Date
    May 2008
    Location
    Great State Of Wisconsin
    Posts
    435

    Default

    Well the way that I am reading dicer’s post is he does not want to call a subprogram of any kind. Or does he just mean I don't want M98??
    “Meaning I don't want a sub and main program.”

    So this would include not using M98 or any other custom code that would call a subprogram. The only way I see around this is to code the pallet change right into the main program. This would involve basically putting all the code that the pallet change needs right in the main (safe moves, safe codes, all the pertaining Mcodes etc.). This is going to be more confusing and problematic then just actually calling a subprogram.

    The only other way I see it being able to be done is if he was running a Haas and used the M97.

    Stevo

  8. #148
    newg3 is offline Plastic
    Join Date
    Jun 2007
    Location
    Maine
    Posts
    43

    Default

    Quote Originally Posted by dicer View Post
    The simple answer is yes. Don't have the info in front of me now. Oh but you wouldn't want it on the G10 line, just below it.
    Dicer, I would be interested to see what that looks like. When you
    get a minute, please post it up.

    Much appreciated......

  9. #149
    angelw is online now Hot Rolled
    Join Date
    Sep 2010
    Location
    Victoria Australia
    Posts
    838

    Default

    Quote Originally Posted by newg3 View Post
    We have a VMC with OM control and I have been using G10 in the program to set the work and tool length offsets.

    We use preset tools so to make a depth change, we have to alter the value in the G10 line for that tool. I would rather not change the program so I was wondering if there was variable you could add to the G10 line that would act as a wear offset for the tool lengths.

    Thanks for any help....
    As Sinha stated in his last post, you could apply the change in an actual wear offset. Whether you input a value in an offset data registry or a Macro Variable registry is a toss up, so you may as well use the actual wear offset if one exists. This will depend on the Tool Compensation Memory the control has.

    Often the control does not have separate Geometry and Wear offsets, so in this case a variable could be used in the program to apply the difference. As is normally the case with CNC programming, there are a few ways of achieving the desired result.

    1. Structure the program so that your G10 for loading the Tool Length is only read once when the program is first loaded, then variations can be made to the actual Tool Length Offset loaded by G10. You can do this by using a block delete on the G10 line, or have a conditional statement that looks at a non volatile Macro Variable such as #500 and jumps past the G10 block if it’s set to 1. For example:

    Start of program
    etc
    etc
    If [#500 EQ 1] GOTO 10
    G90 G10 L11 P_ R_
    #500 = 1
    N10

    The draw back is that you have to remember to either turn block delete on after the first read, or set #500 to Zero when the program is first loaded.

    2. Input the value of your variation to the original G10 input value in a non volatile variable such as #500, and have that value added to, or subtracted from the G10 value that’s already been loaded into the Offset Registry. For example with Tool Compensation Memory A (No Wear Offsets):

    Start of program
    etc
    etc
    G90 G10 L11 P_ R_
    G91 G10 L11 P_ R#500
    G90

    In this case the P would be the same value in each G10 block and a minus sign or not in #500 would determine if the variation to the Tool Length Offset is added or subtracted.

    3. Enter the required variation to the value loaded in the Tool Length offset by the first G10 block, into another Tool Length offset that has some numerical association with the primary Tool Length offset. For example if Tool Length offset 24 is being used in the program and is were the G10 block is loading the value, you might put the variation in Tool Length offset 124 if you have sufficient offsets. Then in your program you could have something like the following:

    Start of program
    etc
    etc
    G90 G10 L11 P_ R_
    #1 = #2124 (SYSTEM VARIABLE FOR TOOL OFFSET NUMBER 124)
    G91 G10 L11 P_ R#1
    G90

    The variable used in R does not have to be non volatile because the offset contained in the Tool Offset in this example will be retained when the machine is powered down.

    Regards,

    Bill

  10. #150
    sinha is offline Cast Iron
    Join Date
    Sep 2010
    Location
    india
    Posts
    267

    Default

    As a matter of personal preference, I do not like the use of G10 unless there is no system variable associated with what we want to change. The system variable method is simpler to use (need not worry about syntax) as well as more flexible (you can read the current value, before changing it).

  11. #151
    dicer is offline Cast Iron
    Join Date
    May 2009
    Location
    wa
    Posts
    271

    Default

    At pallet change I wish to call the correct program for that job or part.
    If you main and sub it, then if you have to reset, like if an MOO says "check for clean up" and it isn't cleaned up. You reset, and rerun that tool. Well if it is a main and sub then its a bit of a mess to find your way back to that tool.

    I will post that info, when I have the book here.
    (for the guy that asked)

  12. #152
    newg3 is offline Plastic
    Join Date
    Jun 2007
    Location
    Maine
    Posts
    43

    Default

    Bill-
    Your option 3 is the one that will work for us. I will try it out
    when I get back in the shop Monday. I knew about the G91
    incremental move but did not think to put it after setting the
    length with G90. Thanks for the help. Blaine

  13. #153
    oxyplants is offline Banned
    Join Date
    Oct 2010
    Location
    Bangalore
    Posts
    5

  14. #154
    sinha is offline Cast Iron
    Join Date
    Sep 2010
    Location
    india
    Posts
    267

    Default A request

    Those who have read my book on macro programming are requested to post their reviews, good or bad, on amazon's US/UK site

    Amazon.com: CNC Programming using Fanuc Custom Macro B (9780071713320): S.K Sinha: Books

    CNC Programming using Fanuc Custom Macro B: Amazon.co.uk: S.K Sinha: Books

    This would help others to judge the suitability of this book for their needs.

    Thanks.

    Sinha

  15. #155
    sinha is offline Cast Iron
    Join Date
    Sep 2010
    Location
    india
    Posts
    267

    Default

    Those using my book would find the attached additional appendices useful. These would be included in the second edition of the book.
    Attached Files Attached Files

  16. #156
    Flyguy is offline Plastic
    Join Date
    Apr 2011
    Location
    Sioux Falls, SD. USA
    Posts
    5

    Default Circular Pocket Milling Macro

    I have been reading this thread in the hope that I will be able to start programming my own canned cycles. I have a basic understanding of G and M codes (we don't have any CAD/CAM software at our little two man shop) and I do most of the programming, but I have run into a problem. I have to counter bore a hole to .493 ID and we don't have an end mill that size, so as I understand it, I would have to use a G13 on each of the 2,370 holes in the fixture I am building. I was wondering if there would be any way to make a canned cycle to make the same counter bore without having to enter in each hole location separately?

    This is the way I have (or more accurately the Haas conversational drill program) written the drill portion of the program.

    G83 G98 Z-1.2 F5. R.5 Q.025 L0;
    G72 I.985 J180. L30;

    I would like to use something similar for the CB but I am at a loss as to how. Any help that you would be able to send my way would be greatly appreciated.

    Dan

  17. #157
    Tonytn36 is online now Diamond
    Join Date
    Dec 2007
    Location
    Southeastern US
    Posts
    4,286

    Default

    Dan, if the holes are on a grid pattern (or a clear mathematical sequence), it should be simple enough to do with macro.

    Lets say we are doing a grid of 3" Row spacing x 4" Column spacing, 10 holes long, 8 holes wide......

    #500 = 0.493 (Cbore Dia)
    #501 = 3.0 (Row spacing)
    #502 = 4.0 (Column spacing)
    #503 = 0.5 (Cbore Depth)
    #504 = 0 (row counter)
    #505 = 0 (column counter)
    #506 = 10 (Row Counter)
    #507 = 8 (Column counter)
    #508 = 0 (Initial Hole Position X)
    #509 = 0 (Initial Hole Position Y)
    Obligatory stuff goes here

    #510 = [#500/2] (Cbore Radius)
    N10 G0 X#508 Y#509 Z0.1 (First hole position)
    G1 Z-#503 F10 (Down in Z)
    G13 I#510 Dxx Fx (G13 circular interp)
    G0 Z0.1 (Up in Z
    #504=[#504+1] (Increment hole counter)
    #508=[#508+#501] (Increment X spacing)
    IF [#504 GT #506] GOTO 30 (IF hole counter greater than set, jump out)
    GOTO 10
    N30 #508 = 0 (Reset X to 0 - or initial position)
    #504 = 0 (Reset row counter)
    #509 = [#509+#502] (Increment column Position
    #505 = [#505+1] (increment column counter)
    IF [#505 GT #507] GOTO N100 (End program)
    GOTO 10


    End of program stuff

    If I've done this right, it should do the holes in a zig-zag pattern.....It's been a long mentally draining week and I'm writing this off the cuff so there could be a woops in it somewhere...

  18. #158
    Flyguy is offline Plastic
    Join Date
    Apr 2011
    Location
    Sioux Falls, SD. USA
    Posts
    5

    Talking

    Thank you Tony! it looks like that will work for us (If I understand it correctly). I will try it today and let you know how it turns out.

  19. #159
    Flyguy is offline Plastic
    Join Date
    Apr 2011
    Location
    Sioux Falls, SD. USA
    Posts
    5

    Default

    The Macro that you sent me worked great! My boss was impressed with that little bit of code doing all the work. I had to modify a little bit of it to make it fit the print (when I posted the question I forgot that the program would need to skip four holes that are being used to clamp the part to the table. but it was easily fixed with a few logic statements). Our shop is now convinced that Macros are the way to go for repetitive parts. Thanks again.

    Dan

  20. #160
    Tonytn36 is online now Diamond
    Join Date
    Dec 2007
    Location
    Southeastern US
    Posts
    4,286

    Default

    YW, glad it worked out for you. Macro's will save you a bunch of work (and coding).

Page 8 of 13 FirstFirst ... 678910 ... LastLast

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
  •