1 Reply Latest reply on Dec 13, 2010 2:06 PM by Mike_Walsh

    How to create a Library Cell using Automation?

    jonah.faust

      Ok - I tried to use our encryptdecrypt license with EE7.9 to create a new cell and it was looking for a decrypt only license.  I logged an SR and was pointed here.  After reading a little, I see I need to start converting over to using automation for this...

      I need to create a 942 pin bga cell with a non-uniform grid.  I have the coordinates for each ball in a spreadsheet.

      Can someone get me started on writing a script to do this?  This is going to be quick and painless, right?  From all the talk about automation, it's going to be much faster and easier than doing this via hkp... 

      Thanks in advance.

        • 1. Re: How to create a Library Cell using Automation?
          Mike_Walsh

          I've been working on a script with one of my customers that might help you out.  Unfortunately I cannot share the entire script.  That said, but here is a fragment around generating a cell that might help you out with your project.  This code is written in Tcl so you'll have to use it as a guide (unless you want to run Tcl[1]).  You should be able to pick up the gist of this flow from the comments and the code.  There are a few references to procedures and namespace variables that aren't shown below, hopefully you'll be able to determine what they do from their names.  In this example, the locations of the padstacks are stored in a Tcl array and then placed using Pin.Place.

           

              ##  Build a new cell.  The first part of this is done in
              ##  in the Cell Editor which is part of the Library Manager.
              ##  The graphics and pins are then added using the Cell Editor
              ##  AddIn which sort of looks like a mini version of Expediiton.
          
              set newCell [$partition NewCell [expr $::CellEditorAddinLib::ECellDBCellType(ecelldbCellTypePackage)]]
          
              $newCell -set Name $::BGAName(name)
              $newCell -set Description $::BGAName(name)
              $newCell -set MountType [expr $::CellEditorAddinLib::ECellDBMountType(ecelldbMountTypeSurface)]
              $newCell -set PinCount [expr $::BGAPads(count)]
              $newCell -set Units [expr $::CellEditorAddinLib::ECellDBUnit(ecelldbUnitUM)]
              $newCell -set PackageGroup [expr $::CellEditorAddinLib::ECellDBPackageGroup(ecelldbPackageGeneral)]
              ##  Commit the cell to the database so it can
              ##  be edited using the Cell Editor AddIn.
              
              $newCell Commit
          
              ##  Put the Cell in "Graphical Edit" mode
              ##  to add the pins and graphics.
          
              ##  Invoke the Padstack Editor and open the target
              ##  Catch any exceptions raised by opening the database
              set errorCode [catch { ediuOpenPadstackEditor -dontopendatabase } errorMessage]
              if {$errorCode != 0} {
                  ediuUpdateStatus $::ediu(ready)
                  return
              }
          
              ##  Open the Cell Editor and turn off prompting
          
              set cellEditor [$newCell Edit]
              set cellEditorDoc [$cellEditor Application]
              [$cellEditorDoc Gui] SuppressTrivialDialogs True
              
              ##  Need the Component Document to it can be edited.
              ##  When using the Cell Editor Addin, the component will
              ##  always be the first Item.
          
              set components [$cellEditor Components]
              set component [$components Item 1]
              
              ##  Add the pins
              
              #  Does the pad exist?
              
              set padstack [$::ediu(pdstkEdtrDb) FindPadstack $::padGeom(name)]
              
              #  Echo some information about what will happen.
              
              if {$padstack == $::ediu(Nothing)} {
                  Transcript $::ediu(MsgError) \
                      [format "Reference Padstack \"%s\" does not exist, build aborted." $::padGeom(name)]
                  $cellEditor Close False
          
                  if { $::ediu(mode) == $::ediu(designMode) } {
                      ediuClosePadstackEditor -dontclosedatabase
                  } else {
                      ediuClosePadstackEditor
                  }
                  ediuCloseCellEditor
          
                  ediuUpdateStatus $::ediu(ready)
                  return
              }
              
              ##  Need to "Put" the padstack so it can be
              ##  referenced by the Cell Editor Add Pin process.
          
              set padstack [$cellEditor PutPadstack [expr 1] [expr 1] $::padGeom(name)]
                  
              set i 1
          
              set pins [$cellEditor Pins]
          
              ##  Loop over the collection of pins
              ::tcom::foreach pin $pins {
          
                  ##  Split of the fields extracted from the BGA file
          
                  set dpltf [split $::BGAPads($i)]
                  set BGAPadFields(pin) [lindex $dpltf 0]
                  set BGAPadFields(padname) [lindex $dpltf 1]
                  set BGAPadFields(padx) [expr -1 * [lindex $dpltf 2]]
                  set BGAPadFields(pady) [lindex $dpltf 3]
              
                  Transcript $::ediu(MsgNote) [format "Placing pin \"%s\" using padstack \"%s\"." \
                      $BGAPadFields(pin) $BGAPadFields(padname)]
          
                  $pin CurrentPadstack $padstack
                  $pin Place [expr $BGAPadFields(padx)] [expr $BGAPadFields(pady)] [expr 0]
          
                  incr i
              }
          
              ## Define the placement outline
              
              set x2 [expr $::BGASize(width) / 2]
              set x1 [expr -1 * $x2]
              set y2 [expr $::BGASize(height) / 2]
              set y1 [expr -1 * $y2]
          
              ##  PutPlacementOutline expects a Points Array which isn't easily
              ##  passed via Tcl.  Use the Utility object to create a Points Array
              ##  Object Rectangle.  A rectangle will have 5 points in the points
              ##  array - 5 is passed as the number of points to PutPlacemetOutline.
          
              set ptsArray [[$cellEditorDoc Utility] CreateRectXYR $x1 $y1 $x2 $y2]
          
              ##  Add the Placment Outline
              $cellEditor PutPlacementOutline [expr $::MGCPCB::EPcbSide(epcbSideMount)] 5 $ptsArray \
                  [expr 0] [expr 0] $component [expr $::CellEditorAddinLib::ECellDBUnit(ecelldbUnitUM)]
          
              ##  Save edits and close the Cell Editor
              Transcript $::ediu(MsgNote) [format "Saving new cell \"%s\"." $::BGAName(name)]
              $cellEditor Save
              Transcript $::ediu(MsgNote) [format "New cell \"%s\" saved." $::BGAName(name)]
              $cellEditor Close False
          
          

          I hope to generate an example I can publish soon from this project.  Feel free to post questions if anything above isn't clear.

           

          Mike

           

          [1] - I prefer Tcl as an automation language.  There are some nuances to work through to pass enumerated types through the Tcom interface (e.g. you'll see many of the enumerated constants wrapped in the Tcl [expr ] syntax above) but once you understand them, it isn't really much different than working with VBscript.

          1 of 1 people found this helpful