Skip to main content

pyEagleSCR

pyEagleSCR is a pure Python parser for the scripting language used by AutoDesk/CADSoft Eagle’s PCB schematic/layout tool.

For now, it aims to support only the functionality needed to parse symbols and packages, to ease use of part specifications in other tools like KiCad.

Status

Basic functionality working, including (probably not quite full) support for these commands:

  • Edit, with support for Symbols, Packages and Devices

  • Prefix

  • Pin

  • Wire

  • Layer

  • Connect

  • Description

  • Attribute

  • Add

  • Package

  • Smd

  • Grid

  • Set

Example

Running this tool against the .SCR file found in this ZIP on farnell.com (for the component STM32F405RGT6, farnell stock number 2064363) produces this result:

{'devices': {'STM32F405RGT6': <Device STM32F405RGT6>},
 'grid': 'mil',
 'layer': '96',
 'packages': {'QFP50P1200X1200X160-64N': <Package QFP50P1200X1200X160-64N lines=278 smd_pads=64>},
 'settings': {'Wire_Bend': '2'},
 'symbols': {'STM32F405RGT6': <Symbol STM32F405RGT6, 64 pins, 4 lines>}}

It doesn’t look like much, but this is a bare summary of the rich information inside this tree of objects. The parsed symbol here, a STM32F405RGT6, has a listing of all 64 pins, correctly mapped to the 64 SMD pads in the QFP50P1200X1200X160-64N package via the connections specified by the device STM32F405RGT6.

Usage

Create a Parser object, and feed the SCR in, line-by-line, then read the information you want out of the Parser.context object:

scrparser = parser.Parser()

for line in open("yourfile.scr"):
    scrparser.handle_line(line)

print scrparser.context['symbols']
# {'STM32F405RGT6': <Symbol STM32F405RGT6, 64 pins, 4 lines>}

You can fetch information about the pins on this symbol, like what type of pin it is, and the co-ordinates that the pin should be displayed at when drawing the symbol:

pins = scrparser.context['symbols']['STM32F405RGT6'].pins
print pins.keys()[:10]
# ['PB11', 'PB10', 'PB13', 'PB12', 'PB15', 'PB14', 'VDDA', 'PC14', 'PC15', 'VSS_2']
print pins['PB11']
# <Pin PB11 type=I/O rotation=0 position=-700,-1600 device=STM32F405RGT6.30>
print pins['VDDA']
# <Pin VDDA type=Pwr rotation=0 position=-700,1800 device=STM32F405RGT6.13>

If this script file had information about the package and the device for this symbol, you can also get the physical pad information for any pin by looking up the corresponding pin in the package spec:

pin_number = pins['VDDA'].device_pin_number
# '13'
scrparser.context['packages']['QFP50P1200X1200X160-64N'].smd_pads[pin_number]
# <Smd 13 x=11 y=58 width=270 height=-221 rotation=-89>

Contributing

Contributions are welcome! Please open a PR!

TODO

  • The API is a little janky:

    • Names of attributes could be more obvious

    • Pins should have references to their corresponding pads on the package

  • Support more Eagle SCR commands, like:

    • Change (applies to Package and Symbol)

    • Text (applies to Package and Symbol)

    • Value (applies to Device?)

    • Pad (through hole components, applies to Package?)

    • Technology (applies to Device?)

    • Wire (four-tuple variant, probably for rectangles?)

  • Support stripping comments after the end of a command.

  • Set up sensible defaults in the context, to match what Eagle does.

    • layer

    • grid

    • Any other default settings that should be initialised here?

  • Support case-insensitive commands

  • Python 3 support

  • Tests!

  • Support for processing a whole file so we don’t have to feed it in line-by-line, which is silly.

Metadata

Release files for EagleSCR 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for EagleSCR 0.2.0
File Size Uploaded Provenance
EagleSCR-0.2.0.tar.gz 5.3 kB Without provenance Details

Release files / EagleSCR-0.2.0.tar.gz

Download URL EagleSCR-0.2.0.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ef56764edadfbf0e34c3a2c861c10c27c729e7fb8dab2f33208a6c4399a1e34d
BLAKE2b-256 checksum
How to use checksums
3596ffdd4801429e5f10d74255557e340e62ace28495b33bc25395b45028d48c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for EagleSCR 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page