image-to-gcode.txt
1 [[cha:image-to-g-code]] 2 3 = Image to G Code 4 5 image::images/image-to-gcode.png[align="center", alt="Image to G Code"] 6 7 == What is a depth map? 8 9 A depth map is a greyscale image where the brightness of each pixel 10 corresponds to the depth (or height) of the object at each point. 11 12 == Integrating image-to-gcode with the AXIS user interface 13 14 Add the following lines to the '[FILTER]' section of your .ini file 15 to make AXIS automatically invoke 16 image-to-gcode when you open a .png, .gif, or .jpg image 17 18 ---- 19 PROGRAM_EXTENSION = .png,.gif,.jpg Grayscale Depth Image 20 png = image-to-gcode 21 gif = image-to-gcode 22 jpg = image-to-gcode 23 ---- 24 25 The standard 'sim/axis.ini' configuration file is already configured 26 this way. 27 28 == Using image-to-gcode 29 30 Start image-to-gcode either by opening an image file in AXIS, or by 31 invoking image-to-gcode from the terminal, as follows: 32 33 ---- 34 image-to-gcode torus.png > torus.ngc 35 ---- 36 37 Verify all the settings in the right-hand column, then press OK to 38 create the gcode. Depending on the image size and options chosen, this 39 may take from a few seconds to a few minutes. If you are loading the 40 image in AXIS, the gcode will automatically be loaded and previewed 41 once image-to-gcode completes. In AXIS, hitting reload will show the 42 image-to-gcode option screen again, allowing you to tweak them. 43 44 == Option Reference 45 46 === Units 47 48 Specifies whether to use G20 (inches) or G21 (mm) in the generated 49 g-code and as the units for each option labeled '(units)'. 50 51 === Invert Image 52 53 If “no”, the black pixel is the lowest point and the white pixel is 54 the highest point. If “yes”, the black pixel is the highest point and 55 the white pixel is the lowest point. 56 57 === Normalize Image 58 59 If 'yes', the darkest pixel is remapped to black, the lightest pixel 60 is remapped to white. 61 62 === Expand Image Border 63 64 If 'None', the input image is used as-is, and details which are at the 65 very edges of the image may be cut off. If 'White' or 'Black', then a 66 border of pixels equal to the tool diameter is added on all sides, and 67 details which are at the very edges of the images will not be cut off. 68 69 === Tolerance (units) 70 71 When a series of points are within 'tolerance' of being a straight 72 line, they are output as a straight line. 73 Increasing tolerance can lead to better contouring performance in LinuxCNC, 74 but can also remove or blur small details in the image. 75 76 === Pixel Size (units) 77 78 One pixel in the input image will be this many units--usually this 79 number is much smaller than 1.0. For instance, to mill a 2.5x2.5-inch 80 object from a 400x400 image file, use a pixel size of .00625, because 81 2.5 / 400 = .00625. 82 83 === Plunge Feed Rate (units per minute) 84 85 The feed rate for the initial plunge movement. 86 87 === Feed Rate (units per minute) 88 89 The feed rate for other parts of the path. 90 91 === Spindle Speed (RPM) 92 93 The spindle speed S code that should be put into the gcode file. 94 95 === Scan Pattern 96 97 Possible scan patterns are: 98 99 - Rows 100 - Columns 101 - Rows, then Columns 102 - Columns, then Rows 103 104 === Scan Direction 105 106 Possible scan directions are: 107 108 - Positive: Start milling at a low X or Y axis value, and move towards a 109 high X or Y axis value 110 - Negative: Start milling at a high X or Y axis value, and move towards 111 a low X or Y axis value 112 - Alternating: Start on the same end of the X or Y axis travel that the 113 last move ended on. This reduces the amount of traverse movements 114 - Up Milling: Start milling at low points, moving towards high points 115 - Down Milling: Start milling at high points, moving towards low points 116 117 === Depth (units) 118 119 The top of material is always at 'Z=0'. The deepest cut into the 120 material is 'Z=-depth.' 121 122 === Step Over (pixels) 123 124 The distance between adjacent rows or columns. To find the number of 125 pixels for a given units distance, compute 'distance/pixel size' and 126 round to the nearest whole number. For example, if 'pixel size=.006' 127 and the desired step over 'distance=.015', then use a Step Over of 2 or 128 3 pixels, because '.015/.006=2.5''.' 129 130 === Tool Diameter 131 132 The diameter of the cutting part of the tool. 133 134 === Safety Height 135 136 The height to move to for traverse movements. image-to-gcode always 137 assumes the top of material is at 'Z=0'. 138 139 === Tool Type 140 141 The shape of the cutting part of the tool. Possible tool shapes are: 142 143 - Ball End 144 - Flat End 145 - 45 degree “vee” 146 - 60 degree “vee” 147 148 === Lace bounding 149 150 This controls whether areas that are relatively flat along a row or 151 column are skipped. This option only makes sense when both rows and 152 columns are being milled. Possible bounding options are: 153 154 - None: Rows and columns are both fully milled. 155 - Secondary: When milling in the second direction, areas that do not 156 strongly slope in that direction are skipped. 157 - Full: When milling in the first direction, areas that strongly slope 158 in the second direction are skipped. When milling in the second 159 direction, areas that do not strongly slope in that direction are 160 skipped. 161 162 === Contact angle 163 164 When 'Lace bounding' is not 'None', slopes greater than 'Contact angle' 165 are considered to be 'strong' slopes, and slopes less than that angle 166 are considered to be weak slopes. 167 168 === Roughing offset and depth per pass 169 170 Image-to-gcode can optionally perform rouging passes. The depth of 171 successive roughing passes is given by 'Roughing depth per pass'. For 172 instance, entering 0.2 will perform the first roughing pass with a 173 depth of 0.2, the second roughing pass with a depth of 0.4, and so on 174 until the full Depth of the image is reached. No part of any roughing 175 pass will cut closer than Roughing Offset to the final part. The following 176 figure shows a tall vertical feature being milled. 177 In this image, Roughing depth per pass is 0.2 inches and roughing 178 offset is 0.1 inches. 179 180 .Roughing passes and final pass 181 182 image::images/i2g-roughing.png[alt="Roughing passes and final pass"] 183