首页 SKILL 简明教程

SKILL 简明教程

举报
开通vip

SKILL 简明教程Allegro PCB Design SKILL Tutorial SKILL is a scripting language what has its base in Lisp. Using the scription language you can automate a lot of repetitive commmand that will otherwise take a lot of time to do manually. The SKILL language has similarity wit...

SKILL 简明教程
Allegro PCB Design SKILL Tutorial SKILL is a scripting language what has its base in Lisp. Using the scription language you can automate a lot of repetitive commmand that will otherwise take a lot of time to do manually. The SKILL language has similarity with conventional C-like syntax. The simplicity of the language allows you to quickly learn the language. If tremendously helps if you are familar with any of the programming language like C or javascript. We will not go into the details of the programming language itself ( except for mentioning in brief about it). Instead, we will focus of working examples of SKILL. Getting Started To start directly executing the script, you type skill at the command window and press enter. It will give you a skill promt. You can then start typing the scripts and it will get executed. As an example to concatenate the strings and give output you can do with Command>skill Skill> strcat("skill " "programming is fun") You can also use variables, for loop and many other language contruct. Here is an example the will print "Hello" thrice Skill>for( i 1 3 print( "hello" )) Skill>Hello Hello Hello To exit from the Skill just type exit Skill> exit Command>skill Of course we have not done anything useful. We have just enured that out environment is good to execute skill scripts. In next few pages, we will be writing real codes to do something useful. In the previous tutorial we gave the commands in a command line and saw the results in a command line window. It is possible to put all the commands in a file ( typically with extension .il) and then load the file from the command line. Let us say the content lf the file hello.il is for( i 1 3 print( "hello" )) If you save the file in the same directory as your allegro brd file, then you can give the following command that will run the contents of this file. Commans > skill load("hello.il") This will run the contents of the hello.il However, it is not advisable to keep a copy in the local path, instead, you may like to follow the following steps 1. Create a directory c:\cadence\setup\skill 2. Create a new environment variable called ALLEGRO_PCBENV ControlPanel->System->Advanced->Environment Variables->System->New Name this ALLEGRO_PCBENV and Value=C:\cadence\setup 3. Create a file called allegro.ilinit file and paste the following content in that file setSkillPath(buildString(append1(getSkillPath() "c:/Cadence/setup/skill" ))) foreach(dir getSkillPath() when(isDir(dir) foreach(file rexMatchList("\\.il$" getDirFiles(dir)) when( printf("Loading Skill file: %s\n" file) load(file) ) ) ) ) This il init file will load all the il files in the directory c:\cadence\setup\skill. 4. Restart the computer ( This is required, so that the environment variables take affect. 5. Now keep any .il file that you wish to run in the c:\cadence\setup\skill directory. As a test, if you place the hello.il file in the above example you will see that it prints Hello, Hello, Hello in the command line Let us now look at a real, practical and useful skill utility that solves real world problem. Copy the following code in a file called moveByRefdes.il and save it in the directory C:/cadence/setup/skill (or the directory that allegro.ilinit points to). axlCmdRegister("moveByRefdes", 'moveByRefdes, ?cmdType "general") defun( moveByRefdes (refdes) let((sym, popup, alias_m, alias_r, ang, (dAng 0), dMir, mir, pt, mark, (continue t), event) sym = car(axlSelectByName("SYMBOL", refdes)) if(sym then popup = axlUIPopupDefine(nil '( ("Done", "axlDBTransactionCommit(mark), axlFinishEnterFun()") ("Oops", "axlDBTransactionOops(mark)") ("Cancel", "axlDBTransactionRollback(mark), axlCancelEnterFun()") ("MENU_SEPARATOR", nil) ("Mirror", "(moveByRefdes_mirror)") ("Rotate", "(moveByRefdes_rotate)") )) axlUICmdPopupSet(popup) alias_m = axlGetAlias("m") alias_r = axlGetAlias("r") axlShell("funckey m \"(moveByRefdes_mirror)\"") axlShell("funckey r \"(moveByRefdes_rotate)\"") mark = axlDBTransactionStart() ang = round(sym ->rotation) mir = sym ->isMirrored axlDynamicsObject(sym, sym ->xy) ;Add rats: foreach(pin, sym ->pins pt = list(car(pin ->xy) - car(sym ->xy), cadr(pin ->xy) - cadr(sym ->xy)) foreach(ratPin, mapcar(lambda((objPair), car(remove(pin, objPair))), setof(objPair, _fputilGetNetRats(pin), member(pin, objPair))) axlAddSimpleRbandDynamics(ratPin ->xy, "directline", ?origin pt, ?var_point pt ?color 'ratsnestColor) ) ) while(continue event = axlEnterEvent(list('PICK), nil, t) caseq(event ->type (PICK sym = car(axlSelectByName("SYMBOL", refdes)) axlDBTransactionMark(mark) axlClearSelSet() axlDeleteObject(sym) sym = car(axlDBCreateSymbol(refdes, event ->xySnap, mir, ang)) ) (DONE, continue = nil) (CANCEL, continue = nil)
本文档为【SKILL 简明教程】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_435706
暂无简介~
格式:doc
大小:22KB
软件:Word
页数:0
分类:互联网
上传时间:2019-07-19
浏览量:19