Basic: how to create a schematic part mixing two existent symbols?

I need to create a mixed part, with an N-MOS and a P-MOS in the same package.
I guess the easy way is creating just a block with pins, but I’d prefer having it as a two units part, each selectable and placeable where I need in schematic.
Now, I can draw everything from scratch, following the guide (as units not interchangeable), but what if I want to copy the two existing symbols in devices.lib?

I tried loading an N-MOS and saving it to a new library, then updated it as a 2 units one, and switched to units not interchangeable … but it didn’t work: it let me change pins for the two units, but the symbol kept staying shared by the two units!
Looks (to me) like an horrible mess: has anybody ever reused parts this way? It’s just me not finding the right controls to do it?

1 Like

You could try to use a text editor and editing the symbol entry in the lib directly.

Example:

#
# LED-dual_red/grn_LSGT676_PLCC4
#
DEF LED-dual_red/grn_LSGT676_PLCC4 D 0 0 N Y 2 L N
F0 “D” -100 0 50 V V C CNN
F1 “LED-dual_red/grn_LSGT676_PLCC4” 185 0 50 V V C CNN
F2 “LEDs:PLCC-4” 0 0 10 H I C CNN
F3 “" 0 0 10 H I C CNN
F4 "
” 0 0 10 H I C CNN “Manf#”
F5 “_” 0 0 10 H I C CNN “Manf”
DRAW
T 0 100 -50 31 0 1 0 red Normal 0 C C
T 0 100 -50 31 0 2 0 grn Normal 0 C C
P 2 0 1 15 50 -45 -50 -45 N
P 2 0 1 0 50 5 110 25 N
P 2 0 1 0 60 -25 120 -5 N
P 4 0 1 10 0 -35 -50 45 50 45 0 -35 N
P 4 0 1 0 110 25 90 10 85 25 110 25 F
P 4 0 1 0 120 -5 100 -20 95 -5 120 -5 F
X ~ Aa 0 50 4 D 50 50 1 1 P
X ~ Ca 0 -50 12 U 50 50 1 1 P
X ~ Ab 0 50 4 D 50 50 2 1 P
X ~ Cb 0 -50 4 U 50 50 2 1 P
ENDDRAW
ENDDEF

See the bold numbers?
That’s how KiCAD depicts what unit the object (text, lines, cricle, pin, etc) belongs to: 1=A, 2=B, 3=C, … 0=common to all units.
You could copy both symbols into one via text editor… modify the numbers and with a bit of luck and determination get what you want…
At least that’s a way to get both symbols into one (without much redrawing or whatever) as copying this kind of content doesn’t work inside EEschema yet afaik).

Alternatively (if you want/can redraw) right clicking on lines/circles will allow you to deselect the ‘common to all units’ option, so you can have different symbols for each unit.

[EDIT]
PS: the italic number in the DEF line depicts the unit count. Usually this is just 1, but for multi-symbol parts this is how many units you have.

1 Like

Gosh… That’s exacted what I tried to avoid: I’ve already peeked in the .lib file with a text editor…
I just hoped I was missing the proper mouse action to do it :worried:

1 Like

Well, afaik KiCAD is missing a copy function for stuff like this (surely will come at some point, but don’t hold your breath), so if you don’t want to redraw you have to do it outside of KiCAD. Sorry.
It’s not that hard actually… just taking all the P & X lines from each symbol, replacing the numbers and moving them into either one of the symbols… restart kicad (or reload libs = preferences/configure libs) and you’re there.

Ah, and I think the DEF line needs adjustment as well… 3rd position from the right depicts unit count I think.

Er… this has the side effect to remove the element from the other parts in the package :sweat_smile:

Just copy them lines instead of moving :wink:

PS:
Try and have a go at it… if you don’t get anywhere in next 12 hours… load the 2 symbols in question into a custom lib and either drop me a pm with them or link them here. I’ll get it done.
Now I gotta hit the bed.
Night

Thanks for help, I made it – editing text in .lib file.
Can be useful for someone else: as text editor I used Notepad++, that has a column selection mode (with Alt + mouse click for selection). This comes in handy, since all the P lines copied have already a single column of ‘0’ instances to change, so if you column select and press ‘1’ or ‘2’ just once, they’re all updated in one go.

3 Likes

Cool, I didn’t know that one… ha. You learn something new every day. Thx for the reply!

Library editor has a tools on the right toolbar: Export current drawing and Import current drawing. This way you can copy graphics from one symbol to another, but not between units.
However, this restriction can be overcome, by reasonably moving symbol anchor and editing properties of the graphic items.

Each graphics item of the symbol drawing has its own properties. You can chose if it will be shared for all units or not. For example. The P-MOS and N-MOS differs by the direction of the arrow. So for all graphics item you can keep checked Share for all units except the arrow body where you should uncheck this option. This way the only thing to redraw in the second unit is the arrow body.

I had the same problem.

  • open the
  • change it to <2 parts, not interchangeable>
  • edit the 2nd part (or more if you have)
  • THEN edit the 1st part. After all the others !
    It worked in this sequence.
1 Like

I wish this could be done within the tool.

Loose symbols tied together in the part.

ha! :smiley:

ah… :unamused:

That’s fair. It’s just that in my case I also wanted NMOS source to be picked pointing down (toward GND/VSS, tipically) and PMOS source pointing up, where a VCC/VDD line is tipically hanging, then I had them to flip over.

Me too :slight_smile: