question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

generate_netlist(): Use default footprint for part if none is defined

See original GitHub issue

Is your feature request related to a problem? Please describe. It can be a pain to find the footprint for parts so it would be nice to use the default footprint for generate_netlist() if the user doesn’t define one when creating the part. Also, the code is smaller and easier to read without a footprint defined.

Describe the solution you’d like generate_netlist() should use the default footprint for a part if none is provided when the user creates the part

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
devbismecommented, Jul 16, 2022

I pushed a commit to the development branch with the empty_footprint_handler() function. Here’s an example of how to use it:

import skidl

def my_empty_footprint_handler(part):
    """Function for handling parts with no footprint.

    Args:
        part (Part): Part with no footprint.
    """
    ref_prefix = part.ref_prefix.upper()

    if ref_prefix in ("R", "C", "L") and len(part.pins) == 2:
        # Resistor, capacitors, inductors default to 0805 SMD footprint.
        part.footprint = 'Resistor_SMD:R_0805_2012Metric'

    elif ref_prefix in ('Q',) and len(part.pins) == 3:
        # Transistors default to SOT-23 footprint.
        part.footprint = 'Package_TO_SOT_SMD:SOT-23'

    else:
        # Everything else goes to the default empty footprint handler.
        skidl.default_empty_footprint_handler(part)

# Replace the default empty footprint handler with your own handler.
skidl.empty_footprint_handler = my_empty_footprint_handler

# Create parts with no footprints.
r = skidl.PartTmplt("Device", "R")
r1, r2 = r(), r()
r2.footprint='Resistor_SMD:R_1206_3216Metric'

# Generate a netlist. R1 has no footprint so it will be assigned an 0805.
# R2 already has a footprint so it will not change because it is not passed
# to the empty footprint handler.
skidl.generate_netlist()
1reaction
devbismecommented, Jul 10, 2022

Maybe the thing to do is define a set_empty_footprint(part) function that gets called during netlist generation if the footprint is empty. Normally, the function will raise an exception, but the user can redefine it so that it substitutes a default footprint for a given type of part and raises an exception for part types it doesn’t handle.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating Customized Netlists and BOM Files - GitHub
Create a Pads-Pcb netlist file. The pads-pcb format is comprised of two sections. The footprint list. The Nets list: ...
Read more >
Netlist Manager | Altium Designer 23 User Manual
Nets In Board - this region of the dialog presents all of the nets defined for the board by name. Use the mask...
Read more >
Schematic Editor | 6.0 | Español | Documentation - KiCad Docs
You can pan and zoom to different parts of the schematic and open any schematic ... If the symbol specifies a default footprint,...
Read more >
Orcad Capture User's Guide - Penn Engineering
Defining the default hierarchy option for new projects . ... Creating and editing parts 209 ... of the processing tools; creating a netlist...
Read more >
XSCHEM TUTORIAL
Create a symbol and use an existing subcircuit netlist ... You may comment the definition if you don't want any schematic on startup....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found