Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Outputting a string with an object model variable to a log file

    Scheduled Pinned Locked Moved
    Gcode meta commands
    1
    2
    168
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Garth_42undefined
      Garth_42
      last edited by

      Hello,

      I am wanting to output a message to a log file (M118) or to the user (M117) that has a string and then data from the object model in one command. Normally I would concatenate a string with a typecasted variable but I am having issues doing this.

      I tried this: echo "Hello World", move.axes[2].userPosition
      and it had the desired behavior.

      When I try: M118 S{"Hello World", move.axes[2].userPosition} L1
      it throws an error.

      When I try: M117 "Hello World", move.axes[2].userPosition
      it throws an error, too.

      Here is a screenshot of the console:
      d1d42255-b4ea-4e0b-9a7f-f15db77d177a-image.png
      Could someone tell me what is wrong with my syntax? Much appreciated.

      Garth_42undefined 1 Reply Last reply Reply Quote 0
      • Garth_42undefined
        Garth_42 @Garth_42
        last edited by

        @garth_42
        Hi all, I posted justa bit too quickly. I figured out the syntax. For anyone in the future, this is the syntax I used:
        M117 {"Z-Axis Position: " ^ move.axes[2].userPosition ^ " "}

        bda88bb5-4feb-4265-8800-74aeb91a185f-image.png

        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        Unless otherwise noted, all forum content is licensed under CC-BY-SA