Swoop Utilities¶
Swoop provides a collection of utility classes and functions for working with Eagle files built on Swoop that we have built for our own use. They also serve as longer examples of how to use Swoop to do useful things to Eagle files.
ScanLayerVisitor¶
-
class
Swoop.tools.
ScanLayersVisitor
(efp)[source]¶ Bases:
Swoop.Swoop.EagleFilePartVisitor
A visitor to scan the file for all
EagleFilePart
objects alayer
attribute and collected the names of all layers that are used somewhere in the file.-
getDefinedLayers
()[source]¶ Get a list of all the layers defined in the file.
Return type: List of str
-
ScanLibraryReferences¶
mergeLayers¶
-
Swoop.tools.
mergeLayers
(src, dst, force=False)[source]¶ Merge layers from the
EagleFile
src
intoEagleFile
dst
. If there is some conflict between the two (different names for the same layer number or vice versa), then raise an exception (unlessforce == True
)Parameters: - src – The
EagleFile
to update. - dst – The
EagleFile
to draw layers from. - force – If
True
overwrite the layers. Otherwise, throw anSwoopError
on conflict.
- src – The
normalizeLayers¶
-
Swoop.tools.
normalizeLayers
(ef, layers, force=False)[source]¶ Clean up layers in a file. First, remove all unused layers, then merge in the layers from
EagleFile
objectlayers
. Ifforce == True
, overwrite layers inef
with the layers even if there is a conflict.Parameters: - ef – The
EagleFile
to update. - layers – The
EagleFile
to draw layers from. - force – If
True
overwrite the layers. Otherwise, throw anSwoopError
on conflict.
- ef – The
rebuildBoardConnections¶
-
Swoop.tools.
rebuildBoardConnections
(sch, brd)[source]¶ Update the signals in
brd
to match the nets insch
. This will set up the connections, but won’t draw the air wires. You can use Eagle’sripup
command to rebuild those.Parameters: - sch –
SchematicFile
object and source of the connection information. - brd –
BoardFile
destination for then connection information.
Return type: None
- sch –
propagatePartToBoard¶
-
Swoop.tools.
propagatePartToBoard
(part, brd)[source]¶ Copy
part
tobrd
by creating a newElement
and populating it accordingly. If the part already exists, it will be replaced.Note
This function doesn’t update the board’s signals. You can run
rebuildBoardConnections()
to do that.Parameters: - part –
Part
object that to propagate. - brd – Destination :class`BoardFile`.
Return type: None
- part –
removeDeadEFPs¶
-
Swoop.tools.CleanupEagle.
removeDeadEFPs
(ef)[source]¶ Remove all the unused items (symbols, packages, devices, and devicesets) from an eagle file.
Depending on the file type “unused” means different things:
- For schematics: Any symbols, devices, packages, or devicesets that are not used in the schematic will be removed.
- For boards: Any packages not used in the board will be removed.
- For libraries: Any symbols or packages not mentioned in any deviceset or device will be removed.
Parameters: efp – EagleFile
to cleanseReturns: self
Return type: EagleFile