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

Modules for joining Genesis 2000 scripting and the Python scripting language.
 
NEED: genClasses.py and genFeatures.py
 
THIS MODULE *REQUIRES* ITSELF TO BE EMBEDDED IN CLASSES FROM THE genClasses.py MODULE
IT WILL NOT WORK ON ITS OWN!!!
 
This module is a companion to the genClasses module.  It provides added command
functionality over and above the basic Genesis commands.  This module holds several
classes that subclass into classes in the genClasses module, containing most commands
that can be executed in each class.

 
Modules
       
os
string

 
Classes
       
JobCmds
LayerCmds
MatrixCmds
StepCmds

 
class JobCmds
    This class defines commands which will be invoked by a job.  It is added
to the job class.
 
  Methods defined here:
addStep(self, name)
Add a step to the job.
name - name of new step
checkin(self)
Not implemented yet.
checkout(self)
Not implemented yet.
close(self, unlock)
Close job represented by this class.
unlock - if > 1, checks in/unlocks the job
importForm(self, formName, newFormName='')
Import a form into the job from genesislib.
formName - string containing name of form to import
open(self, lock)
Open the job, and checkout if so indicated
lock - integer: if > 1, job is checked out/locked
removeStep(self, name)
Remove a step from the job.
name - name of step to delete
save(self, override='no')
Save the job pointed to by the job class (job.name)
override (optional) defaults to no.  If set to yes, then overrides online violations
setGenesisAttr(self, name, value)
Set job attribute to a value, update Python attribute value.
name - string containing name of attribute
value - string/int/float containing value of attribute
  NOTE:  Value may be cast to string upon retreival

 
class LayerCmds
    Class containing layer commands - same as using right mouse button in Graphic editor.
These methods are run on layer objects, so there is no need to indicate which layer you
are working on
 
  Methods defined here:
affect(self)
Sets this layer to be affected
copy(self, dest_lay, mode='replace')
copies this layer to destination layer
dest_lay - name of destination layer
mode - replace or append defaults to replace
display(self, num=1)
Display layer in the editor
num - color number (defaults to 1)
featOut(self, fileName='')
Takes all the features on the layer, parses them, and returns them in a 
dictionary.  See Features.py module.
           fileName (optional) - name with path of filename if you don't want to use the
                                 default temp files
featSelOut(self, fileName='')
Takes all the Selected features, parses them, and returns them in a 
dictionary.  See Features.py module.
        filename - see featOut()
histogram(self)
Returns a dictionary of histogram information on the layer.  Returns key value pairs of 
all the histogram information.
polarity(self)
Returns the polarity of the layer
setGenesisAttr(self, name, value)
Set layer attribute to a value, update Python attribute value.
name - string containing name of attribute
value - string/int/float containing value of attribute
  NOTE:  Value may be cast to string upon retreival
unaffect(self)
Unaffects the layer
work(self)
Changes this to the work layer

 
class MatrixCmds
    Commands that are performed on a matrix through the matrix class
 
  Methods defined here:
addLayer(self, name, index, context='board', type='signal', polarity='positive')
Add a row /layer to the matrix
name - name of layer
index - row number to use
context - context of layer (default to board)
type - type of layer (default to signal)
polarity - polarity of layer (default to positive)
copyRow(self, name, newName, context='misc', newRow=3, overwrite=0)
Copy a row from one location to another in the matrix.  If newRow not indicated, copies
to the end of the matrix.
        name - name of row
        newName - name of new row
        context - context of new row (default to misc)
        newRow - number of new row if you need it to be in a certain place
        overwrite - overwrite row by same name as newName with this copy (defaults to 0)
deleteRow(self, name)
Delete a row from the matrix
name - name of row
modifyRow(self, currentName, row=0, name='', context='', type='', polarity='')
Change the attributes of a row.  You only need assign values for the things you want 
to change.  Be sure to use the key value pair in the parameters list.
           currentName - name of current row to modify.
           (optional below)
           row - new row (defaults to leaving it in same place (indicated by 0)
           name - new name
           context - new context
           type - new type
           polarity - new polarity
removeLayer(self, lay)
Remove a layer from the matrix
lay - name of layer
returnRows(self, context='', type='', polarity='', side='', names=1)
Return all the rows matching certain criteria. Defaults to returning names
can use '|' to separate multiple specs for each type (or)
       context (optional) - return with certain context
       type (optional) - return with certain type
       polarity (optional) - return with certain polarity
       side (optional) - return with certain side (top or bottom)
       names (optional) - defaults to 1, meaning names are returned. 0
                          means row numbers are returned

 
class StepCmds
    This class defines commands which will be invoked on/by a step.  methods are added
to the step class.
 
  Methods defined here:
addArc(self, xs, ys, xe, ye, xc, yc, symbol, direction, polarity='positive', attributes='no')
Add an arc to the selected layers in this step.  xs/ys - start, xe/ye - end, xc/yc, center
direction is 'CW' or 'CCW'.  All are mandatory except polarity, which defaults to pos, and 
attributes, defaulting to no.  NOTE: This is precise only to sixth decimal
addAttr(self, attr, attrVal='', valType='int')
Add attribute to attribute list
valType determines what attrVal should be
valType : default is 'int', also 'float', 'text', 'option'
addLine(self, xs, ys, xe, ye, symbol, polarity='positive', attributes='no')
Add a line to the selected layers in this step.  The arguments are self explanatory. 
All are mandatory except polarity, which defaults to pos, and attributes, defaulting to no.
NOTE: This is precise only to sixth decimal
addPad(self, x, y, symbol, polarity='positive', angle=0, mirror='no', nx=1, ny=1, dx=0, dy=0, xscale=1, yscale=1, attributes='no')
Add a pad to the selected layers in this step.  The arguments are self explanatory. 
All are optional except x, y, and symbol. NOTE: This is precise only to sixth decimal
Also remember that dx and dy are in mils(microns)
addRectangle(self, xs, ys, xe, ye, polarity='positive', attributes='no')
Add a rectangle to the selected layers in this step.  Need opposing
corners for this to work.  polarity defaults to positive, attributes to no.
NOTE: This is precise only to sixth decimal
addRoutChain(self, layer, size, compensation, feed, flag=0, speed=0, first=0, change_direction=-1)
Add selected features to a new rout chain.  This try rout chain 1, and if it fails,
to try adding the chain, incrementing the chain number, until success.  It only goes to 100.
Chain Number is returned.  If -1 returned, there was an error
        layer - layer to add rout chain to
        size (float) - size in inches for rout bit can be specified to 10th of mils only.
        compensation (str) - right, left, none
        feed (int) - feed rate
        flag (int) - default 0 - flag number
        speed (int) - default 0 - speed number
        first (int) - default 0 : -1 is not specified.  >0 is the first feature in chain. 0 is first of
                        selected features to be added to layer (by index number), on up)
        change_direction (int) - defaults to -1 - not sure what it is for.
addText(self, x, y, text, xSize, ySize, width, mirror='no', angle=0, polarity='positive', attributes='no')
Add text to the selected layers in this step.  x/y - text bottomleft corner (bottomright if mirror,
xSize, ySize is size in mil of text, width is line width in mil, mirror defaults to no, angle defaults to 0
but can be 0,90,180,270 -polarity defaults to positive, attributes defaults to no.  
NOTE: This is precise only to sixth decimal
affect(self, lay)
affect a layer in the graphic editor
lay - name of layer
affectFilter(self, filter)
Affect by filter in Graphic Editor
filter - string containing filter configuration
buffCopy(self)
Copy selected features to buffer
buffPaste(self, x=0, y=0)
Paste from buffer to x and y location indicated (defaults to origin)
clearAll(self)
Clears all the layers from editor window (turns everything off)
this means it clears and unaffects all layers, selections, and highlights
clearAndReset(self)
Clears any selections in the graphic editor and resets the filter
clearSel(self)
Clears selections from graphic editor
close(self)
Close the editor window
copyLayer(self, job, step, lay, dest_lay, mode='replace', invert='no')
Copy a layer from another location to current step
job - name of source job
step - name of source step
lay - name of source layer
dest_lay - name of destination layer (to be created)
mode (defaults to 'replace') - 'replace' to replace, 'append' to add to end of layer list
invert (defaults to 'no') - invert the layer
copySel(self, layerName, invert='no')
Copies selected features to a new layer
layerName - name of layer to copy to
invert - 'yes' or 'no' default to 'no' - invert polarity of features
         being copied.
copyToAffected(self, invert='no', dx=0, dy=0, size=0)
Copy selected features to affected layers.
invert (default to 'no') - 'yes' or 'no' indicates if features' polarity inverted
dx,dy - x and y shift for copied features
size - resize features by this amount when copied
copyToLayer(self, lay, invert='no', dx=0, dy=0, size=0)
Copy selected features to a specific layer.  See copyToAffected() for options
createCheck(self, checkName)
Create a new checklist
checkName - name of new checklist
createLayer(self, name, context='misc', laytype='document', polarity='positive')
Create a blank layer.
name - new layer name
context - (defaults to 'misc') context of layer (board,misc)
laytype - (defaults to 'document) type of layer (document, signal, etc...)
polarity - (defaults to positive) polarity of layer (positive, negative)
deleteCheck(self, checkName)
Delete a checklist
checkName - name of checklist to delete
display(self, lay, work=1)
Displays the layer in color 1, makes it work layer by default
lay - string containing layer name
work - integer 0=don't make work layer  1=make work layer
display_layer(self, lay, num, work=0, display='yes')
Display layer in editor.
lay - string containing layer name
num - integer (1-4) indicating color to display
work - defaults to 0, see display()
display - 'yes' to display layer, 'no' to clear layer.  default: 'yes'
featureSelected(self)
return number of selected features.  Can be used as boolean as well
returns zero if no features selected, # features if there are
importCheck(self, checkName, replace=0)
get checklist from library - replace if indicated
checkName - name of checklist to replace
replace - defaults to 0, if > 0, existing checklist is replaced
inputAuto(self, path, report_path='', report_filename='', copy_to_job='no')
Run the input screen on a specific path.  Save the report to another specific path.
path - path to look for input data
report_path - path in which to save report data
report_filename (optional)  will use jobname_inp.txt if not specified
copy_to_job (optional) "yes" or "no" to tell if you want to copy input files to job input directory
mergeLayers(self, sourceLayer, destLayer, invert='no')
Merge the selected layers
open(self, iconic='No')
Open the step in graphic editor.
iconic - string "Yes" or "No" indicating whether to open step as an icon only
refSelectFilter(self, refLay, include_syms='', exclude_syms='', mode='touch', reset=0)
Select by reference, using filter (so you better reset the filter if you need to!)
refLay - reference layer
include_syms (optional) - symbols to include in selection
exclude_syms (optional) - symbols to exclude from selection
mode (optional) - defaults to 'touch'
reset (optional) - defaults to 0 (0 = DON'T reset filter, 1 = reset filter)
removeLayer(self, lay)
Remove a layer
lay - name of layer
resetAttr(self)
Reset the attribute List
resetFilter(self)
Reset the selection filter
routCopy(self, sourceLayer, destLayer, destType='document')
Copy a rout layer to another layer.  destType determines if copied as normal features or rout features
Obliterates the layer you are copying to
        destType - 'document' or 'rout'
selectAll(self)
Select all features on affected layers, (applying popup filter)
returns number selected
selectDelete(self)
Delete Selected features.
selectNone(self)
Unselect all features.
selectRectangle(self, xs, ys, xe, ye, intersect='no', reset=0)
Select all features in a rectangle
xs, ys, xe, ye - start and end x,y coordinates
intersect - if 'yes' selects symbols intersected by rectangle but not fully inside
             defaults to 'no'
reset - see selectSymbol()
selectSymbol(self, symbolName='', reset=0, clear=0)
Select the Symbol indicated in the string resets if told to,
clears other features if told to.
           symbolName - Symbol to select
           reset - resets filter if you don't want this 
                action to be affected by pre-existing filter settings.
                defaults to NOT reset (integer 0 = no reset, 1 = reset)
           clear - Clear all selected features first ( 0 = don't clear, 1 = clear)
setAttrFilter(self, attr)
Set an attribute in the attribute filter
attr - name of attribute
setChainPlunge(self, layer, chain, len1, len2, intType='corner', mode='wrap', inl_mode='straight', start_of_chain='yes', apply_to='all', len3=0.0, len4=0.0, val1=0, val2=0, ang1=0, ang2=0, ifeed=0, ofeed=0)
Set up the plunge for a rout chain.  Lots and lots of options.  For now, you can look at 
the code yourself.
setGenesisAttr(self, name, value)
Set step attribute to a value, update Python attribute value.
name - string containing name of attribute
value - string/int/float containing value of attribute
  NOTE:  Value may be cast to string upon retreival
setSymbolFilter(self, syms)
Set a symbol on which to filter
syms - symbol name
unaffect(self, lay)
un-affect a layer in the graphic editor
lay - name of layer
zoomHome(self)
Zoom out to profile view/home

 
Data
        __author__ = 'Mike J. Hopkins'
__credits__ = ' Daniel R. Gowans, for contributions to content.... an excellent scripting interface to Genesis 2000'
__date__ = '18 August 2004'
__version__ = '$Revision: 1.4.1 $'

 
Author
        Mike J. Hopkins

 
Credits
         Daniel R. Gowans, for contributions to content.
Frontline PCB, for an excellent scripting interface to Genesis 2000