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

    Repository for CNC Config's and Macro's

    Scheduled Pinned Locked Moved
    CNC
    9
    22
    5.0k
    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.
    • Arcnsparksundefined
      Arcnsparks
      last edited by Arcnsparks

      Sure, that sounds good. If anything gets posted here, I'll can start adding there. Would it be possible to have a dedicated CNC folder?

      Phaedruxundefined 1 Reply Last reply Reply Quote 0
      • Phaedruxundefined
        Phaedrux Moderator @Arcnsparks
        last edited by

        @Arcnsparks said in Repository for CNC Config's and Macro's:

        Would it be possible to have a dedicated CNC folder in the root to fork from?

        Sure, I can add one.

        Z-Bot CoreXY Build | Thingiverse Profile

        1 Reply Last reply Reply Quote 0
        • dbruce.ae05undefined
          dbruce.ae05 @Arcnsparks
          last edited by

          @Arcnsparks Do you have a macro for zeroing both y-axes to zero out racking each time you home the machine?

          Arcnsparksundefined 1 Reply Last reply Reply Quote 0
          • Arcnsparksundefined
            Arcnsparks @dbruce.ae05
            last edited by Arcnsparks

            @dbruce-ae05 I don't use a specific Macro for that I just have my homey.g file setup as shown below and then use the home buttons in the DWC.

            ; homey.g
            ; called to home the Y axis
            ;
            G91               		 ; relative positioning
            
            ; split Y motor control to Y and U
            ; for it to work we have to show U (param P4) in the UI
            M584 Y0.2 U0.1 P4
            
            G1 H1 Z5 F6000   		     ; lift Z relative to current position
            G1 H1 Y-1005 U-1005 F1800            ; move quickly to Y axis endstop and stop there (first pass)
            G1 H2 Y5 U5 F6000    	             ; go back a few mm
            G1 H1 Y-1005 U-1005 F360 	     ; move slowly to Y axis endstop once more (second pass)
            G1 H1 Z-5 F6000                      ; lower Z again
            
            M584 Y0.2:0.1 P3			 ; back to combined axes and hidden U
            G90               			 ; absolute positioning
            
            dbruce.ae05undefined 1 Reply Last reply Reply Quote 0
            • dbruce.ae05undefined
              dbruce.ae05 @Arcnsparks
              last edited by

              @Arcnsparks I tried to implement this, but I'm not having any luck. I split the axes (x axis in my case) to X & U, and try to home. But the X0 motor doesn't stop when the end stop is hit. No matter which end stop is hit first, X1 keeps going, and X0 stops. Any ideas?

              Configuration files below:
              config.g
              homex.g

              Yveskeundefined 1 Reply Last reply Reply Quote 0
              • Yveskeundefined
                Yveske @dbruce.ae05
                last edited by

                @dbruce-ae05
                No need for splitting and recombining (Duet3 6HC firmware 3.2), just assign 2 motors to Y and check 2 endstops

                ;DUAL Y
                M584 X0.0 Y0.1:0.2 Z0.3
                
                ; Drives
                M569 P0.0 S0                                ; physical drive 0.0 direction (0 = backwards, 1 = forwards (default 1))
                M569 P0.1 S0                                ; physical drive 0.1 direction (0 = backwards, 1 = forwards (default 1))
                M569 P0.2 S0                                ; physical drive 0.2 direction (0 = backwards, 1 = forwards (default 1))
                M569 P0.3 S1                                ; physical drive 0.3 direction (0 = backwards, 1 = forwards (default 1))
                
                 ; Endstops
                M574 X1 S1 P"!io0.in"                       ; configure active-high endstop for low  end on X via pin io0.in
                M574 Y1 S1 P"!io1.in+!io2.in"               ; configure active-high endstop for low  end on Y via pin io1.in
                M574 Z2 S1 P"!io3.in"                       ; configure active-high endstop for high end on Z via pin io3.in
                
                1 Reply Last reply Reply Quote 1
                • o_lampeundefined
                  o_lampe
                  last edited by

                  It would be interesting to have a setup, where the printer pauses when one Y-motor starts skipping steps.(not during homing)
                  I ruined my DIY shapeoko CNC, because the motors didn't stop, DWC only spitting out tons of warnings. (just great!)

                  1 Reply Last reply Reply Quote 1
                  • chimaeraghundefined
                    chimaeragh
                    last edited by chimaeragh

                    Here is my config for the Ooznest 1000x1500 Workbee CNC.
                    This version has normally closed limit switches (these have the LEDs light up on the Duet2 board when not closed).

                    • Reprap firmware version 3.2.2.

                    • Duet2 Wifi

                    Everything works including emergency stop which is configured in the customconfig.g file.

                    ; Configuration file for Duet WiFi (firmware version 3)
                    ; executed by the firmware on start-up
                    ;
                    ; generated by RepRapFirmware Configuration Tool v3.2.2 on Sat Jan 23 2021 03:57:18 GMT+0000 (Greenwich Mean Time)
                    
                    ; General preferences
                    M453                            ; CNC Mode 
                    M550 P"Workbee CNC"           ; set printer name
                    G90                             ; send absolute coordinates...
                    ;M83                             ; ...but relative extruder moves
                    
                    
                    ; Network
                    M552 S2                         ; enable Adhoc network
                    M586 P0 S1                      ; enable HTTP
                    M586 P1 S0                      ; disable FTP
                    M586 P2 S0                      ; disable Telnet
                    
                    ; Drives
                    M569 P0 S0                      ; physical drive 0 goes forwards
                    M569 P1 S1                      ; physical drive 1 goes forwards
                    M569 P2 S0                      ; physical drive 2 goes forwards
                    M569 P3 S1                      ; physical drive 3 goes forwards
                    
                    M584 X0 Y1:3 Z2                 ; set drive mapping
                    
                    M350 X16 Y16 Z16 I1             ; configure microstepping with interpolation
                    M92 X400.00 Y400.00 Z400.00     ; set steps per mm
                    M566 X500.00 Y500.00 Z500.00    ; set maximum instantaneous speed changes (mm/min)
                    M203 X2500.00 Y2500.00 Z2500.00 ; set maximum speeds (mm/min)
                    M201 X150.00 Y150.00 Z150.00    ; set accelerations (mm/s^2)
                    M906 X2400 Y2400 Z2400 I100     ; set motor currents (mA)
                    
                    ; Axis Limits
                    M208 X0 Y0 Z0 S1                ; set axis minima
                    M208 X800 Y1270 Z94 S0          ; set axis maxima
                    
                    ; Endstops
                    M574 X1 S1 P"!xstop"             ; configure active-low endstop for low end on X via pin xstop
                    M574 Y1 S1 P"!ystop"             ; configure active-low endstop for low end on Y via pin ystop
                    M574 Z1 S1 P"!zstop"             ; configure active-low endstop for low end on Z via pin zstop
                    
                    ; Z-Probe
                    M558 P0 H5 F120 T6000           ; disable Z probe but set dive height, probe speed and travel speed
                    
                    ; Heaters
                    M140 H-1                        ; disable heated bed (overrides default heater mapping)
                    
                    ; Tools
                    ;M563 P0 D0 F0                   ; define tool 0
                    ;G10 P0 X0 Y0 Z0                 ; set tool 0 axis offsets
                    ;G10 P0 R0 S0                    ; set initial tool 0 active and standby temperatures to 0C
                    
                    ; Miscellaneous
                    M140 H-1                        ; Disable heated bed
                    M564 S1 H1                      ; Disable jog commands when not homed
                    M911 S21 R24 P"G91 G1 Z3 F1000" ; set voltage thresholds and actions to run on power loss
                    M501                            ; load saved parameters from non-volatile memory
                    M98 P"customconfig.g"             ; Execute custom config settings
                    
                    
                    

                    And customconfig.g for emergency stop

                    ; ADD ANY CUSTOM SETTINGS BELOW
                    
                    ;M564 S1 H0 ; Enable jog commands when not homed
                    
                    
                    M950 J1 C"e1stop" ; Assign Pin1 to e1stop
                    M581 P1 T0 S1 R0  ; Enable Emergency Stop Normally Closed
                    M582 T0
                    

                    Duet 2 Wifi, Ooznest Workbee CNC 1510

                    o_lampeundefined 1 Reply Last reply Reply Quote 0
                    • o_lampeundefined
                      o_lampe @chimaeragh
                      last edited by o_lampe

                      @chimaeragh said in Repository for CNC Config's and Macro's:

                      M98 Pcustomconfig.g

                      Try M98 P"customconfig.g"
                      AFAIK there have to be "" around the filename...

                      //edit It depends on your FW:

                      1 In RRF_2.x and earlier, string can be enclosed in quotes if required, see Quoted Strings for details. In RRF_3, quotation marks around the filename are mandatory.
                      
                      chimaeraghundefined 1 Reply Last reply Reply Quote 1
                      • chimaeraghundefined
                        chimaeragh @o_lampe
                        last edited by

                        @o_lampe Thanks

                        Duet 2 Wifi, Ooznest Workbee CNC 1510

                        1 Reply Last reply Reply Quote 0
                        • theKMundefined
                          theKM
                          last edited by

                          anyone have a CNC running on RRF3.3?... would be handy to see a recent config uploaded as people get their machines upgraded over time.

                          cjmundefined 1 Reply Last reply Reply Quote 0
                          • cjmundefined
                            cjm @theKM
                            last edited by cjm

                            @thekm Here you go….

                            
                            ; Configuration file for Duet WiFi (firmware version 3.3)
                            ; executed by the firmware on start-up
                            
                            ; General preferences
                            G90                                                ; send absolute coordinates...
                            M83                                                ; ...but relative extruder moves
                            M550 P"AlphaCNC"                                   ; set printer name
                            
                            ; Network
                            ;M551                                             ; set password
                            M552 P192.168.0.9 S1                               ; enable network and set IP address
                            M553 P255.255.255.0                                ; set netmask
                            M554 P192.168.0.1                                  ; set gateway
                            M586 P0 S1                                         ; enable HTTP
                            ;M586 P1 S1                                         ; enable FTP
                            ;M586 P2 S1                                         ; enable Telnet
                            
                            ; Drives
                            M569 P0 S0                                         ; physical drive 0 goes backwards 
                            M569 P1 S0                                         ; physical drive 1 goes backwards
                            M569 P2 S0                                         ; physical drive 2 goes backwards
                            M584 X0 Y1 Z2                                      ; set drive mapping
                            M350 X256 Y256 Z256 I0                             ; configure microstepping without interpolation
                            ;M92 X6400.00 Y6400.00 Z6400.00                     ; set steps per mm (Nominal)
                            M92 X6372.34 Y6380.86 Z6376.35                     ; set steps per mm (After calibration)
                            M566 X900.00 Y900.00 Z12.00                        ; set maximum instantaneous speed changes (mm/min)
                            M203 X2400.00 Y2400.00 Z240.00                     ; set maximum speeds (mm/min)
                            M201 X200.00 Y200.00 Z20.00                        ; set accelerations (mm/s^2)
                            M906 X1200 Y1200 Z1200 I30                         ; set motor currents (mA) and motor idle factor in per cent
                            M84 S30                                            ; Set idle timeout
                            
                            ; Axis Limits
                            M208 S1 X-102 Y-85 Z-100                           ; set axis minima (S1)
                            M208 S0 X102 Y85 Z80                              ; set axis maxima (S0)
                            
                            ; Endstops
                            M574 X1 S1 P"!xstop"                               ; configure active-low endstop for low end on X via pin !xstop
                            M574 Y1 S1 P"!ystop"                               ; configure active-low endstop for low end on Y via pin !ystop
                            M574 Z2 S1 P"!zstop"                               ; configure active-low endstop for high end on Z via pin !zstop
                            
                            ; Z-Probe
                            M558 P5 C"^!e0stop" H10 F120 T1800		            ; set Z probe on e0stop, pull up, normally open, type=switch, dive speeds = 120mm/min
                            G31 P25 X0 Y0 Z19.2                                 ; set Z probe trigger value, offset and trigger height
                            ;M557 X15:205 Y15:170 S40                           ; define mesh grid
                            
                            ; Heaters
                            M140 H-1                                           ; disable heated bed (overrides default heater mapping)
                            M950 H3 C"nil"					                   ; disable heater3 (pin exp.8 on the expansion connector)  
                            M950 H4 C"nil"					                   ; disable heater4 (pin exp.13 on the expansion connector)  
                            
                            ; Fans
                            ;M950 F0 C"nil"	                                   ; disable fan 0
                            M950 F0 C"!fan0+^exp.pb6" Q1000 				   ; Fan 0 uses the Fan0 output. inverted for PWM, and PB6 as a tacho input with pullup resistor enabled for VFD speed feedback
                            M950 F1 C"nil"	                                   ; disable fan 1
                            M950 F2 C"nil"	                                   ; disable fan 2
                            
                            ; Custom settings
                            ; M591 D0 C3 P2 E6.0                               ;This is the command for filament monitoring using an optical on/off switch
                            
                            ; PanelDue
                            M575 P1 B57600 S0								   ; allow commands without checksums to be sent
                            
                            ;Scale cartesian axes
                            M579 X1.000 Y1.000
                            
                            ; CNC Mode (Firmware 3.3)
                            M453         										; CNC Mode 
                            
                            ;Configure Tool 0 as the CNC Spindle
                            M950 R0 C"exp.13+exp.8+exp.9" Q2000 L0:25400	 	; Create spindle index 0, PWM frequency 2KHz, max rpm = 25.4K ( tweaked to yield 24K) 
                            												   	; and the following connections:
                            													; 	spindle speed PWM pin	: exp.13 pin
                                                                                ;	spindle run pin 		: exp.8
                                                                                ;	spindle direction pin 	: exp.9
                            M563 P0 R0 S"Spindle"                              	; Create Tool 0 with Spindle 0 and call it Spindle 
                            G10  P0 X0 Y0 Z0                                    ; Set Tool 0 axis offsets
                            M568 P0 F0										    ; Set Tool 0 to default RPM of 0
                            T0													; Select Tool 0
                            
                            ; CNC Emergency Stop
                            M950 J0 C"exp.4"									; Define exp.4 as input pin 0 (P0) for use as an emergency stop input
                            M581 T0 P0 S1 R0									; Trigger an emergency stop (T0) when input pin 0 (P0) edge occurs
                            
                            ; Miscellaneous
                            M911 S10 R11 P"M913 X0 Y0 G91 M83 G1 Z3 E-5 F1000" ; set voltage thresholds and actions to run on power loss
                            
                            
                            theKMundefined 1 Reply Last reply Reply Quote 1
                            • theKMundefined
                              theKM @cjm
                              last edited by

                              @cjm thanks! I'm sure that more just myself will find it handy.

                              1 Reply Last reply Reply Quote 0
                              • theKMundefined
                                theKM
                                last edited by theKM

                                Edit (2021-10-08) : I re-wrote the script because the structure of the GCode wiki pages changed, and now includes downloading the content to re-create the mega-page.

                                _
                                Browsing other people's gcode is super handy, particularly for custom setups and going your own way. However, it's a genuine hassle to both read someone else's GCode while trying to bounce around the gcode dictionary docco... and the new wiki structure is great, and necessary for the maintainers, but a challenge to bounce around efficiently.

                                So here is a script that re-creates the mega-gcode docco page, and sets up a gcode browser in place of the menu.

                                • open the gcode dictionary site: https://duet3d.dozuki.com/Wiki/Gcode
                                • show the javascript console ("web developer tools" > "console")
                                  ctrl + shift + J in chrome, ctrl + shift + i in FireFox.
                                • copy and paste in the following code and hit return
                                  (someone else can feel free to code review to ensure there's no evil)...
                                // ==UserScript==
                                // @name     GCode Wiki script
                                // @version  1
                                // @include     https://duet3d.dozuki.com/Wiki/Gcode*
                                // ==/UserScript==
                                
                                /** for processing injected menu clicks, gets changed
                                 * to proper implementation when needed
                                 */
                                let processMegaPage = () => {};
                                let crossLinkDoc = () => {};
                                let setupGcodeBrowser = () => {};
                                
                                let codeMap = {};
                                let crossLinked = false;
                                
                                // for identifying gcode references
                                let codeRx = /[GM]+[0-9]+(.[0-9])?/g;
                                
                                /** Helper function with finding things, so I don't need a framework
                                 */
                                let docE = (f, inp) => {
                                    if (Array.isArray(inp)) {
                                        return (inp.map(i => docE(f, i))).flat();
                                    }
                                    let seek = document[f](inp);
                                    if (!seek || seek instanceof HTMLElement) return seek;
                                    let tmp = [];
                                    for (let t of seek) tmp.push(t);
                                    return tmp;
                                };
                                
                                let content = document.getElementById('content');
                                let isInContent = function (e) {
                                    if (!e) return false;
                                    if (!e.parentElement || e.parentElement === document.body) return false;
                                    if (e.parentElement === content) return true;
                                    return isInContent(e.parentElement);
                                }
                                
                                /** Handler to take input and process links in gcode browser
                                 */
                                let ref = null;
                                let paster = () => {
                                    if (ref) clearTimeout(ref);
                                    ref = setTimeout(() => {
                                        let linkStyle = 'all:unset;cursor:pointer;text-decoration:underline;color:blue;';
                                        let v = docE('getElementById', 'gcode-paste-input').value;
                                        v = v.replace(codeRx, (s) => {
                                            if (codeMap[s]) return '<a href="#' + codeMap[s] + '" style="' + linkStyle + '">' + s + '</a>';
                                            return s;
                                        });
                                
                                        docE('getElementById', 'gcode-paste').innerHTML = '<pre style="text-align:left">' + v + '</pre>';
                                    }, 500);
                                };
                                
                                
                                // check to see if this page is the one we want, otherwise do nothing
                                let loc = null;
                                let pos = null;
                                let hash = null;
                                let qstring = null;
                                
                                const evalLocation = () => {
                                    loc = document.location + '';
                                    pos = loc.indexOf('#');
                                    hash = null;
                                    if (pos > -1) {
                                        hash = loc.substring(pos);
                                        loc = loc.substring(0, pos);
                                    }
                                
                                    qstring = '';
                                    pos = loc.indexOf('?');
                                    if (pos > -1) {
                                        qstring = loc.substring(pos + 1);
                                        loc = loc.substring(0, pos);
                                    }
                                };
                                
                                const moveToHash = () => {
                                    if (hash) {
                                        document.location = hash;
                                    }
                                };
                                
                                // current location details...
                                evalLocation();
                                
                                if (loc.endsWith('/Wiki/Gcode')) {
                                    // current page is the gcode wiki...
                                
                                    // find the menu
                                    let topTitle = docE('getElementsByClassName', 'toc-title')[0];
                                
                                    // add the link to run the mega-page import...
                                    let squirt = document.createElement('div');
                                    squirt.innerHTML = '<a id="create-mega-page-link" href="javascript:;">Create Mega-Page</a>';
                                
                                    topTitle.parentElement.insertBefore(squirt, topTitle.nextSibling);
                                
                                    setTimeout(() => {
                                        // take a beat, wire the event clicker (greasemonkey complication)...
                                        let tmp = null;
                                        (tmp = document.getElementById('create-mega-page-link')) ? tmp.addEventListener('click', () => processMegaPage()) : null;
                                    }, 50);
                                
                                    // function handler for the click...
                                    processMegaPage = () => {
                                        squirt.innerHTML = '';
                                
                                        // find all the specific links
                                        let glinks = docE('getElementsByTagName', 'a').filter(a => {
                                            let t = a.innerText;
                                            let h = '' + a.href;
                                            h = h.substring(h.indexOf('/', 10));
                                            return (t.match(codeRx) && !h.startsWith('/Wiki/Gcode') && (h.startsWith('/Wiki/M') || h.startsWith('/Wiki/G')));
                                        });
                                
                                        // a function that represents the work for a page download
                                        let processor = a => {
                                
                                            return new Promise((resolve, reject) => {
                                
                                                // download...
                                                fetch(a.href).then(async response => {
                                
                                                    // the document dext...
                                                    let t = await response.text();
                                
                                                    // pull out the good stuff...
                                                    let from = t.indexOf('<div id="Wiki_Details">');
                                                    let to = t.lastIndexOf('<div class="clearer">', t.lastIndexOf('<div itemprop="author"'));
                                                    t = t.substring(from, to);
                                
                                                    // dont need this link in there now...
                                                    t = t.replace('<p>Back to the <a href="/Wiki/Gcode">Gcode Dictionary</a></p>', '');
                                
                                                    // make a div for it
                                                    const d = document.createElement('div');
                                                    d.innerHTML = t;
                                
                                                    // replace the link tag's parent <p>
                                                    let p = a.parentElement;
                                                    p.parentNode.replaceChild(d, p);
                                
                                                    // end of task
                                                    resolve();
                                
                                                }).catch(reject);
                                            });
                                        };
                                
                                        let count = 0;
                                
                                        // a function that represents a processing thread so we can start N of them
                                        let runner = async () => {
                                            while (glinks.length > 0) {
                                                count++;
                                                if (count % 25 === 0) console.log(count);
                                                let x = glinks.shift();
                                                try {
                                                    await processor(x);
                                                } catch (e) {
                                                    console.log(e);
                                                }
                                            }
                                        };
                                
                                        // start the runners...
                                        let runnerCount = 1;
                                        (async () => {
                                            let time = new Date().getTime();
                                
                                            console.log('links to process: ' + glinks.length);
                                
                                            let runners = [];
                                            for (let i = 0; i < runnerCount; i++) runners.push(runner());
                                
                                            await Promise.all(runners);
                                
                                            console.log('DONE!!! (' + ((new Date().getTime() - time) / 1000) + ' seconds)');
                                
                                            moveToHash();
                                
                                            squirt.innerHTML = '<a id="cross-linker-link" href="javascript:;">Cross-link gcodes</a><br>'
                                                + '<a id="setup-gcode-browser-link" href="javascript:;">Setup GCode Browser</a><br><br>';
                                
                                            setTimeout(() => {
                                                // take a beat, wire the event clicker (greasemonkey complication)...
                                                let tmp = null;
                                                (tmp = document.getElementById('cross-linker-link')) ? tmp.addEventListener('click', () => crossLinkDoc()) : null;
                                                (tmp = document.getElementById('setup-gcode-browser-link')) ? tmp.addEventListener('click', () => setupGcodeBrowser()) : null;
                                            }, 50);
                                        })();
                                
                                        crossLinkDoc = () => {
                                            if (crossLinked) return;
                                            crossLinked = true;
                                
                                            let link = document.getElementById('cross-linker-link');
                                            link.parentElement.removeChild(link);
                                
                                            /** Parse the references out of the document
                                             */
                                            docE('getElementsByClassName', 'header').forEach(sect => {
                                                let s = sect.id + '';
                                                s.replace(codeRx, sx => {
                                                    sx = sx.replace('_', '.');
                                                    if (!codeMap[sx]) {
                                                        codeMap[sx] = s;
                                                    }
                                                });
                                            });
                                
                                            /** Cross-link gcode references through the document
                                             */
                                            docE('getElementsByTagName', ['p', 'li', 'pre', 'strong']).forEach(tag => {
                                                if (!tag) return;
                                                if (!isInContent(tag)) return;
                                                let linkStyle = 'all:unset;cursor:pointer;text-decoration:underline;color:blue;';
                                                let h = ('' + tag.innerHTML).trim();
                                              	if (h.startsWith('<div/')) return;
                                                tag.innerHTML = h.replace(/(?<!_)([GM]+[0-9]+(.[0-9])?)/g, (s) => {
                                                    if (codeMap[s]) return '<a href="#' + codeMap[s] + '" style="' + linkStyle + '" class="crosslink">' + s + '</a>';
                                                    return s;
                                                });
                                            });
                                
                                            evalLocation();
                                            moveToHash();
                                        };
                                
                                        setupGcodeBrowser = () => {
                                            crossLinkDoc();
                                
                                            if (squirt) {
                                                squirt.parentElement.removeChild(squirt);
                                                squirt = null;
                                            }
                                
                                            /** Strip the main wrapper element of styling
                                             */
                                            let wrap = docE('getElementById', 'page');
                                            wrap.className = '';
                                            wrap.id = 'gnavPage';
                                
                                            /** Remove styling of sidebar nested element
                                             */
                                            docE('getElementById', 'sidebar-wiki-toc').className = '';
                                            docE('getElementById', 'sidebar-wiki-toc').id = 'gnavSidebar';
                                
                                            /** Strip the sidebar
                                             */
                                            let sb = null;
                                            sb = docE('getElementById', 'page-sidebar');
                                            sb.innerHTML = '';
                                            sb.id = 'gnavSidebar';
                                
                                            /** Strip the main area
                                             */
                                            let main = docE('getElementById', 'main');
                                            main.id = 'gnavMain';
                                            docE('getElementsByClassName', 'articleContainer')[0].className = '';
                                
                                            /** Clear our other elements not needed
                                             */
                                            let mb = docE('getElementById', 'mainBody');
                                            for (let kid of mb.children) {
                                                if (kid.id !== 'contentFloat') mb.removeChild(kid);
                                            }
                                
                                            let bg = docE('getElementById', 'background');
                                            for (let kid of bg.children) {
                                                if (kid.id === 'gnavPage') break;
                                                else bg.removeChild(kid);
                                            }
                                
                                            for (let kid of document.body.children) {
                                                if (kid.id !== 'background') document.body.removeChild(kid);
                                            }
                                
                                            docE('getElementById', 'content').id = 'offContent';
                                
                                            /** Apply new styles to the wrapper, sidebar and main areas
                                             */
                                            wrap.setAttribute('style', 'display:flex;gap:1em;');
                                            sb.setAttribute('style', 'flex: 1 1 45%; height: 100vh;');
                                            main.setAttribute('style', 'flex: 1 1 50%; height: 100vh');
                                
                                            /** Input field to paste the gcode
                                             */
                                            sb.innerHTML = `
                                <div style="width: 45vw; height: 100vh; position: fixed;overflow: scroll;">
                                    <textarea id="gcode-paste-input"></textArea>
                                  <hr />
                                  <pre id="gcode-paste" style="text-align: left"><center>( paste gcode above )</center></pre>
                                </div>`;
                                
                                            setTimeout(() => {
                                                // take a beat, wire the event clicker (greasemonkey complication)...
                                                let tmp = null;
                                                (tmp = document.getElementById('gcode-paste-input')) ? tmp.addEventListener('keyup', () => paster()) : null;
                                            }, 50);
                                        };
                                    };
                                }
                                
                                // auto-trigger...
                                if (qstring === 'inflateContent') {
                                    processMegaPage();
                                }
                                

                                ...with the script run, you will get a link on the top of the left hand menu to create the mega-page...

                                • click it

                                ...this will process all the links and download all the content and inject it into the page. When completed the download and setting up the content, this link will change to "Setup GCode Browser"...

                                • click it

                                ...the script will hide the current menu, strip the page down so it's two side-by-side panels, and provide a place to paste gcode. Paste in any chunck of Gcode (like entire contents of 'config.g' ) and click "Run". It will then put the Gcode in place of the menu with all the codes changed to links in the document.

                                Much easier to browse what's happening without losing concentration with bouncing around.

                                _
                                CROSS LINKING: The docco frequently references other codes in the document, but it's a hassle to browse to them and back to where you were. This cross linker runs through the doc to find the gcode references, adds the links... so now you can click on the link, see what it was referencing and click back in the browser as the browser remembers scroll positions when clicking, just like it used to.

                                _
                                Greasemonkey/Tampermonkey
                                If you want it to simply be around without having to paste in, blah blah... install Greasemonkey browser plugin (Chrome's is called Tampermonkey), and install the script above. The browser will execute it when you visit the gcode page automagically. And if you hit it with "?inflateContent" on the end of the URL ( https://duet3d.dozuki.com/Wiki/Gcode?inflateContent ), it will automatically create the mega-page without needing to click anything.

                                theKMundefined o_lampeundefined 2 Replies Last reply Reply Quote 4
                                • theKMundefined
                                  theKM @theKM
                                  last edited by theKM

                                  @thekm ...used this script to browse @cjm 's gcode above... handy to understand what's happening. I do need to make the column wider though...

                                  1 Reply Last reply Reply Quote 0
                                  • o_lampeundefined
                                    o_lampe @theKM
                                    last edited by

                                    @thekm
                                    Has someone tested this java plugin with the new gcode structure?

                                    theKMundefined 2 Replies Last reply Reply Quote 0
                                    • theKMundefined
                                      theKM @o_lampe
                                      last edited by

                                      This post is deleted!
                                      1 Reply Last reply Reply Quote 1
                                      • theKMundefined
                                        theKM @o_lampe
                                        last edited by

                                        @o_lampe ...I originally replied that the script no longer works, but then I re-wrote it to include a content downloader that re-creates the previous structure of the single mega-page before setting up the gcode browser.

                                        The updated script and details are above if you want to give it a go (I edited the post to reflect the new changes).

                                        littlehobbyshopundefined 1 Reply Last reply Reply Quote 0
                                        • littlehobbyshopundefined
                                          littlehobbyshop @theKM
                                          last edited by littlehobbyshop

                                          @thekm That script is fantastic! Works a treat for me. Please create a post of it's own if you haven't already.

                                          Edit: Oh you already did. Very nicely done!

                                          BLV MGN Cube w/Hemera, K8200, Sunlu S8

                                          1 Reply Last reply Reply Quote 1
                                          • o_lampeundefined o_lampe referenced this topic
                                          • jameshartonundefined jamesharton referenced this topic
                                          • droftartsundefined droftarts referenced this topic
                                          • First post
                                            Last post
                                          Unless otherwise noted, all forum content is licensed under CC-BY-SA