-- Modified by: Ya-Nvr-No -- Created: 12/30/2014 local inst = mc.mcGetInstance(); gcode = " " Gcode = " " function main() local i = 0 --change the following values local x_center = 0 local y_center = 0 local dia = 30/25.4 --30mm divided by the factor to get inches local numberofholes = 3 local StartAngle = 0 --to get the data points local stAngle = (math.pi / 180) * StartAngle local Xangle = tonumber(math.cos(stAngle)) local Yangle = tonumber(math.sin(stAngle)) local x = x_center + (dia / 2) * Xangle; local y = y_center + (dia / 2) * Yangle; local StepAng = tonumber((2 * math.pi) / numberofholes); gcode = "\n\nThese are the:"..numberofholes.." locations, with the center of pattern @ X"..x_center.." Y"..y_center.." with the starting Angle @:"..StartAngle.. " Degrees\n" for i = 1, numberofholes, 1 do x = x_center + (dia / 2) * math.cos(stAngle + (StepAng * i)); y = y_center + (dia / 2) * math.sin(stAngle + (StepAng * i)); Gcode = Gcode..string.format(" X%.4f Y%.4f ",x,y) end end if (mc.mcInEditor() == 1) then main() print(gcode.."\n") print(Gcode.."\n") s=s -- put a break point here else main() mc.mcCntlSetLastError(inst, gcode); mc.mcCntlSetLastError(inst, Gcode.."\n"); end