Page 1 of 5 1234 ... LastLast
Results 1 to 12 of 54

Thread: Newbie to Forum and Macros "Need Help"

  1. #1
    Registered
    Join Date
    Jun 2008
    Location
    USA
    Posts
    66
    Downloads
    0
    Uploads
    0

    Cool Newbie to Forum and Macros "Need Help"

    Hello everyone, this is my 1st Post so Hello #1. I'm new to Macros and am programming a takisawa using an older Fanuc control.What series,Don't know?
    Anyways I'm using th "WHERE" DO1 and END1 in a facing routine in a very small part and it is looping, but it doesn't come out of the loop? I know I'm doing something very small that needs to be changed. All I've read is Shmitz's book on Macros and jumping in and started writing. I've got this far and know I'm having trouble.If someone can help please let me know and I can send the program. Thx gtrrpa


  2. #2
    Registered ImanCarrot's Avatar
    Join Date
    Nov 2005
    Location
    UK
    Posts
    1468
    Downloads
    0
    Uploads
    0
    Ello mate, and welcome to the boards.

    I'm sure someone will correct me if I'm wrong- folk know a lot here, but...

    Are you sure the "WHERE" command is right.. isn't it "WHILE"

    eg:
    WHILE [#00LT#101]DO1
    ...
    ...
    END1

    I'm not too sure about your particular settup and only have a couple of mins before I leave work.. will look at it more tomorrow, sorry I only have a couple of mins to spare, but I'm sure the conditional loop is "WHILE" not "WHERE"?

    Search on here or Google the Web for the rather excellent Macro Programming guide by Scott Martinez, but I dunno if this pertains to your particular settup.

    Also.. beware of global and local variables- some change with every call or exit from a subroutine (some stay the same).

    Will post more tomorrow, and welcome here again!
    I love deadlines- I like the whooshing sound they make as they fly by.


  3. #3
    Registered
    Join Date
    Jun 2008
    Location
    USA
    Posts
    66
    Downloads
    0
    Uploads
    0
    Sorry "Corrrection" >>>>>>WHILE<<<<<<<<


  4. #4
    Registered
    Join Date
    Mar 2006
    Location
    United States
    Posts
    153
    Downloads
    0
    Uploads
    0
    Lets see the code then we can go from there.
    No matter how good you are, there is always someone better!!!


  • #5
    Registered
    Join Date
    Jun 2008
    Location
    USA
    Posts
    66
    Downloads
    0
    Uploads
    0

    Talking Here it is.Does the problem lie on the incremental moves?

    %
    :O6807(LG M.C. C/B.843)
    G28U0W0
    #1=#26
    #1=-.1
    #3=#1+.002
    T0303(FACE)
    G97
    G99
    M03S850
    /M08
    G0X.1
    G0Z.02
    G1F.01Z[#1+.015]
    WHILE[#1+.015GE[#1+.002]]DO 3
    G1F.01W-.007
    G1F.002X.84
    G1G99F.002W.005
    F.01X.1
    END 3
    G0Z4.
    M01
    M30
    %
    Dont forget, I'm in a counterbore with a .105 bore. Gong to finish c/bore at
    .843 dia. THX all for the help.................
    Last edited by gtrrpa; 06-04-2008 at 06:37 PM. Reason: spelling add on


  • #6
    Banned
    Join Date
    Jan 2006
    Location
    Seattle
    Posts
    883
    Downloads
    0
    Uploads
    0
    Man that is some bad code. Why on earth would you use a Macro to do that?


  • #7
    Registered
    Join Date
    Jun 2008
    Location
    USA
    Posts
    66
    Downloads
    0
    Uploads
    0

    Reason Being:

    Have all sorts of parts where the Z depth changes on the c/bore and want to have the operator only change value of #1, which will have a note stateing that this will be Z depth.of other parts. This is the reason to stay away .002 from bottom of c/bore to take 2 passes of .001 because the intersection of the bore and the wall of the face of the c/bore has to be very sharp. Any other Ideas?


  • #8
    Banned
    Join Date
    Jan 2006
    Location
    Seattle
    Posts
    883
    Downloads
    0
    Uploads
    0
    Well I think you should write individual cnc programs so your operator does not have to remember this wacky macky (macro.)


  • #9
    Registered
    Join Date
    Jun 2008
    Location
    USA
    Posts
    66
    Downloads
    0
    Uploads
    0
    Only thing he has to change is #1 once it's done for all tools.As it's shown it's already been rough c/bored leaving .01


  • #10
    Registered ImanCarrot's Avatar
    Join Date
    Nov 2005
    Location
    UK
    Posts
    1468
    Downloads
    0
    Uploads
    0
    Right, I'm by no means an expert at Macro programming, but if I recall correctly when you call a subroutine the variables are reset. So in your line

    WHILE[#1+.015GE[#1+.002]]DO 3

    #1 will start as zero and so the Greater than or Equal to statement will always be true and the loop will never end.

    To pass variables into a sub- routine I think you need to use the G65 command.

    Hang on.... might be a simpler solution...Try something for me please? instead of using variables #1 and #3 change these to #101 and #103- that should work since anything from #100 to #999 are Common Variables and, unlike Local Variables (#1 to #99), retain their values on entering and exiting to/ from a sub- routine. Variables #1 to #99 get reset on every subroutine call, so your conditional loop will (I think) always be true cos #1 will always start at zero.

    PS- don't mess about with #0, it cannot be set and is neither zero or anything, it's always empty (not zero, but empty)

    Also! don't mess with variables #1000 to #5999- unless you know what your up to LOL.
    I love deadlines- I like the whooshing sound they make as they fly by.


  • #11
    Registered
    Join Date
    Mar 2006
    Location
    United States
    Posts
    153
    Downloads
    0
    Uploads
    0
    I suggest changing to the common variables like Imancarrot mentioned but you might want to change your while statement to this.

    WHILE[[#1+.015]GE[#1+.002]]DO 3
    No matter how good you are, there is always someone better!!!


  • #12
    Registered ImanCarrot's Avatar
    Join Date
    Nov 2005
    Location
    UK
    Posts
    1468
    Downloads
    0
    Uploads
    0
    Chris is right, that is neater. But, it still won't work cos of the passing of variables from the main program to the sub- routine.

    You need to change variable #1 and #3 to #101 and #103 (or whatever # as long as it aint #0 or anything between #1000 to #5999). Variables #100 to #999 will keep their values on a subroutine call. I beleive that's where your problem is- the conditional loop will never end 'cos the value in #1 is not getting passed from the main program to the sub- routine and so variable #1 is always zero on entering the sub- routine and hence your conditional WHILE is always TRUE.

    Every time you call or return a subroutine the (local) #variable will be reset to zero UNLESS you G65 the variables prior to the start of the program which allows keeping their values (system variables). Even nested loops will reset the variable at that level of sub- routine

    My second suggestion in my previous post will work (ie: change the variables to above #99)... I think! but again, I'm not an expert.

    I would definately use Chris's format for the equation- it's neater and simpler and intuitively right. Yours would probably work ok, but best to cover all the bases.

    Please let us know if this works? If it does, you owe me a beer, lol: my mates down the pub at lunchtime were accusing me of being a workaholic as I scribbled over my notes with a pint of Stella

    I'll try and find a link to Scott Martinez's excellent explanation of Macro Programming. It's incredibly good.
    I love deadlines- I like the whooshing sound they make as they fly by.


  • Page 1 of 5 1234 ... LastLast

    Similar Threads

    1. Replies: 4
      Last Post: 11-09-2007, 12:59 PM
    2. tracking down MDI "hang" with loops & macros
      By howling60 in forum CamSoft Products
      Replies: 7
      Last Post: 03-02-2006, 03:28 PM
    3. How about a seperate "Linear motion" forum
      By rashid11 in forum Suggestions for the CNCzone.com site.
      Replies: 3
      Last Post: 06-03-2005, 07:01 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.