584,837 active members*
5,461 visitors online*
Register for free
Login
Page 2 of 2 12
Results 21 to 24 of 24
  1. #21
    Join Date
    Nov 2013
    Posts
    4280

    Re: Using Variables

    Hi,
    Mach4 doesn't use Python but it does use Lua and can be used to generate motion.

    I did a script a while back for a guy who wanted to do some 'pearling', which consists of circular brush marks in a regular pattern
    on a metallic surface, quite attractive really.

    Rather than use pound variables I used registers because registers are assigned names and therefore easier to use.....for example
    'Step_Over ' verses #105. I had a Lua panel that accepted the various numeric constants necessary to generate the required pattern,
    the start and end locations etc, and thereafter the script generated Gcode commands.

    Lua scripts have all the usual conditional constructs like Do While, and all the regular functions of a programming language, very much
    more comprehensive than Fanuc MacroB.

    You could call it a 'canned cycle'. All very interesting but I'm dubious that it is a good teaching strategy, its more about Lua, Mach4's internal structure
    and its API, as I say all very interesting but only peripherally related to Gcode.

    Craig

  2. #22
    Join Date
    Jun 2015
    Posts
    4131

    Re: Using Variables

    hy joe, indeed, like you said, using 'Step_Over ' instead of #105, improves a lot the code readability, making it easier to understand by others, or even by the one that developed it ( especially if he wishes to upgrade the code one year later after the moment of the initial release ) ... in most cases, is easier to re-write a macro, than trying to understand the "mess" created by someone else, who is nowehere to be found

    on okuma cnc's:
    ... to achieve code readability, i use :
    ...... variables writen with 4 alpha-numerics ( TOOL, DIA, STEP, DONE )
    ...... procedure names writen with 16
    alpha-numerics ( CALL OROUGHING, CALL OMEASURING, etc )
    ...... code identation
    ...... comments, foot notes
    ...... each soubroutine has input variables, and internal variables; i always group the input variables at the beging of the program
    ... to protect the code from being accidently altered, i may :
    ...... keep the file at a specific path ( <> path where the current program is stored ), and disabling it's content from being edited/seen during program execution
    ...... create an one-way mirror on the machine, thus always having the code compared with another one, in a location that can not be accesed by the operator
    ... to debug the code :
    ...... i may use a table that shows the values of all variables that i use
    ...... i may record the variables to a file, then inspect that file in excel, or wherever else
    ...... i may inspect the toolpath inside different animation modes / angles, etc
    ... to speed up machine operating :
    ...... i may use certain codes, that does not allow the program to be stopped in step-by-step mode, inside a macro
    ...... i may use internal timers, to optimize the code execution time, looking for minimal downtime, and consistent execution time, up to a time unit of 1ms ( or even less )
    ..... i may use the macro to generate simple g-code, then have the machine to auto-select & execute that file
    * and many many other tricks

    all these is done inside the g-code file (except the mirror), thus the control itself is very capable ( for example, i can generate a fanuc/siemens/heidenhain macro, from the okuma g-code, if i really wish, using file associated instructions; i can generate the code shared by old-phart, thus being sure that it works, before writing it to the file )

    i am, however, trying to boost all these even more, but i don't know exactly what should i do; i have joined this conversation, because i believed that old_phart was looking for a way to create a custom "logic" inside a cam, thus i was looking for alternative programing methods; also, seing how others are doing it, it helps a lot / kindly

    ps : i received some nice stuff when i googled "pearling"
    Ladyhawke - My Delirium, https://www.youtube.com/watch?v=X_bFO1SNRZg

  3. #23
    Join Date
    May 2005
    Posts
    1662

    Re: Using Variables

    deadlykitten
    Even In one shop there may be machines speaking different dialects or even conversational (like Mazatrol if that's still a thing). The boss says "that machine is busy, run thet part over here". If the part exists in CAM just do whatever tweaks needed and run a different post processor ? If you can build a better solution go for it. Even if I had the skills to help I have no need for this. Earlier I used the term 'professional' incorrectly but you are a skilled in this trade well beyond a level I ever reached.
    Like Old_Phart I wanted a quick way to to simple things and linuxcnc had nothing like the Mach Wizards so I learned a bit of python. Those skills are very rusty and python3 isn't backwards compatible so like a bad bodyman I just slapped on more putty until it quit throwing errors.

    Craig
    We use pc's so python is always an option though it would be a bit clunky since Mach developers see no demand for it and probably for good reasons. In linux os environment python is a natural choice.
    What you described earlier reminds of guilloche but maybe it's something else.
    Guilloche
    Anyone who says "It only goes together one way" has no imagination.

  4. #24
    Join Date
    Jun 2015
    Posts
    4131

    Re: Using Variables

    hy cycle, i believe that even if we are using different softwares, etc, in the end, all the parts are linked togheter in a pretty similar way

    If the part exists in CAM just do whatever tweaks needed and run a different post processor ? If you can build a better solution go for it.
    i don't believe that i will find a better solution; i am looking to speed up some existing steps, but at this moment i don't have a real solution / kindly
    Ladyhawke - My Delirium, https://www.youtube.com/watch?v=X_bFO1SNRZg

Page 2 of 2 12

Similar Threads

  1. G68.2 variables
    By Blunder in forum Fanuc
    Replies: 0
    Last Post: 12-10-2012, 11:52 PM
  2. New to variables need help with this one.
    By avirostick in forum G-Code Programing
    Replies: 4
    Last Post: 09-23-2012, 12:07 AM
  3. Assigning Variables
    By itstom in forum Fanuc
    Replies: 13
    Last Post: 02-24-2012, 10:52 PM
  4. Variables
    By kz1000 in forum Mach Wizards, Macros, & Addons
    Replies: 1
    Last Post: 12-18-2009, 12:04 AM
  5. Variables 500 to 531
    By viorel26 in forum Fanuc
    Replies: 0
    Last Post: 09-30-2007, 08:30 AM

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
  •