Need Help! Whitespace and variable names in FANUC Macro B


Results 1 to 2 of 2

Thread: Whitespace and variable names in FANUC Macro B

  1. #1
    Registered
    Join Date
    Jul 2016
    Location
    Australia
    Posts
    1
    Downloads
    0
    Uploads
    0

    Question Whitespace and variable names in FANUC Macro B

    Hi Everyone,

    I'm currently writing a parser / interpreter for a GCode variant that I'd like to be similar to FANUC Macro B. In the absence of an actual FANUC controller (or a friend with one), my main resources so far are:
    • NIST GCode Spec: Kramer et al. (2000) The NIST RS274NGC Interpreter - Version 3.
    • Sinha, SK (2010) CNC Programming Using FANUC Custom Macro B.
    • Gainer and Murphy (2013) Custom Macro Programming, PMPA NTC 2013.


    It has been straightforward so far, but I've discovered an ambiguity with SETVN variable names that I'm hoping people here might be able to help with. (Especially anyone who has lots of experience with a real-world FANUC.)

    I'm assuming that FANUC Macro B is whitespace insensitive (please let me know if that's wrong).

    Given that assumption, I'm wondering: how does a FANUC controller interpret a block like the following:
    G01X#QY10;
    How does the controller determine where the variable name ends, since variable names can contain (at least) letters and numbers? Does it interpret this as:
    G01X[#Q]Y10;
    or as:
    G01X[#QY10];
    or does it depend on whether QY10 has previously been declared as a SETVN variable name?
    (I realize that I could write this with brackets, and I certainly would do that if I wanted clarity. But I'm trying to write a parser, so I care about the confusing edge-cases.)

    Thanks,

    Jonathan Merritt.

    Similar Threads:


  2. #2
    Member christinandavid's Avatar
    Join Date
    Aug 2009
    Location
    New Zealand
    Posts
    684
    Downloads
    0
    Uploads
    0

    Default Re: Whitespace and variable names in FANUC Macro B

    I have limited experience with SETVN. You cannot define new variables at will, you can only give a name to a certain range of common variables from #500 - #550, that can then be referenced by the name, as well as by their original numbers.

    I have found it useful only in the case of writing/reading probing routines. Renishaw macros save various data into the #100-199 range. I simply transferred the values into the #500 range and used SETVN to give them names such as #X_DIM, #Y_DIM, #X_ERR, #MAX_VAL, #MIN_VAL etc. This makes a complicated routine easier to follow if I ever need to revisit it.

    To move to a position that would highlight a certain result without trawling through the macro pages, I would need to put it like so:-

    G0 G90 X[#X_DIM] Y[#Y_DIM]
    M0 (CHECK)

    No other syntax would work, at least not on the 31i control I use. Spaces are not required when inputting, and depending on the display mode, spaces are put in automatically if the syntax is valid.

    It can be difficult to set a name that doesn't conflict with any other function! System variables also have names as well as numbers, but there is a certain structure to the numbering system which actually makes the numbers easier to work with.

    DP



Tags for this Thread

Posting Permissions

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


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

Whitespace and variable names in FANUC Macro B

Whitespace and variable names in FANUC Macro B