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.EagleFilePartVisitorA visitor to scan the file for all
EagleFilePartobjects alayerattribute 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
EagleFilesrcintoEagleFiledst. 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
EagleFileto update. - dst – The
EagleFileto draw layers from. - force – If
Trueoverwrite the layers. Otherwise, throw anSwoopErroron 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
EagleFileobjectlayers. Ifforce == True, overwrite layers inefwith the layers even if there is a conflict.Parameters: - ef – The
EagleFileto update. - layers – The
EagleFileto draw layers from. - force – If
Trueoverwrite the layers. Otherwise, throw anSwoopErroron conflict.
- ef – The
rebuildBoardConnections¶
-
Swoop.tools.rebuildBoardConnections(sch, brd)[source]¶ Update the signals in
brdto match the nets insch. This will set up the connections, but won’t draw the air wires. You can use Eagle’sripupcommand to rebuild those.Parameters: - sch –
SchematicFileobject and source of the connection information. - brd –
BoardFiledestination for then connection information.
Return type: None- sch –
propagatePartToBoard¶
-
Swoop.tools.propagatePartToBoard(part, brd)[source]¶ Copy
parttobrdby creating a newElementand 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 –
Partobject 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 – EagleFileto cleanseReturns: selfReturn type: EagleFile