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

    Read Variables in DWC?

    Scheduled Pinned Locked Moved Solved
    Duet Web Control
    2
    4
    231
    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.
    • oozeBotundefined
      oozeBot
      last edited by

      I'm curious if anyone has figured out how to read the new global variables directly into DWC's source code?

      chrishammundefined 1 Reply Last reply Reply Quote 0
      • chrishammundefined
        chrishamm administrators @oozeBot
        last edited by

        @oozebot Global variables are part of the object model so you can map them from the machine/model state as well. Something like this should work in DWC:

        <template>
        ...
        {{ myVar }}
        ...
        </template>
        <script>
        ...
          computed: mapState('machine/model', { myVar: state => state.global.myVar }),
        ...
        </script>
        

        Duet software engineer

        oozeBotundefined 1 Reply Last reply Reply Quote 0
        • oozeBotundefined
          oozeBot @chrishamm
          last edited by oozeBot

          @chrishamm thanks! I literally just figured it out, but the way I did it is slightly different.. same results so I guess there is no issue with this?

          myVar: state => state.machine.model.global.myVar,
          
          chrishammundefined 1 Reply Last reply Reply Quote 0
          • chrishammundefined
            chrishamm administrators @oozeBot
            last edited by

            @oozebot Yes, I think that mapping should work as well.

            Duet software engineer

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