version (version 1.4.1, 18 August 2004)
index
m:\projects\genesis-python\1.4.1\version.py

Modules for joining Genesis 2000 scripting and the Python scripting language.
 
This module exists to help document the Genesis 2000 --> Python Interface.
Much of the documentation does not fit well with the individual module documentation,
thus it ends up here.

 
Modules
       
genBasic
genClasses
genCommands
genFeatures
genPersist

 
Classes
       
FAQ
Release_Notes
Tips
Usage

 
class FAQ
    1. What is the license of the Genesis-Python Interface?
   The license under which the Genesis-Python object interface is released is the LGPL,
   or GNU Lesser General Public License.  You can read details here:
   http://www.gnu.org/copyleft/lesser.html  but basically it is free for you to use, copy, etc.
   If you would like to be added to the developers list, or would like to contribute code,
   contact Mike Hopkins --> mike@solidigm.com
 
2. What is the best graphical toolkit to use with the Genesis-Python interface?
   IMHO, wxPython is the best graphical toolkit to use.  Future releases of the
   Genesis-Python interface will utilize wxPython for certain optional features.
 
  Methods defined here:
__init__(self)
__repr__(self)

 
class Release_Notes
    1.4.1 - Added getRowColor method to the Matrix class, to provide Genesis 
        Matrix-like colors.  Provides either a rgb tuple or hex string
        to describe color.
      - Added getColor method to Layer class, along with corresponding hook 
        to self.color attribute.  Provides either a rgb tuple or hex string
        to describe color.
      - Added setGenesisAttr methods to Step and Layer commands to allow for
        setting of attributes simultaneously in the Genesis database and
        the local in-memory object model.
      - Modified the Job.setGenesisAttr() method to automatically update the
        local python object's attribute value along with running the 
        Genesis line-mode command.
      - Added general persistency engine.  Python objects may now be stored in
        the Genesis job's misc directory (called the "bucket"), and accessed via
        their names using the job.bucket.put() and job.bucket.get() methods.  This
        engine supports XML as well as standard cPickle data format.
      - Added the version.py module as an experiment in documentation...
      - Added genBasic.py module to provide BASIC Genesis call functionality.
        
1.4.0 - Added three of my programs to the examples directory.
      - To Step class, added mergeLayers method to merge two selected layers.
      - To Step class, added feature methods:
                addPad, addLine, addArc, addText, addRectangle
      - To Step class, added rout methods:
                addRoutChain, setChainPlunge, routCopy (copy rout layer to
        other layer)
      - To Layer class, added method returnRows, which is very similar to the
        filter commands used in checklist/action parameters.  You can specify
        context, type, polarity, etc using the or operator as well:
                returnRows(context='board|misc', side='top|bottom), etc...
      - Added polarity method to Layer class.  Returns polarity of the layer.
      - Changed a few internal workings of the genFeatures module.  Functionality
        should be the same.
      - Added methods to set attributes, which can then be applied to added
        features.  This is in the step class.  Method resetAttr resets the 
        attribute list.  Method addAttr adds an attribute to the attribute list
        Now when a features is added with attributes='yes' specified, the 
        attributes you add using this method will be assigned to the new 
        feature.
      - Added option to Job class, importForm method to specify a new formname
        if you want to rename the form when copying it into the job from the
        library
      - Made changes to Form class. Added methods to delete a form, write to 
        a field, change element colors, visibility, sensitivity.        
      - Changed convertToNumber method in Genesis class to not convert strings
        with leading zeroes to a number, unless it has a decimal after the
        zero.
        
1.3.0 - Kind of an overhaul.  Some backwards compatibility may be lost in a
        couple functions.  Changed genClasses to subclass classes from the
        other modules instead of instantitate them.
      - lots of new features that I forgot to put in here
      - added documentation
      
1.1.8 - added getRow, getRowInfo methods to matrix class
        Added work,affect,unaffect methods to Layer class
        
1.1.7 - Added missing commands in genCommands.py module to Step and Job
        classes.  Expanded functionality of several classes
        Documentation needs updating... sometime this will actually happen
        
1.1.6 - Added genFeatures.py module.
      - Fixed bug in Matrix.info() method.  Forcing 
        Matrix.info['gROWname'] to strings.
      - Added shortcut for __members__ and __methods__ 
        attributes, so objects can more easily support dir()
        
1.1.5 - Added dynamically loaded genCommands module to Job, Step, matrix 
        and Layer class definitions.  This module encapsulates 
        all the Genesis Commands...
      - Implemented genClasses._deleteAttribute method for Genesis 
        (Job,Step,Matrix,Form are subclasses) and Layer.  Checks
        to verify the attribute exists before removing.
      - Implemented individual genClasses._forceRefresh method for
        Job, Step, Matrix, Layer objects.  This removes all
        attributes which are likely to change.  Thus, when the 
        attributes are next accessed, they are dynamically re-
        created.  This method offers the advantage of not refreshing 
        the attribute until it is needed.
      - genCommands module is implementing selective refresh of certain
        attributes.  Thus if Step.createLayer() is called, it calls a
        _forceMatrixRefresh() method which deletes the genClasses.Step
        object's info and layers attributes, and job.matrix attribute.
        Thus, when the attributes are next accessed, they are dynamically
        re-created.  This method offers the advantage of not refreshing the
        attribute until it is needed.
      - Added ExtraStuff class designed to allow multiple-inheritence for
        several of the classes.  Designed strictly to be subclassed.
        Currently implements the getGenesisAttr() method...
      - Changed the structure of header info (_header --> _HEADER)
      
1.1.4 - Fixed bugs in Step.resetFilter() and Step.selectDelete() methods.
      - Added MatrixCellInfo class to describe the matrix info of a layer.
      - Added cell attribute to Layer class which dynamically creates a
        MatrixCellInfo object.
      - Overhauled the documentation, adding cross-linking, and
        modularity; for ease of maintenance.
        
1.1.3 - Added __getattr__ hook to Step object.
      - Added Layer class, and getLayer() method to Step class
      - Added getGenesisAttr() methods, bound to call of any
        unspecified attribute.  Looks for Genesis attributes
        in Job, Step, Layer.
      - Added setGenesisAttr() method.
      - Added profile attribute to Step object.
      - Added sr object to Step object.
      
1.1.2 - Added overloaded COM method to step object, to automatically
        set the group prior to execution.
 
  Methods defined here:
__init__(self)
__repr__(self)

 
class Tips
    There are alot of time-saving data structures embedded in the Genesis-Python interface.
 
For example, the Step object defines a profile object which automatically has all the
information you could want to know about the profile.  Of course it defines xmin, ymin,
xmax and ymax, but it also defines xsize, ysize, xcenter and ycenter.  So to get the top,
center of a panel, you could simply reference (step.profile.xcenter,step.profile.ymax)
without any additional work.  This object is automatically created by the Step.getProfile 
method, when the step.profile attribute is first accessed.
 
Another interesting data structure is the sr attribute of the Step object.  It is created
by the Step.getSr method when the step.sr attribute is first accessed.  This object defines
the enclosingbox of the step and repeat (using step.sr.xmin,ymin,xmax,ymax).  It also defines
the borders, or space between the enclosingbox of the stepped images and the panel edge.  
These values can be useful when determining where to place coupons, etc.  They are available
through the step.sr.nBorder,sBorder,eBorder,wBorder (north,south,east,west...get it?)
The sr object also defines a table, which is technically a Python list object.  The 
step.sr.table is a list of objects which represent rows on the step and repeat table.  Each
of these objects defines attributes for step, xanchor, yanchor, xdist, ydist, xnum, ynum, 
angle, mirror, xmin, xmax, ymin, ymax.  Thus, we can access a row of the step and repeat table:
 
>>> row = 3
>>> print step.sr.table[row].xnum
2
 
  Methods defined here:
__init__(self)
__repr__(self)

 
class Usage
    Using the genClasses.py module is fairly straightforward.
It is intended to be as easy to use as possible.  
        
        The only class which needs to be manually instantiated
is the Job class.  This class definition serves as the base class
for subsequent Python automation in Genesis.  We would instantiate
a Job object for a job we plan to work with:
 
job = genClasses.Job('test_job')
job.open(1) # Open the job, check it out as well.
 
        Now, calls to the steps or matrix attribute will 
automatically gather the information about the Genesis objects,
and create Python objects mapped to them.
 
 
 
print job.matrix.info['gROWname']
>>> ['tss', 'tsm', 'cs', 'l2', 'l3', 'ps', 'bsm', 'bss', 'drl']
 
 
        We can open a step in the job, by calling the open method
of an individual step object.  The step objects are stored as
values in the job.steps dictionary.  The keys to the dictionary
are the step names.  We can access the objects directly, or it
may be more convenient to create a variable which references the object.
 
 
 
job.steps['panel'].open()  # Direct access
pcb = job.steps['pcb']     # Create a var referencing the step
pcb.open()
 
 
 
        The step objects themselves retain their group numbers, so
that detail is hidden from us.  Also, since every object derives
from the Genesis class, we can call the low-level methods from that
class.
 
pcb.COM('zoom_home')
job.steps['panel'].COM('zoom_home')
 
        Some functions have been built in to the object models,
for example selectRectangle and selectDelete are built in to the
step object.
 
 
pcb.selectRectangle(1.1, 0.0, 2.3, 5.3)
pcb.selectDelete()
 
 
 
        The objects attempt to hide as many details as possible
from the user to avoid complicated code.  For example, the Genesis
class includes a __del__ method, which hooks into the Python garbage
collection system.  The __del__ method deletes all temp files created 
during usage, whenever the object is dereferenced, deleted, or goes 
out of scope.  In this way, the user never needs to worry about the
temp files.
        Many of the attributes (including Job.steps, Job.matrix, Matrix.info)
are not created until they are needed the first time.  In this way, 
we save quite a bit of overhead on the initial instantiation.  For
example, when we create the job object, there is technically no matrix
attribute.  But when we call the matrix attribute, it is created.  That
matrix attribute still has no Matrix.info attribute, but when we make a
call to that, the Matrix object runs the info command, and populates
the Matrix.info attribute.  This behaviour is designed to be transparent
to the user, but it may be important to know if one wishes to sub-class
based on these classes.
 
  Methods defined here:
__init__(self)
__repr__(self)

 
Data
        __author__ = 'Mike J. Hopkins'
__credits__ = ' Mike J. Hopkins '
__date__ = '18 August 2004'
__version__ = '$Revision: 1.4.1 $'

 
Author
        Mike J. Hopkins

 
Credits
         Mike J. Hopkins