585,719 active members*
4,017 visitors online*
Register for free
Login
Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2022
    Posts
    107

    Scripting understanding problem

    I am a bit confused about different type of scripts... Maybe someone can push me in the right direction.

    As I understand it until now, there are the following type of scripts:

    Type 1
    For examle "Machine.Home.gcode" which are used by Buttons in the toolbar or the handwheel.
    They could not be called by Gcode ??

    Type 2
    Scripts like "M123.gcode"
    Can be used in gcode like "M123 P1 Q2" where P and Q are #<pvalue> and #<qvalue> in the M123.gcode file..

    Type 3
    Scripts like "subprogram.sub" which contains a o<subprogram>
    Can be used in gcode with "o<subprogram> call"
    What's about Parameters ???

    Type 4
    Expressions like expr.txt

    So for my understanding I can not call Machine.Home.gcode from within my gcode.
    So if I like to do a calibration of the position, I need to copy all content from Machine.Home.gcode to a new script. I tried M200.gcode... but loading this fails because it can not find the subroutine within the script file itself...
    So it has to be in a Type3 script??

    Hmm... It is a bit confusing....


    So how does this all work together and what makes sense?

    Which kind of script can be called from which other type and how?
    And why does Machine.Home.gcode work but the same content in M200.gcode does not?

    Should i prefer Mxxx.gcode files or better subprogram.sub to use in gcode... does this make any difference?

    how to pass parameters to the subprogram.sub from gcode?

    Sorry for that many questions but I am realy confused why there are so many differences and why for example tool measuring during M6 does not use Machine.Tool_Offset.Measure_Length.gcode but its own implementation.

  2. #2
    Join Date
    Mar 2017
    Posts
    1304

    Re: Scripting understanding problem

    Type1, 2 and 3 are all g-code.
    "Machine.Home.gcode" is is used internally by software. It is not meant to be called from other g-codes.

    For this you have other options:
    - custom M codes - uses M???.gcode file
    - .sub files - uses "sub/endsub" syntax and are called with "call"
    - .gcode - uses M99 syntax and are called with "exec"
    - O???.gcode - uses M99 syntax and is called with G65

    Basically it is all the same. It is up to user what he prefers and what is compatible with his other stuff.

    Internal subprocedures (such as o<probehome> sub from Machine.Home.gcode) can only be used of top level. That is why you can not call it from M script.

  3. #3
    Join Date
    Jan 2022
    Posts
    107

    Re: Scripting understanding problem

    Thank you very much. That explains a lot.

    While creating own toolbar buttons, I noticed that of course gcode could not be executed while the programm is running, but maybe there are some functions which could be used while a programm is running?
    Interresting would be switching output on/off (like the Mist and Flood Buttons do and change global parameters.

  4. #4
    Join Date
    Mar 2017
    Posts
    1304

    Re: Scripting understanding problem

    You can execute all expression commands (except those that run g-code obviously.

Similar Threads

  1. Scripting help
    By yar20 in forum PlanetCNC
    Replies: 18
    Last Post: 11-18-2019, 02:34 AM
  2. npt thread understanding problem
    By fsa in forum MetalWork Discussion
    Replies: 2
    Last Post: 10-10-2017, 07:49 AM
  3. Replies: 7
    Last Post: 12-20-2014, 12:17 AM
  4. GD&T understanding problem
    By fsa in forum Mechanical Calculations/Engineering Design
    Replies: 4
    Last Post: 04-23-2008, 10:57 PM
  5. Scripting
    By Klox in forum BobCad-Cam
    Replies: 29
    Last Post: 10-03-2003, 04:11 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
  •