<xml> <variables> <var name="ZChangeToolValue" value="30"/> <var name="ZTravelValue" value="10"/> <var name="ZDrillValue" value="0"/> </variables> <functions> <!-- predefined function with single parameter: a - source (requested) diameter returns - suggested tool diameter for give requested after halvanic if function nod defined, it assumed return=a --> <plate_increase_dia f="a+0.2"/> </functions> <tools> <!-- "tool" node defines a real drill tool for make a hole Depends on your technical process you can set up different tools for plated or not holes or join same holes in single tool. Required parameters for tool are: 1. range_min,range_max - diameters range to assign holes for this tool You can joun different diameters (f.ex. 0.31-0.4) to single tool 2. plated="yes|no|both" - defines plated property to Other parameters are optional and can be used later in G-Code patterns. For example, you can define tool position or toolbox coords for the tool. --> <tool description="0,3mm" range_min="0" range_max="0.3" plated="both" position="0" /> <tool description="0,4mm" range_min="0.3" range_max="0.4" plated="both" position="1" /> <tool description="0,5mm" range_min="0.4" range_max="0.5" plated="both" position="2" /> <tool description="0,6mm" range_min="0.5" range_max="0.6" plated="both" position="3" /> <tool description="0,7mm" range_min="0.6" range_max="0.7" plated="both" position="4" /> <tool description="0,8mm" range_min="0.7" range_max="0.8" plated="both" position="5" /> <tool description="0,9mm" range_min="0.8" range_max="0.9" plated="both" position="6" /> <tool description="1,0mm" range_min="0.9" range_max="1.0" plated="both" position="7" /> <tool description="1,1mm" range_min="1.0" range_max="1.1" plated="both" position="8" /> <tool description="1,2mm" range_min="1.1" range_max="5" plated="both" position="9" /> </tools> <patterns> <!-- in any pattern you can use any variable from context where it's printing Example (used inside 'tool' loop type): Mnnn Please, change tool to ${description} ; message to lcd Mnnn ; pause Note : here ${description} is optional tag defined in <tool> node Use this example outsite the tool loop will cause calculation error. --> <pattern name="start"> G90 ;${var hcnt=holesCount;var tcnt=toolsCount;"Hello"} M117 Homing G28 XY M117 Move Z to travel G0 X${minX} Y${minY} M76 G92 Z${ZTravelValue} </pattern> <pattern name="finish"> G0 Z${ZChangeToolValue} M104 S0 ; disable spindle G0 X0 Y220 M117 Drill finished M300 S600 P1 ; Stats: ; Holes : ${holesCount} ; Tools : ${toolsCount} </pattern> <pattern name="set_tool"> ; Tools rest: ${tcnt--} G0 Z${ZChangeToolValue} G0 X100 Y0 M104 S0 ; disable spindle M117 Change tool to ${description} M300 S600 P1 M76 ; pause job M117 Drilling M104 S100 ; enable spindle G28 X </pattern> <pattern name="go_drill"> ; Holes rest: ${hcnt--} ; Percent rest: ${var percent=Math.round(hcnt*100/holesCount); percent}% M73 P${100-percent} G0 Z${ZTravelValue} G0 X${Math.round(x*100)/100} Y${Math.round(y*100)/100} G0 Z${ZDrillValue} G0 Z${ZTravelValue} </pattern> </patterns> <script> <!-- "assign tools". No parameters Just assign all tools declared in DRL-file to tools described in <tools> node. For each DRL-defined tool will be selected FIRST compatible tool from <tools> node. Ie if range 0.3..0.8 will be defined early, <tool> node for diameter 0.4..0.5 will never be assigned. Except 'plated' property will be different. --> <command verb="assign tools" /> <!-- "assign tools". No parameters Join all DRL-file tools, assigned to same tool here to one tool (also holes) Just avoid multiply changing physical tool to same --> <command verb="join tools" /> <!-- "offset". Offset ALL holes by defined values xoffs, yoffs - values to offset. Before offset will be calculated ie here you can use global variables. --> <command verb="offset" xoffs="-minX+10" yoffs="-minY+10"/> <!-- loop for each DRL-tool (assigned and joined before). Context inside will be filled also with tool's properties and node's parameters --> <command verb="print" pattern="start"/> <loop type="tools"> <command verb="print" pattern="set_tool"/> <command verb="print context" line_begin=";"/> <!-- loop for each hole inside the tool. Context inside will be filled also with hole's properties(x&y) and node's parameters --> <loop type="toolholes"> <command verb="print" pattern="go_drill"/> <!-- "print context". Anwhere in script you can use this verb. It inserts all context variables available. Usefull for debug but completely useless for normal work --> <command verb="print context" line_begin=";"/> </loop> </loop> <command verb="print" pattern="finish"/> </script> </xml>
<xml> <variables> <var name="ZChangeToolValue" value="10"/> <var name="ZTravelValue" value="2"/> <var name="ZDrillValue" value="-3"/> <var name="FeedHorizontal" value="24000"/> <var name="FeedDown" value="100"/> <var name="FeedFree" value="2000"/> <var name="StartOffsX" value="20"/> <var name="StartOffsY" value="20"/> <var name="ZZeroPosition" value="0.1"/> <var name="first" value="0"/> </variables> <functions> <!-- predefined function with single parameter: a - source (requested) diameter returns - suggested tool diameter for give requested after halvanic if function nod defined, it assumed return=a --> <plate_increase_dia f="a+0.3"/> </functions> <tools> <!-- "tool" node defines a real drill tool for make a hole Depends on your technical process you can set up different tools for plated or not holes or join same holes in single tool. Required parameters for tool are: 1. range_min,range_max - diameters range to assign holes for this tool You can joun different diameters (f.ex. 0.31-0.4) to single tool 2. plated="yes|no|both" - defines plated property to Other parameters are optional and can be used later in G-Code patterns. For example, you can define tool position or toolbox coords for the tool. --> <tool description="0,3mm" range_min="0" range_max="0.3" plated="both" position="0" /> <tool description="0,4mm" range_min="0.3" range_max="0.4" plated="both" position="1" /> <tool description="0,5mm" range_min="0.4" range_max="0.5" plated="both" position="2" /> <tool description="0,6mm" range_min="0.5" range_max="0.6" plated="both" position="3" /> <tool description="0,7mm" range_min="0.6" range_max="0.7" plated="both" position="4" /> <tool description="0,8mm" range_min="0.7" range_max="0.8" plated="both" position="5" /> <tool description="0,9mm" range_min="0.8" range_max="0.9" plated="both" position="6" /> <tool description="1,0mm" range_min="0.9" range_max="1.0" plated="both" position="7" /> <tool description="1,1mm" range_min="1.0" range_max="1.1" plated="both" position="8" /> <tool description="1,2mm" range_min="1.1" range_max="5" plated="both" position="9" /> </tools> <patterns> <!-- in any pattern you can use any variable from context where it's printing Example (used inside 'tool' loop type): Mnnn Please, change tool to ${description} ; message to lcd Mnnn ; pause Note : here ${description} is optional tag defined in <tool> node Use this example outsite the tool loop will cause calculation error. --> <pattern name="start1"> ; Start </pattern> <pattern name="set_tool1"> ; Set tool ${description} </pattern> <pattern name="finish1"> ; Finish </pattern> <pattern name="go_drill1"> ; Drill X${Math.round(x*100)/100} Y${Math.round(y*100)/100} </pattern> <pattern name="start"> ;${var hcnt=holesCount;var tcnt=toolsCount;"Hello"} M117 Homing G28 G0 Z0 F${FeedFree} G92 Z1.6 </pattern> <pattern name="finish"> G0 Z${ZChangeToolValue} F${FeedFree} M400 M5 ; disable spindle G0 X0 Y220 F${FeedHorizontal} M117 Drill finished M300 S600 P100 ; Stats: ; Holes : ${holesCount} ; Tools : ${toolsCount} </pattern> <pattern name="set_tool"> ; Tools rest: ${tcnt--} G0 Z${ZChangeToolValue} F${FeedFree} M400 G0 X100 Y0 F${FeedHorizontal} M117 Stopping spindle M5 ; disable spindle M117 Change tool to ${description} M300 S600 P100 M400 ; This strange line is just crutch to prevent Marlin from read-n-exec other commands begore do pause M25 M400 ; This strange line is just crutch to prevent Marlin from read-n-exec other commands begore do pause M400 ; This strange line is just crutch to prevent Marlin from read-n-exec other commands begore do pause M400 ; This strange line is just crutch to prevent Marlin from read-n-exec other commands begore do pause M400 ; This strange line is just crutch to prevent Marlin from read-n-exec other commands begore do pause M400 ; This strange line is just crutch to prevent Marlin from read-n-exec other commands begore do pause M400 ; This strange line is just crutch to prevent Marlin from read-n-exec other commands begore do pause M400 ; This strange line is just crutch to prevent Marlin from read-n-exec other commands begore do pause M400 ; This strange line is just crutch to prevent Marlin from read-n-exec other commands begore do pause M400 ; This strange line is just crutch to prevent Marlin from read-n-exec other commands begore do pause M400 ; This strange line is just crutch to prevent Marlin from read-n-exec other commands begore do pause M400 ; This strange line is just crutch to prevent Marlin from read-n-exec other commands begore do pause M400 ; This strange line is just crutch to prevent Marlin from read-n-exec other commands begore do pause G28 XY G0 X${StartOffsX-1} Y${StartOffsX-1} Z${ZTravelValue} F${FeedHorizontal} G0 Z${ZZeroPosition} F${FeedFree} M117 Check zero-hole M300 S600 P100 M400 ; This strange line is just crutch to prevent Marlin from read-n-exec other commands begore do pause M25 M400 ; This strange line is just crutch to prevent Marlin from read-n-exec other commands begore do pause M400 ; This strange line is just crutch to prevent Marlin from read-n-exec other commands begore do pause M400 ; This strange line is just crutch to prevent Marlin from read-n-exec other commands begore do pause M400 ; This strange line is just crutch to prevent Marlin from read-n-exec other commands begore do pause M400 ; This strange line is just crutch to prevent Marlin from read-n-exec other commands begore do pause M400 ; This strange line is just crutch to prevent Marlin from read-n-exec other commands begore do pause M400 ; This strange line is just crutch to prevent Marlin from read-n-exec other commands begore do pause M400 ; This strange line is just crutch to prevent Marlin from read-n-exec other commands begore do pause M400 ; This strange line is just crutch to prevent Marlin from read-n-exec other commands begore do pause M400 ; This strange line is just crutch to prevent Marlin from read-n-exec other commands begore do pause M400 ; This strange line is just crutch to prevent Marlin from read-n-exec other commands begore do pause M400 ; This strange line is just crutch to prevent Marlin from read-n-exec other commands begore do pause G92 Z${ZZeroPosition} F${FeedDown} M117 Starting spindle M3 ; enable spindle G0 Z${ZDrillValue} F${FeedDown/3} G0 Z${ZTravelValue} F${FeedFree} M117 Drilling M117 Starting spindle M3 ; enable spindle </pattern> <pattern name="go_drill"> ; Holes rest: ${hcnt--} ; Percent rest: ${var percent=Math.round(hcnt*100/holesCount); percent}% M73 P${100-percent} M117 Drilling X${Math.round(x*100)/100} Y${Math.round(y*100)/100} Z${ZTravelValue} G0 Z${ZTravelValue} F${FeedFree} G0 X${(Math.round(x*100)/100)-2} Y${(Math.round(y*100)/100)-2} F${FeedHorizontal} G0 X${Math.round(x*100)/100} Y${Math.round(y*100)/100} F${FeedHorizontal} M400 G0 Z${Math.round((ZZeroPosition+0.2)*100)/100} F${FeedFree} G0 Z${Math.round((ZZeroPosition-0.3)*100)/100} F${FeedDown/10} G0 Z${ZDrillValue} F${FeedDown} M117 Return G0 Z${ZTravelValue} F${FeedFree} </pattern> <pattern name="second_time"> ; ${var hcnt=holesCount;var tcnt=toolsCount;"SECOND!!!"} </pattern> </patterns> <script> <!-- "assign tools". No parameters Just assign all tools declared in DRL-file to tools described in <tools> node. For each DRL-defined tool will be selected FIRST compatible tool from <tools> node. Ie if range 0.3..0.8 will be defined early, <tool> node for diameter 0.4..0.5 will never be assigned. Except 'plated' property will be different. --> <command verb="assign tools" /> <!-- "assign tools". No parameters Join all DRL-file tools, assigned to same tool here to one tool (also holes) Just avoid multiply changing physical tool to same --> <command verb="join tools" /> <!-- "offset". Offset ALL holes by defined values xoffs, yoffs - values to offset. Before offset will be calculated ie here you can use global variables. --> <command verb="offset" xoffs="-minX+StartOffsX" yoffs="-minY+StartOffsY"/> <!-- loop for each DRL-tool (assigned and joined before). Context inside will be filled also with tool's properties and node's parameters --> <command verb="sort tools"/> <command verb="print" pattern="start"/> <loop type="tools"> <condition content="first++==0"> <command verb="print" pattern="set_tool"/> </condition> <command verb=";print context" line_begin=";"/> <!-- loop for each hole inside the tool. Context inside will be filled also with hole's properties(x&y) and node's parameters --> <loop type="toolholes"> <command verb="print" pattern="go_drill"/> <!-- "print context". Anwhere in script you can use this verb. It inserts all context variables available. Usefull for debug but completely useless for normal work --> <command verb=";print context" line_begin=";"/> </loop> </loop> <condition content="first=0"> <command verb=";dummy"/> </condition> <command verb="print" pattern="second_time"/> <loop type="tools"> <condition content="first++>0"> <command verb="print" pattern="set_tool"/> <command verb=";print context" line_begin=";"/> <!-- loop for each hole inside the tool. Context inside will be filled also with hole's properties(x&y) and node's parameters --> <loop type="toolholes"> <command verb="print" pattern="go_drill"/> <!-- "print context". Anwhere in script you can use this verb. It inserts all context variables available. Usefull for debug but completely useless for normal work --> <command verb=";print context" line_begin=";"/> </loop> </condition> </loop> <command verb="print" pattern="finish"/> </script> </xml>
<variables> <var name=" " value=" "/> </variables>
<functions> <plate_increase_dia f="a+0.2"/> </functions>
<tools> <tool description="0,3mm" range_min="0" range_max="0.3" plated="both" position="0" /> </tools>
<patterns> <pattern name="start"> G90 ;${var hcnt=holesCount;var tcnt=toolsCount;"Hello"} M117 Homing G28 XY M117 Move Z to travel G0 X${minX} Y${minY} M76 G92 Z${ZTravelValue} </pattern>
G90 ;Hello M117 Homing G28 XY M117 Move Z to travel G0 X10 Y10 M76 G92 Z10
; Holes rest: ${hcnt--} ; Percent rest: ${var percent=Math.round(hcnt*100/holesCount); percent}% M73 P${100-percent}
; Holes rest: 6 ; Percent rest: 13% M73 P87
<script> <command verb="assign tools" />
<command verb=" " .... ... />
<loop type=" "> ..... </loop>
Source: https://habr.com/ru/post/428534/
All Articles