Allegro PCB Design SKILL Tutorial

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 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)")
    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)
      event = axlEnterEvent(list('PICK), nil, t)
      caseq(event ->type
	  sym = car(axlSelectByName("SYMBOL", refdes))
	  sym = car(axlDBCreateSymbol(refdes, event ->xySnap, mir, ang))
	(DONE, continue = nil)
	(CANCEL, continue = nil)
      ); caseq
    ); while continue
    axlSetAlias("m", alias_m)
    axlSetAlias("r", alias_r)
   else axlMsgPut(list("Reference Designator %s not found", 3), refdes || "*** Not supplied ***")
  );if sym

defun( moveByRefdes_mirror ()
  mir = !mir, dMir = !dMir
  ang = mod(-ang, 360), dAng = mod(-dAng, 360)
  _axlSetDynamicsMirror(dMir), _axlSetDynamicsRotation(dAng)

defun( moveByRefdes_rotate ()
  ang = mod(ang + if(mir, -90, 90), 360), dAng = mod(dAng + if(mir, -90, 90), 360)

What does this skill code do

When the skill command is given ( with the reference designation), it will move the required component.

How to use it

To use is give the following command

MoveByRefdes R1

Where R1 is the reference designation of the component you wish to move.

Here is the youtube that shows the things in action