Indice

10. Messages & Media

The user can edit the G-code to specify a message or a media to be displayed using the following syntax.

M109 P“text message to be displayed” Q1

M120 P“image.png” Q1

10.1 Parameters meaning

A special case of M109 is M109 p“user error message” Q-1 used to stop compilation reporting a custom error message placed between double quotes.

When no message is present after M109 (Eg: M109 Q-1) the default text [E0345] in line x - generic user error with m109 q-1 will be showed.

To set the default values when multiple inputs should be set by the user call G10 L100 P<parameter> V<value> before calling M109 or M120.

Example
; Set default value for parameter 5731.
G10 L100 P5731 V987
; Ask the user to insert 5 values.
M109 Q100 P"Enter 5 numbers" R5
; Print values inserted by the user.
M109 P"User wrote: 5730 #5730, 5731 #5731, 5732 #5732 , 5733 #5733, 5734 #5734"

Notes

10.2 Supported HTML syntax

In the text field of a message the HTML syntax can be used.

Bold tag

<B> : start bold text
</B> : end bold text
Example: This is a <B>test</B> → This is a test

Underline tag

<U> : start underlined text
</U> : end underlined text
Example: This is a <U>test</U> → This is a test

Italic tag

<I> : start italic text
</I> : end italic text
Example: This is a <I>test</I> → This is a test

Strikeout tag

<S> : start strike-through text
</S> : end strike-through text
Example: This is a <S>test</S> → This is a test

Line break

<BR> : inserts a line break
Example: This is a <BR> test
This is a
test

Subscript/Superscript tags

<SUB> : start subscript text
</SUB> : end subscript text
<SUP> : start superscript text
</SUP> : end superscript text
Example : This is<SUP>9</SUP>/<SUB>16</SUB> → This is 9/16

List tags & List items

<UL> : start un ordered list tag
</UL> : end un ordered list
<LI [type=“specifier”] [color=“color”]> : new list item
specifier can be “square” or “circle” bullet
specifier “color” sets the color of the square or circle bullet

Example:

  <LI>List item 1
  <LI>List item 2
  <UL> 
  <LI> Sub list item A
  <LI> Sub list item B
  </UL>
  <LI>List item 3
  </UL>

becomes:

  • List item 1
  • List item 2
    • Sub list item A
    • Sub list item B
  • List item 3

  • Text with shadow

    <SHAD> : start text with shadow
    </SHAD> : end text with shadow

    Highlight

    <HI> : start text highlighting
    </HI> : stop text highlighting

    Error marking

    <E> : start error marker
    </E> : stop error marker

    10.3 Supported Not Standard HTML Tags

    In the text field of a message a set of non HTML standard tags can be used.
    The non HTML standard tags have a @ as prefix.

    Tool Info

    <@TI=tool_id> : Insert info of tool defined in tool_id
    <@TD=tool_id> : Insert description of tool defined in tool_id

    10.4 Examples

    User message of type 0 (full screen view)
    User message of type 0 (window)
    User message of type 1 (window)
    User message of type 2 (window)

    HUD messages

    User message of type 4 (HUD on preview)

    Use piece thickness to update WCS offsets

    ; (c) 2016-2019 by RosettaCNC Motion
    G54 G49 F1000
    G10 L2 P1 X0 Y0 Z0   ; Set G54 WCS offsets
    G10 L2 P2 X0 Y0 Z-20 ; Set G55 WCS offsets
    G10 L2 P3 X0 Y0 Z-30 ; Set G56 WCS offsets
    ; Set initial position.
    G0 X0 Y0 Z0
     
    G65 P1000
    M2
     
    ; Prompt the user to insert piece thickness and update the WCS.
    ; The code could me move to a dedicated file.
    O1000
      M109 P"Set piece thickness" Q3 D0.0
      G10 L2 P1 Z[#5223 + #5721] ; Update G54 WCS offsets
      G10 L2 P2 Z[#5243 + #5721] ; Update G55 WCS offsets
      G10 L2 P3 Z[#5263 + #5721] ; Update G56 WCS offsets
    M99