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

    Object reference in variable

    Scheduled Pinned Locked Moved
    Gcode meta commands
    2
    2
    142
    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.
    • Mogatekundefined
      Mogatek
      last edited by Mogatek

      Hi All,

      I am not sure whether this has been asked or not, but I couldn't seem to find anything nor could I manage to make it work. I wanted to pre-"extract" the part of the object model, namely a heater and an extruder associated with a given tool, to later do some queries on it with less clutter.

      var tool = 0
      ;--- FIXME! - these assume one heater and one extruder per tool
      var toolExtruder = move.extruders[tools[var.tool].extruders[0]]
      var toolHeater = heat.heaters[tools[var.tool].heaters[0]]
      
      ;--- These are not working:
      echo var.toolHeater.current
      echo var.toolExtruder.position
      

      If I enter global toolExtruder = move.extruders[tools[0].extruders[0]] in the console, then I enter echo global.toolExtruder then it shows that this is an {object}. So I assume that the variable assignment has worked. I feel that it should work somehow, but I failed to figure out how to reference its members. Tried with using all kinds of parenthesis, without any luck.

      Is this possible with some syntax?

      dc42undefined 1 Reply Last reply Reply Quote 0
      • dc42undefined
        dc42 administrators @Mogatek
        last edited by

        @Mogatek I confirm that this is not possible at present. Please raise an issue at https://github.com/Duet3D/RepRapFirmware/issues.

        Duet WiFi hardware designer and firmware engineer
        Please do not ask me for Duet support via PM or email, use the forum
        http://www.escher3d.com, https://miscsolutions.wordpress.com

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