打印

写字机的舵机抬笔指令和落笔指令

[复制链接]
7225|1
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
先看一段nc代码,这段是描述AB两个字母笔画的。
%
(Header)
(Generated by gcodetools from Inkscape.)
(Using default header. To add your own header create file "header" in the output dir.)
M3
(Header end.)
G21 (All units in mm)

(Start cutting path id: path1149)
(Change tool to Default tool)

G00 Z5.000000
G00 X32.616958 Y9.179233

G01 Z-0.125000 F100.0(Penetrate)
G02 X31.398997 Y8.249185 Z-0.125000 I-5.697745 J6.199062 F400.000000
G02 X30.222453 Y7.674576 Z-0.125000 I-3.270410 J5.204517
G02 X28.950483 Y7.365278 Z-0.125000 I-2.215732 J6.341968
G02 X27.143806 Y7.237740 Z-0.125000 I-1.806677 J12.732749
G01 X20.691622 Y7.237740 Z-0.125000
G01 X24.737507 Y31.328433 Z-0.125000
G01 X29.786017 Y31.328433 Z-0.125000
G02 X31.703047 Y31.268731 Z-0.125000 I-0.000000 J-30.807603
G02 X32.640547 Y31.150462 Z-0.125000 I-0.465318 J-7.463396
G02 X33.530684 Y30.858825 Z-0.125000 I-0.668540 J-3.544781
G02 X34.362701 Y30.325328 Z-0.125000 I-1.735392 J-3.621969
G02 X34.918594 Y29.710115 Z-0.125000 I-2.025969 J-2.389375
G02 X35.329940 Y28.917745 Z-0.125000 I-2.993269 J-2.056865
G02 X35.571271 Y28.059598 Z-0.125000 I-4.158120 J-1.632369
G02 X35.660218 Y27.040969 Z-0.125000 I-5.788274 J-1.018629
G02 X35.426627 Y25.012672 Z-0.125000 I-8.922779 J0.000000
G02 X34.799141 Y23.352132 Z-0.125000 I-6.568413 J1.533249
G02 X33.758826 Y21.924695 Z-0.125000 I-5.715355 J3.072540
G02 X32.416432 Y20.876728 Z-0.125000 I-4.346005 J4.183264
G01 X32.416432 Y20.747296 Z-0.125000
G02 X33.672239 Y20.103596 Z-0.125000 I-1.199698 J-3.887356
G02 X34.575021 Y19.113205 Z-0.125000 I-2.214429 J-2.925201
G02 X35.110535 Y17.852555 Z-0.125000 I-3.616356 J-2.280265
G02 X35.329940 Y16.039175 Z-0.125000 I-7.384088 J-1.813380
G02 X35.136510 Y14.022482 Z-0.125000 I-10.609675 J0.000000
G02 X34.575021 Y12.140010 Z-0.125000 I-9.793233 J1.896071
G02 X33.669960 Y10.423342 Z-0.125000 I-9.084011 J3.692354
G02 X32.616958 Y9.179233 Z-0.125000 I-5.769490 J3.815563
G01 X32.616958 Y9.179233 Z-0.125000
G00 Z5.000000

(End cutting path id: path1149)


(Start cutting path id: path1149)
(Change tool to Default tool)

G00 Z5.000000
G00 X33.124167 Y26.151118

G01 Z-0.125000 F100.0(Penetrate)
G03 X33.074843 Y26.821629 Z-0.125000 I-4.582118 J-0.000000 F400.000000
G03 X32.959030 Y27.267476 Z-0.125000 I-2.127850 J-0.314761
G03 X32.750205 Y27.691846 Z-0.125000 I-2.066418 J-0.753287
G03 X32.487205 Y28.011716 Z-0.125000 I-1.424023 J-0.902787
G03 X31.946381 Y28.369751 Z-0.125000 I-1.409040 J-1.540919
G03 X31.248667 Y28.577984 Z-0.125000 I-1.094174 J-2.393169
G03 X30.502129 Y28.667873 Z-0.125000 I-1.226720 J-7.043051
G03 X29.325989 Y28.707417 Z-0.125000 I-1.176140 J-17.471160
G01 X26.660187 Y28.707417 Z-0.125000
G01 X25.457038 Y21.556251 Z-0.125000
G01 X28.523889 Y21.556251 Z-0.125000
G03 X29.531336 Y21.611359 Z-0.125000 I-0.000000 J9.236262
G03 X30.293226 Y21.750400 Z-0.125000 I-0.593598 J5.409630
G03 X31.015771 Y22.025353 Z-0.125000 I-1.130553 J4.057826
G03 X31.614334 Y22.397565 Z-0.125000 I-1.540410 J3.144559
G03 X32.230744 Y23.062729 Z-0.125000 I-1.879576 J2.360006
G03 X32.734910 Y24.047834 Z-0.125000 I-3.716685 J2.523728
G03 X33.032112 Y25.147861 Z-0.125000 I-6.637279 J2.383397
G03 X33.124167 Y26.151118 Z-0.125000 I-5.420934 J1.003257
G01 X33.124167 Y26.151118 Z-0.125000
G00 Z5.000000

(End cutting path id: path1149)


(Start cutting path id: path1149)
(Change tool to Default tool)

G00 Z5.000000
G00 X32.864663 Y15.812668

G01 Z-0.125000 F100.0(Penetrate)
G03 X32.796369 Y16.705320 Z-0.125000 I-5.868025 J0.000000 F400.000000
G03 X32.640547 Y17.268787 Z-0.125000 I-2.473148 J-0.380649
G03 X32.348369 Y17.785995 Z-0.125000 I-2.016858 J-0.798222
G03 X31.838449 Y18.320430 Z-0.125000 I-2.666835 J-2.034021
G03 X31.327435 Y18.641787 Z-0.125000 I-1.338255 J-1.561082
G03 X30.623503 Y18.854340 Z-0.125000 I-1.227448 J-2.793135
G03 X29.888544 Y18.942406 Z-0.125000 I-1.154181 J-6.521405
G03 X28.582867 Y18.983773 Z-0.125000 I-1.305677 J-20.585311
G01 X25.032397 Y18.983773 Z-0.125000
G01 X23.487175 Y9.858755 Z-0.125000
G01 X26.707369 Y9.858755 Z-0.125000
G03 X28.268276 Y9.928002 Z-0.125000 I-0.000000 J17.626910
G03 X29.255215 Y10.085263 Z-0.125000 I-0.638615 J7.183386
G03 X30.195969 Y10.427251 Z-0.125000 I-1.099871 J4.490499
G03 X30.965573 Y10.926577 Z-0.125000 I-1.714045 J3.484589
G03 X31.756467 Y11.787616 Z-0.125000 I-2.586221 J3.169284
G03 X32.381043 Y12.997503 Z-0.125000 I-4.580361 J3.130658
G03 X32.739622 Y14.346270 Z-0.125000 I-7.317427 J2.667435
G03 X32.864663 Y15.812668 Z-0.125000 I-8.535946 J1.466398
G01 X32.864663 Y15.812668 Z-0.125000
G00 Z5.000000

(End cutting path id: path1149)


(Start cutting path id: path1147)
(Change tool to Default tool)

G00 Z5.000000
G00 X18.226345 Y7.237740

G01 Z-0.125000 F100.0(Penetrate)
G01 X15.855433 Y7.237740 Z-0.125000 F400.000000
G01 X15.265654 Y14.016787 Z-0.125000
G01 X7.692889 Y14.016787 Z-0.125000
G01 X4.814767 Y7.237740 Z-0.125000
G01 X2.349490 Y7.237740 Z-0.125000
G01 X12.800377 Y31.328433 Z-0.125000
G01 X15.890819 Y31.328433 Z-0.125000
G01 X18.226345 Y7.237740 Z-0.125000
G00 Z5.000000

(End cutting path id: path1147)


(Start cutting path id: path1147)
(Change tool to Default tool)

G00 Z5.000000
G00 X15.006151 Y16.637802

G01 Z-0.125000 F100.0(Penetrate)
G01 X13.909162 Y28.529447 Z-0.125000 F400.000000
G01 X8.813470 Y16.637802 Z-0.125000
G01 X15.006151 Y16.637802 Z-0.125000
G00 Z5.000000

(End cutting path id: path1147)


(Footer)
M5
G00 X0.0000 Y0.0000
M2
(Using default footer. To add your own footer create file "footer" in the output dir.)
(end)
%
我们注意到这个里面抬和落是用了X轴实现。关键语句是:
Z-0.125000

G00 Z5.000000
我们知道控制电机的指令头是G01 ,然后跟 X Y Z 坐标
然后Z有单独的G00 Z5.000000
代表Z向上运动5mm。也就是如果你的笔或者钻头在Z轴是没问题的。而这里我们采用的是舵机(伺服电机)控制抬笔落笔。参考下一个
%
(Header)
(Generated by gcodetools from Inkscape.)
(Using default header. To add your own header create file "header" in the output dir.)
M3
(Header end.)
G21 (All units in mm)

(Start cutting path id: path1149)
(Change tool to Default tool)

M05
G00 X32.616958 Y9.179233

G01 M03 S090 F100.0(Penetrate)
G02 X31.398997 Y8.249185 M03 S090 I-5.697745 J6.199062 F400.000000
G02 X30.222453 Y7.674576 M03 S090 I-3.270410 J5.204517
G02 X28.950483 Y7.365278 M03 S090 I-2.215732 J6.341968
G02 X27.143806 Y7.237740 M03 S090 I-1.806677 J12.732749
G01 X20.691622 Y7.237740 M03 S090
G01 X24.737507 Y31.328433 M03 S090
G01 X29.786017 Y31.328433 M03 S090
G02 X31.703047 Y31.268731 M03 S090 I-0.000000 J-30.807603
G02 X32.640547 Y31.150462 M03 S090 I-0.465318 J-7.463396
G02 X33.530684 Y30.858825 M03 S090 I-0.668540 J-3.544781
G02 X34.362701 Y30.325328 M03 S090 I-1.735392 J-3.621969
G02 X34.918594 Y29.710115 M03 S090 I-2.025969 J-2.389375
G02 X35.329940 Y28.917745 M03 S090 I-2.993269 J-2.056865
G02 X35.571271 Y28.059598 M03 S090 I-4.158120 J-1.632369
G02 X35.660218 Y27.040969 M03 S090 I-5.788274 J-1.018629
G02 X35.426627 Y25.012672 M03 S090 I-8.922779 J0.000000
G02 X34.799141 Y23.352132 M03 S090 I-6.568413 J1.533249
G02 X33.758826 Y21.924695 M03 S090 I-5.715355 J3.072540
G02 X32.416432 Y20.876728 M03 S090 I-4.346005 J4.183264
G01 X32.416432 Y20.747296 M03 S090
G02 X33.672239 Y20.103596 M03 S090 I-1.199698 J-3.887356
G02 X34.575021 Y19.113205 M03 S090 I-2.214429 J-2.925201
G02 X35.110535 Y17.852555 M03 S090 I-3.616356 J-2.280265
G02 X35.329940 Y16.039175 M03 S090 I-7.384088 J-1.813380
G02 X35.136510 Y14.022482 M03 S090 I-10.609675 J0.000000
G02 X34.575021 Y12.140010 M03 S090 I-9.793233 J1.896071
G02 X33.669960 Y10.423342 M03 S090 I-9.084011 J3.692354
G02 X32.616958 Y9.179233 M03 S090 I-5.769490 J3.815563
G01 X32.616958 Y9.179233 M03 S090
M05

(End cutting path id: path1149)


(Start cutting path id: path1149)
(Change tool to Default tool)

M05
G00 X33.124167 Y26.151118

G01 M03 S090 F100.0(Penetrate)
G03 X33.074843 Y26.821629 M03 S090 I-4.582118 J-0.000000 F400.000000
G03 X32.959030 Y27.267476 M03 S090 I-2.127850 J-0.314761
G03 X32.750205 Y27.691846 M03 S090 I-2.066418 J-0.753287
G03 X32.487205 Y28.011716 M03 S090 I-1.424023 J-0.902787
G03 X31.946381 Y28.369751 M03 S090 I-1.409040 J-1.540919
G03 X31.248667 Y28.577984 M03 S090 I-1.094174 J-2.393169
G03 X30.502129 Y28.667873 M03 S090 I-1.226720 J-7.043051
G03 X29.325989 Y28.707417 M03 S090 I-1.176140 J-17.471160
G01 X26.660187 Y28.707417 M03 S090
G01 X25.457038 Y21.556251 M03 S090
G01 X28.523889 Y21.556251 M03 S090
G03 X29.531336 Y21.611359 M03 S090 I-0.000000 J9.236262
G03 X30.293226 Y21.750400 M03 S090 I-0.593598 J5.409630
G03 X31.015771 Y22.025353 M03 S090 I-1.130553 J4.057826
G03 X31.614334 Y22.397565 M03 S090 I-1.540410 J3.144559
G03 X32.230744 Y23.062729 M03 S090 I-1.879576 J2.360006
G03 X32.734910 Y24.047834 M03 S090 I-3.716685 J2.523728
G03 X33.032112 Y25.147861 M03 S090 I-6.637279 J2.383397
G03 X33.124167 Y26.151118 M03 S090 I-5.420934 J1.003257
G01 X33.124167 Y26.151118 M03 S090
M05

(End cutting path id: path1149)


(Start cutting path id: path1149)
(Change tool to Default tool)

M05
G00 X32.864663 Y15.812668

G01 M03 S090 F100.0(Penetrate)
G03 X32.796369 Y16.705320 M03 S090 I-5.868025 J0.000000 F400.000000
G03 X32.640547 Y17.268787 M03 S090 I-2.473148 J-0.380649
G03 X32.348369 Y17.785995 M03 S090 I-2.016858 J-0.798222
G03 X31.838449 Y18.320430 M03 S090 I-2.666835 J-2.034021
G03 X31.327435 Y18.641787 M03 S090 I-1.338255 J-1.561082
G03 X30.623503 Y18.854340 M03 S090 I-1.227448 J-2.793135
G03 X29.888544 Y18.942406 M03 S090 I-1.154181 J-6.521405
G03 X28.582867 Y18.983773 M03 S090 I-1.305677 J-20.585311
G01 X25.032397 Y18.983773 M03 S090
G01 X23.487175 Y9.858755 M03 S090
G01 X26.707369 Y9.858755 M03 S090
G03 X28.268276 Y9.928002 M03 S090 I-0.000000 J17.626910
G03 X29.255215 Y10.085263 M03 S090 I-0.638615 J7.183386
G03 X30.195969 Y10.427251 M03 S090 I-1.099871 J4.490499
G03 X30.965573 Y10.926577 M03 S090 I-1.714045 J3.484589
G03 X31.756467 Y11.787616 M03 S090 I-2.586221 J3.169284
G03 X32.381043 Y12.997503 M03 S090 I-4.580361 J3.130658
G03 X32.739622 Y14.346270 M03 S090 I-7.317427 J2.667435
G03 X32.864663 Y15.812668 M03 S090 I-8.535946 J1.466398
G01 X32.864663 Y15.812668 M03 S090
M05

(End cutting path id: path1149)


(Start cutting path id: path1147)
(Change tool to Default tool)

M05
G00 X18.226345 Y7.237740

G01 M03 S090 F100.0(Penetrate)
G01 X15.855433 Y7.237740 M03 S090 F400.000000
G01 X15.265654 Y14.016787 M03 S090
G01 X7.692889 Y14.016787 M03 S090
G01 X4.814767 Y7.237740 M03 S090
G01 X2.349490 Y7.237740 M03 S090
G01 X12.800377 Y31.328433 M03 S090
G01 X15.890819 Y31.328433 M03 S090
G01 X18.226345 Y7.237740 M03 S090
M05

(End cutting path id: path1147)


(Start cutting path id: path1147)
(Change tool to Default tool)

M05
G00 X15.006151 Y16.637802

G01 M03 S090 F100.0(Penetrate)
G01 X13.909162 Y28.529447 M03 S090 F400.000000
G01 X8.813470 Y16.637802 M03 S090
G01 X15.006151 Y16.637802 M03 S090
M05

(End cutting path id: path1147)


(Footer)
M5
G00 X0.0000 Y0.0000
M2
(Using default footer. To add your own footer create file "footer" in the output dir.)
(end)
%
这里用M5代表抬笔,也就是让舵机复位。
用M03 Sxxx   xxx表示从000到255的数字,代表从0度到180度的舵机旋转量。
这里我设的是M03 S090

使用特权

评论回复

相关帖子

沙发
gaoyang9992006|  楼主 | 2018-8-4 16:03 | 只看该作者
方法是用查找替换法就可以转换成舵机识别的码。。或者使用微雕管家软件,也可以自动解析成M03和M5指令。

使用特权

评论回复
发新帖
您需要登录后才可以回帖 登录 | 注册

本版积分规则

认证:西安公路研究院南京院
简介:主要工作从事监控网络与通信网络设计,以及从事基于嵌入式的通信与控制设备研发。擅长单片机嵌入式系统物联网设备开发,音频功放电路开发。

1954

主题

15896

帖子

207

粉丝