0

I'm trying to iterate through a nested dictionary into an integrated circuit with schemdraw but the values overlap each other in the final drawing instead of creating new entries on the integrated circuit. I think I might need one more level of iteration but not really sure what that should be. Any help appreciated!

Here's what I'm working with:

import schemdraw
import schemdraw.elements.intcircuits as eInt



dict1 = {'channel 1':
                 {'source_name': '1', 
                 }, 
        'channel 2': 
                {'source_name': '2', 
                }}


with schemdraw.Drawing(file='/Users/Desktop/circuitdrawing.png') as d:
    for channel, info in dict1.items():
        if channel != None:
            for channel, info in dict1.items(): #might need another level of iteration here?
                d += eInt.Ic(pins=[eInt.IcPin(name=(channel), pin=(info['source_name']), side='left')],
                    edgepadW = 2,
                    pinspacing = 1).label('console 1', 'top', fontsize=12)
        else:
            continue

This is the output from the code: Circuit Drawing

  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Jun 29 '22 at 04:16

1 Answers1

0

Solved by adding an additional slot argument to the pin info so it ended up looking like this:

d += eInt.Ic(pins=[eInt.IcPin(name=(channel), pin=(info['source_name']), side='left'), slot='1/2'],
                    edgepadW = 2,
                    pinspacing = 1).label('console 1', 'top', fontsize=12)