2014-3-5 16:02:46 [显示全部楼层]
7226浏览
查看: 7226|回复: 9

和Dreammaker一起来了解Gcode

[复制链接]
现在大部分的3D打印机,特别是开源的3D打印机大都采用Gcode来运行,我们今天就一点点的了解下gcode
首先我们先看下基本的Gcode有哪些。
=========================
G代码
G0: Rapid Positioning
G1: Coordinated Motion
G2: Clockwise Arc
G3: Counter Clockwise Arc
G4: Dwell
G10: Create Coordinate System Offset from the Absolute one
G20: Use Inches as Units
G21: Use Milimeters as Units
G28: Home given axes to maximum
G53: Set absolute coordinate system
G54: Use coordinate system from G10 P0
G55: Use coordinate system from G10 P1
G56: Use coordinate system from G10 P2
G57: Use coordinate system from G10 P3
G58: Use coordinate system from G10 P4
G59: Use coordinate system from G10 P5
G70: Use Inches as Units
G71: Use Milimeters as Units
G90: Absolute Positioning
G91: Relative Positioning
G92: Define current position on axes
G97: Spindle speed rate
G130: Set given axes potentiometer Value
G161: Home given axes to minimum
G162: Home given axes to maximum

M代码
M0: Unconditional Halt, not supported on SD?
M1: Optional Halt, not supported on SD?
M2: End program
M3: Spindle On - Clockwise
M4: Spindle On - Counter Clockwise
M5: Spindle Off
M6: Wait for toolhead to come up to reach (or exceed) temperature
M7: Coolant A on (flood coolant)
M8: Coolant B on (mist coolant)
M9: All Coolant Off
M10: Close Clamp
M11: Open Clamp
M13: Spindle CW and Coolant A On
M14: Spindle CCW and Coolant A On
M17: Enable Motor(s)
M18: Disable Motor(s)
M21: Open Collet
M22: Close Collet
M30: Program Rewind
M40: Change Gear Ratio to 0
M41: Change Gear Ratio to 1
M42: Change Gear Ratio to 2
M43: Change Gear Ratio to 3
M44: Change Gear Ratio to 4
M45: Change Gear Ratio to 5
M46: Change Gear Ratio to 6
M50: Read Spindle Speed
M70: Display Message On Machine
M71: Display Message, Wait For User Button Press
M72: Play a Tone or Song
M73: Manual Set Build %
M101: Turn Extruder On, Forward
M102: Turn Extruder On, Reverse
M103: Turn Extruder Off
M104: Set Temperature
M105: Get Temperature
M106: Turn Automated Build Platform (or the Fan, on older models) On
M107: Turn Automated Build Platform (or the Fan, on older models) Off
M108: Set Extruder's Max Speed (R = RPM, P = PWM)
M109: Set Build Platform Temperature
M110: Set Build Chamber Temperature
M126: Valve Open
M127: Valve Close
M128: Get Position
M131: Store Current Position to EEPROM
M132: Load Current Position from EEPROM
M140: Set Build Platform Temperature
M141: Set Chamber Temperature (Ignored)
M142: Set Chamber Holding Pressure (Ignored)
M200: Reset driver
M300: Set Servo 1 Position
M301: Set Servo 2 Position
M310: Start data capture
M311: Stop data capture
M312: Log a note to the data capture store

=========================
上面就是基本的Gcode代码
所有的3D打印生成的gcode或多或少的都由gcode组成。
基本的Gcode分为G代码,M代码
G代码主要是执行代码
M代码主要是设置代码
今后我们将在这个帖子里面将这些G代码和M代码进行分析,同时我们也会介绍一些打印时修改代码的技巧。

lauren  高级技师

发表于 2014-3-5 18:02:45

。。。能不能结合一点实践效果,完全没有概念啊。。。
回复

使用道具 举报

Phoebe  高级技匠

发表于 2014-3-6 09:27:52

每句code都是句完整的短语呢,感觉每句都像注释。看是看懂了,但不知道我要是修改的动作的话,要怎么表达。。。期待更新
回复

使用道具 举报

Osin  初级技匠

发表于 2014-3-7 14:37:45

太抽象了,完全是不明觉厉的节奏啊
回复

使用道具 举报

Rockets  NPC
 楼主|

发表于 2014-3-13 18:39:28

今天我们来讲讲G1命令
打开任何一个生成好的gcode命令,可以发现大量的G1命令,
G1命令的格式一般如下:

G1 X123 Y123 Z123 E123 F123

其中G1命令表示去哪里
G1后面跟着的称为参数,注意在Gcode中,所有的参数必须大写,数字要紧跟在字母后面,并用空格分开不同的参数。
后面空格跟的X123 Y123 Z123表示去的坐标
在3D打印机的坐标系里,这个点就是据home点的直角坐标系位置,一般为毫米单位。
上面的参数表示X坐标123mm,Y坐标123mm,Z坐标123mm的一个点。
E123表示挤出多少数量的丝料。
上面的参数表示挤出123mm的丝料。
而F表示的是到那里的速度,不同的打印机有不同的反应,有的打印机是逐步提升速度,有的打印机是直接加速到这个速度。
典型的Gcode一般需要包括上面所有的参数和数字,不过有时候你可以根据情况省略一些参数。
比如如果Z轴已经固定,那就可以仅仅输入
G1 X123 Y123
即可
或者需要调整一下高度,可以输入
G1 Z123
即可
当然需要输出一定的丝料可以试着输入
G1 E123
不过需要注意的是,一般挤出的值是收到设备的保护的,一般需要有一定的温度才能运行挤出步进电机的运行。所以有可能输入的这条命令会无效。


以上介绍了一下G1的命令,大家会发现其实Gcode是可以输入的,但是如何输入呢?可以使用一些软件来进行。具体下一节来介绍。
回复

使用道具 举报

jxgx0720  见习技师

发表于 2014-3-14 13:52:23

如果能有实例演示就好了,期待后面的详解
回复

使用道具 举报

Rockets  NPC
 楼主|

发表于 2014-3-14 20:06:01

jxgx0720 发表于 2014-3-14 13:52
如果能有实例演示就好了,期待后面的详解

别急,等我慢慢说来,看看这个楼能盖多高。
回复

使用道具 举报

念天悠  见习技师

发表于 2014-6-3 08:30:32

顶一下,这个帖子不错的
回复

使用道具 举报

gxshun  学徒

发表于 2014-6-10 16:46:55

:dizzy: 就这样没啦??
回复

使用道具 举报

xiao_821126  学徒

发表于 2014-6-26 13:45:00

期待您的跟新啊
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

为本项目制作心愿单
购买心愿单
心愿单 编辑
[[wsData.name]]

硬件清单

  • [[d.name]]
btnicon
我也要做!
点击进入购买页面
上海智位机器人股份有限公司 沪ICP备09038501号-4

© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed

mail