g-code

parsing gcode file to extract coordinates

泄露秘密 提交于 2020-02-23 07:23:25
问题 I have a gcode file that is full of text, more specifically coordinated for a machine. I am trying to read the file, strip away the useless information so that I can then perform an operation on the coordinated before they are sent out to the machine. so far I have: file = open('TestCube.gcode','r') lines = file.readlines() file.close for line in lines: line = line.strip() Now I have a list of all the lines in the file how should I proceed in getting the relevant X and Y coordinates? sample

Sending the right Gcode string to a Serial Port?

这一生的挚爱 提交于 2019-12-01 05:35:55
问题 I am trying to send the gcode g28 to my RepRap 3D printer through the line port.Write("g28"); . My program connects to the right serial port however when I try sending the information as string the access to the com port gets denied. This is strange because the Serial port was open before sending the Gcode to it. It even sent some data back. What is the problem there and how could i fix it? Below are the lines of code that I am using. The list of gcode commands are available on this page. I

Circular approximation of polygon (or its part)

混江龙づ霸主 提交于 2019-11-28 14:16:45
SHORT DESCRIPTION OF MY PROBLEM I need to implement GCODE autorefactoring from G1 instructions to G2 and G3 ( http://www.cnccookbook.com/CCCNCGCodeArcsG02G03.htm ) for 3D Printing. G1 is a movement in straight line with printing (path is describe by vector). I'm searching for algorytm to aproxymate circle/arc (specialy it's midpoint) based on given vectors path. Note that G2 and G3 can't print curves that are not part of a circle - so not every vectors path can be approximate this way. LONG DESCRIPTION OF MY PROBLEM I'm searching way to approximate part (or all) of vectors path (can be regular

Circular approximation of polygon (or its part)

一个人想着一个人 提交于 2019-11-27 08:17:45
问题 SHORT DESCRIPTION OF MY PROBLEM I need to implement GCODE autorefactoring from G1 instructions to G2 and G3 (http://www.cnccookbook.com/CCCNCGCodeArcsG02G03.htm) for 3D Printing. G1 is a movement in straight line with printing (path is describe by vector). I'm searching for algorytm to aproxymate circle/arc (specialy it's midpoint) based on given vectors path. Note that G2 and G3 can't print curves that are not part of a circle - so not every vectors path can be approximate this way. LONG