// Use this tool to draw freehand lines that are 'maxLength' long. macro "Specified Length Line Tool - C00bL1de0L1ee1" { maxLength = 20; leftClick=16 i = 0; xpoints = newArray(2000); ypoints = newArray(2000); getCursorLoc(x2, y2, z, flags); xpoints[i]=x2; ypoints[i++]=y2; while (true) { getCursorLoc(x, y, z, flags); if (flags&leftClick==0) exit(); if (x!=x2 || y!=y2) { xpoints[i] = x; ypoints[i] = y; i++; x2=x; y2=y; xpoints2 = Array.trim(xpoints, i); ypoints2 = Array.trim(ypoints, i); makeSelection("freeline", xpoints2, ypoints2); List.setMeasurements; length = List.getValue("Length"); showStatus("length="+d2s(length,2)); if (length>=maxLength) exit; } } }