en:software:mdurosettacncsoftwaregcode:messages_media

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

  • P the text to be displayed for M109 and the path to the image to be displayed using M120.
  • Q the optional window type to be used to display the message or the media. The following types are available:
    • 0: modal window with a Resume button.
    • 1: modal window with a Stop button.
    • 2: modal window with a Stop and Resume button.
    • 3: modal window where the user can insert a value that will be stored in parameter #5721.
    • 4: message will be displayed in the HUD.
    • >=100: a message that requires a custom window
  • R the optional number of arguments that should be set by the user. The default is 1 when Q is set to 4. The values inserted by the user is stored in parameters #5730 to #5739.
  • D the optional default value to be used when Q is set to 3. The specified is used to generate the initial preview.

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

  • Only with M109 Q4 (HUD message) you have to use an empty string to remove previous showed message: M109 P“” Q4
  • It is possible to show the current value of a parameter within a message, to do that just add to the message text #<parameter_number> where parameter_number is the number of the parameter you want to display.
    Example: M109 P“The current value of the parameter 5001 is #5001” Q0
  • The images to be show using M120 should be placed in the folder <%appdata%/RosettaCNC-1/machines/RosettaCNC/media>
  • The text messages with q0÷3 can accept a mini-html subset of tags.

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

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

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

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

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

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

<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

<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

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

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

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

    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.

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

    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)
    User message of type 4 (HUD on preview)
    ; (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
    • Last modified: 2023/03/22 09:07
    • by 127.0.0.1