生成录制文件SCR,运行并删除录制文件SCR
本帖最后由 xieeyawen 于 2025-2-18 14:50 编辑(setq out (outfile "./update_nclegend.scr")) ;打开端口,创建一个更新钻孔表的scr文件在当前的工作目录,令这个文件赋给out
;配置钻孔表
(fprintf out strcat("version " substring((axlGetVariable "cdsversion") 1 4) "\n")) ;得到结果"version 16.6\n"字符串赋给scr。
;axlGetVariable "cdsversion" => 16.6-2015
;substring((axlGetVariable "cdsversion") 1 4) => 16.6
;strcat("version " substring((axlGetVariable "cdsversion") 1 4) "\n") =>"version 16.6\n"
(fprintf out "ncdrill customization\n") ;打开软件上的Manufacture里的NC里的Drill Customization...
(fprintf out "setwindow form.nc_drillcustomization\n") ;打开了Drill Customization的界面
(fprintf out "FORM nc_drillcustomization auto_symbols\n") ;点开了Auto generate symbols按钮
(fprintf out "fillin yes\n") ;选择了yes(您真的想自动生成钻孔/槽孔符号吗)
(fprintf out "FORM nc_drillcustomization done\n") ;Drill Customization的界面配置确认
(fprintf out "fillin yes\n") ;选择yes完成配置
(fprintf out "setwindow pcb\n") ;自动进入PCB界面
(fprintf out "ncdrill legend \n") ;打开软件上的Manufacture里的NC里的Drill Legend...
(fprintf out "setwindow form.nc_drilllegend\n");打开了Drill Customization的界面
(fprintf out "FORM nc_drilllegend backdrill_legends YES \n") ;在Drill Legend界面里选择勾选Include backdrill
;FORM nc_drilllegend library 是打开library
;fillin "default-mm" 选择输出按照mm单位,可以和后面的单位判断进行升级修改
(fprintf out "FORM nc_drilllegend done\n") ;点击ok配置完成
(case (car (axlDBGetDesignUnits))
("mils" (fprintf out (sprintf nil "pick %L %L\n" (plus x_coordinates 600) y_coordinates)))
("millimeters" (fprintf out (sprintf nil "pick %L %L\n" (plus x_coordinates 15) y_coordinates)))
);根据设计单位,输出
;配置xsectionChart
(fprintf out "xsection_chart\n");
(fprintf out "setwindow form.xsectionChart\n");
(fprintf out "FORM xsectionChart layer_name YES\n");
(fprintf out "FORM xsectionChart layer_name YES\n");
(fprintf out "FORM xsectionChart drill_label YES\n");
(fprintf out "FORM xsectionChart layer_thickness YES\n");
(fprintf out "FORM xsectionChart xsectionchart_ok\n");
(case (car (axlDBGetDesignUnits))
("mils" (fprintf out (sprintf nil "pick %L %L\n" (plus x_coordinates 1200) y_coordinates)))
("millimeters" (fprintf out (sprintf nil "pick %L %L\n" (plus x_coordinates 30) y_coordinates)))
);根据设计单位,输出
(close out);关闭端口
(axlShell "scriptmode +invisible +noinfo;replay update_nclegend.scr")
;脚本文件的运行模式(scriptmode)不提示错误信息(+noerrors),不弹出确认对画框(+invisible),不提示信息(+noinfo)
;运行update_nclegend.scr
(deleteFile "update_nclegend.scr") ;删除生成的scr文件
(axlUIConfirm "NC-Legend\322\321\270\374\320\302\243\241");弹窗出:NC-Legend已生成!
请教一下高手,如何每次生成scr放置钻孔表和xsectionChart不要改变位置呢 另外SCR代码有个简单的方法获取,就是自己录制需要的SCR文件,并用记事本打开这个SCR文件,这些就是代码,按照上面模式就能得到任意的SCR文件 环境变量的获取:axlGetVariable(nil)
页:
[1]