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

    Conditional G Code - RJ TextEd Syntax file.

    Scheduled Pinned Locked Moved
    General Discussion
    4
    17
    933
    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.
    • dc42undefined
      dc42 administrators
      last edited by dc42

      Yes, move.extruders is an array, as in this example (generated using the RRF 3.01beta 2 that I released yesterday):

      {"key":"","flags":"99","result":{"boards":[{"firmwareFileName":"Duet2CombinedFirmware.bin","firmwareVersion":"3.01-beta2","iapFileNameSD":"Duet2CombinedIAP.bin","mcuTemp":{"current":14.1,"max":14.4,"min":9.2},"name":"Duet 2 WiFi","shortName":"2WiFi","vIn":{"current":24.5,"max":24.7,"min":24.4}}],"fans":[{"actualValue":0,"blip":0.10,"max":1.00,"min":0.10,"name":"","requestedValue":0,"rpm":-1,"thermostatic":{"control":false}},{"actualValue":0,"blip":0.10,"max":1.00,"min":0.10,"name":"","requestedValue":1.00,"rpm":-1,"thermostatic":{"control":true,"heaters":[1],"highTemperature":45.0,"lowTemperature":45.0}},{"actualValue":0,"blip":0.10,"max":1.00,"min":0.30,"name":"","requestedValue":1.00,"rpm":-1,"thermostatic":{"control":true,"heaters":[10,11],"highTemperature":55.0,"lowTemperature":45.0}}],"heat":{"coldExtrudeTemperature":160.0,"coldRetractTemperature":90.0,"heaters":[{"current":20.1,"max":125.0,"min":-273.1,"sensor":0,"state":"off"},{"current":20.5,"max":290.0,"min":-273.1,"sensor":1,"state":"off"}],"sensors":[{"lastReading":20.1,"name":"","type":"Thermistor"},{"lastReading":20.5,"name":"","type":"PT100 (MAX31865)"},null,null,null,null,null,null,null,null,{"lastReading":14.1,"name":"Mcu","type":"Microcontroller embedded temperature sensor"},{"lastReading":0,"name":"Drivers","type":"Stepper driver temperature warnings"}]},"job":{"file":{"filament":[],"firstLayerHeight":0,"height":0,"layerHeight":0,"numLayers":0,"size":0},"layer":0,"timesLeft":null},"move":{"axes":[{"acceleration":3000.0,"drivers":["0"],"homed":false,"jerk":600.0,"letter":"X","machinePosition":0,"max":150.0,"min":-150.0,"speed":15000.0,"userPosition":0,"visible":true,"workplaceOffsets":[0,0,0,0,0,0,0,0,0]},{"acceleration":3000.0,"drivers":["1"],"homed":false,"jerk":600.0,"letter":"Y","machinePosition":0,"max":150.0,"min":-150.0,"speed":15000.0,"userPosition":0,"visible":true,"workplaceOffsets":[0,0,0,0,0,0,0,0,0]},{"acceleration":3000.0,"drivers":["2"],"homed":false,"jerk":600.0,"letter":"Z","machinePosition":470.070,"max":470.1,"min":0,"speed":15000.0,"userPosition":470.070,"visible":true,"workplaceOffsets":[0,0,0,0,0,0,0,0,0]}],"calibrationDeviation":{"deviation":0,"mean":0},"currentMove":{"acceleration":0,"deceleration":0,"requestedSpeed":0,"topSpeed":0},"daa":{"enabled":false,"minimumAcceleration":10.0,"period":0.0},"extruders":[{"driver":"3","factor":100.0,"nonlinear":{"a":0.015,"b":0.001,"upperLimit":0.20},"pressureAdvance":0.20},{"driver":"4","factor":100.0,"nonlinear":{"a":0,"b":0,"upperLimit":0.20},"pressureAdvance":0}],"idle":{"factor":0.3,"timeout":30.0},"initialDeviation":{"deviation":0,"mean":0},"kinematics":{"deltaRadius":180.679,"homedHeight":470.070,"name":"Linear delta","printRadius":150.0,"towers":[null,null,null],"xTilt":0.001,"yTilt":-0.001},"meshDeviation":{"deviation":0,"mean":0},"printingAcceleration":10000.0,"speedFactor":100.0,"travelAcceleration":10000.0,"workspaceNumber":1},"network":{"interfaces":[{"actualIP":"192.168.1.126","gateway":"0.0.0.0","subnet":"0.255.255.255","type":"wifi"}]},"sensors":{"endstops":[{"triggered":false,"type":"inputPin"},{"triggered":false,"type":"inputPin"},{"triggered":false,"type":"inputPin"}],"probes":[{"calibrationTemperature":25.0,"disablesHeaters":false,"diveHeight":6.0,"maxProbeCount":5,"offsets":[0,0],"recoveryTime":0.2,"speed":16.7,"temperatureCoefficient":0,"threshold":100,"tolerance":0.020,"travelSpeed":200.0,"triggerHeight":-0.100,"type":8,"value":[0]}]},"state":{"currentTool":-1,"machineMode":"FFF","status":"Idle","upTime":47},"tools":[{"active":[0],"axes":[[0],[1]],"extruders":[0],"fans":[0],"heaters":[1],"mix":[1.00],"name":"","offsets":[0,0,0],"standby":[0],"state":"off"},{"active":[0],"axes":[[0],[1]],"extruders":[1],"fans":[0],"heaters":[2],"mix":[1.00],"name":"","offsets":[0,0,0],"standby":[0],"state":"off"}]}}
      

      You can also see the individual members of each extruder in this example.

      'mix' is an array. Its length will be the number of extruders in the M563 definition of the tool.

      In conditional GCode you can index any array. Currently, if you use an array then you must index it or use the # operator to take its length, because conditional GCode doesn't yet support doing anything else to array values.

      HTH David

      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
      • OwenDundefined
        OwenD
        last edited by OwenD

        I had to put this on hold a little as I discovered a bug in RJ Texted which was causing autocomplete to fail where an array was involved.
        e.g. move.axes would work, but would stop working when you got to move.axes[0].

        The author has responded with a fix in the latest beta available here
        https://www.rj-texted.se/Forum/viewtopic.php?f=10&t=4807

        I'm pretty sure I have most/all of the object model documented in the language files here.
        https://www.dropbox.com/s/75re836p55tvmk3/reprap.zip?dl=0

        They need to be placed in the correct folder, usually
        C:\Users*your user name* \AppData\Roaming\RJ TextEd\Syntax\User defined

        You then need to activate them in RJ Texted.
        Go to ENVIRONMENT > ADDONS - then select HIGHLIGHTERS on the left.
        Scroll down the list and check "Reprap"
        selection.jpg

        You can then create a new file and select "reprap" as the syntax format.
        Or you can open a file and reformat.

        You also need to activate html link following if you want to be able to use the links to the dozuki added after G or M codes when they are added from the dropdown or auto completion list.
        URL.jpg

        You can also have it auto complete braces [ ] { } etc so that when you type the leading brace, it adds the trailing brace automatically.

        braces.jpg

        Once the object model is stable we can submit the syntax file for inclusion in the standard distribution.
        Until then we can work on it among ourselves to improve it.
        I could probably do an installation setup that automatically put the files in the right spot and adjusted all the settings, but again until the model is stable (and there's an indication this is being used) it will have to be manually done.

        An example

        screenshot.jpg

        1 Reply Last reply Reply Quote 0
        • Danalundefined
          Danal
          last edited by

          Curious: Is anyone working a syntax highlight definition for either Sublime or Atom?

          Delta / Kossel printer fanatic

          OwenDundefined 1 Reply Last reply Reply Quote 0
          • OwenDundefined
            OwenD @Danal
            last edited by

            @Danal
            I looked into doing one for notepad ++ but found their method of creating syntax highlighting files quite clunky so I gave up.
            I do have atom, but haven’t looked into it.
            If it’s easy to carry over what I’ve already done in RJ TextEd I’ll have a look, otherwise you’re on your own 😉

            Danalundefined 1 Reply Last reply Reply Quote 0
            • Danalundefined
              Danal @OwenD
              last edited by

              @OwenD said in Conditional G Code - RJ TextEd Syntax file.:

              otherwise you’re on your own

              That's really where I was going... I wanted to be sure there wasn't something underway. Personally, I'd lean much more toward Sublime (even though I asked about both).

              Of course, editors are a very personal choice...

              Thanks!

              Delta / Kossel printer fanatic

              OwenDundefined 1 Reply Last reply Reply Quote 1
              • OwenDundefined
                OwenD @Danal
                last edited by

                @Danal
                Both Atom and Sublime have syntax for matters for GCode available.
                Perhaps you can use these as the basis and add autocomplete etc.

                https://packagecontrol.io/packages/G-code Syntax Highlighting

                https://atom.io/packages/language-gcode-fff

                I’m afraid some life stuff has just come up that will prevent me putting any more time into this for a while.

                1 Reply Last reply Reply Quote 1
                • kateundefined
                  kate @dc42
                  last edited by

                  @dc42 The returned JSON is too long, you can beautify it at JSON Formatter

                  1 Reply Last reply Reply Quote 0
                  • OwenDundefined
                    OwenD
                    last edited by

                    For those using RJ Text Editor, I have posted an updated syntax file that includes the new object model items and G Codes contained in RRF3.5.0 b2

                    It can be downloaded here
                    https://www.rj-texted.se/Forum/viewtopic.php?p=18659#p18659

                    It includes mouse over hints for G Code commands and auto-complete
                    The program comes with the RRF syntax file as standard but you may need to update it as new firmware versions come out.

                    syntax-editor.gif

                    OwenDundefined 1 Reply Last reply Reply Quote 4
                    • OwenDundefined
                      OwenD @OwenD
                      last edited by

                      I've just added hints to all the object model items.
                      This means that as you type and use the code completion function, a hint will appear showing what each individual object model item does.

                      I will upload to the RJ TextEd forum when 3.5 becomes stable so that I can include any other changes.
                      In the mean time you can grab the files from github
                      https://github.com/owendare/RJTexted-ReprapFirmware-Syntax

                      hints.gif.gif

                      OwenDundefined 1 Reply Last reply Reply Quote 3
                      • OwenDundefined OwenD referenced this topic
                      • OwenDundefined
                        OwenD @OwenD
                        last edited by

                        Adding this in response to a question about debugging conditional code and text editors.

                        Another feature of RJ TextEd that will help debug your code is matching brace highlighting.
                        By clicking next to a brace ( { [ , the matching brace is highlighted.
                        If there is no matching brace, it is highlighted a different color to show the error
                        BraceHighlight.gif

                        1 Reply Last reply Reply Quote 1
                        • OwenDundefined
                          OwenD
                          last edited by OwenD

                          I have just uploaded a new version of the syntax files to take include new RRF features and object model items in RRF V3.6.0b4
                          I have also changed the file so that hints are displayed when viewing auto complete options.

                          The files can be downloaded here
                          https://github.com/owendare/RJTexted-ReprapFirmware-Syntax

                          The syntax files should be placed her
                          C:\Users\YOUR USER NAME\AppData\Roaming\RJ TextEd\Syntax\User defined

                          The colour theme file should be laced here
                          C:\Users\YOUR USER NAME\AppData\Roaming\RJ TextEd\Syntax color themes

                          EDIT:
                          Upload of new GIF's fails so deleted from post

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