Pcbnew without eeschema (again)

Hi All,

I have never used KiCAD, and I am trying to determine whether it’s the right tool for me.

From other threads, I understand that the standard KiCAD practice is to feed pcbnew with a schematics file generated from eeschema, i.e. pcbnew is not stand-alone.

For a number of reasons, instead of that, I’d like to create any of this (like for example netlist information and footprint details) from non-graphical tools such as a text editor, custom scripts, etc. I’d then use pcbnew to draw my artwork including PCB and any custom footprints I may require. From the website file format page, I realize KiCAD uses text files, which is good for my purpose.

I’d like to ask you for any comments and help regarding the feasibility of this and how to do it. Can I feed a standalone netlist file into pcbnew instead of a schematics file? What about footprint details like for example a list to link component reference “R1” to a some footprint named “resistor_axial_lead_250mw” in the libraries? Or, alternatively, can I generate a valid schematics file (i.e. one that pcbnew is happy to load) which has the above information in it, but no schematics drawing?

Cheers,

Alex

Just download it, start it, generate a simple circuit, generate the netlist and then check the output?
There is some stuff in other files that make it all work, but per se nothing speaks against your approach.

Btw, as I don’t like to die dumb :smirk: can you share the “number of reasons”?

Example:

netlist file:

Test.net (4.9 KB)

It’s my understanding that the NETLIST file, not the schematic file, is the starting point for PCBNew. The netlist file includes the logical links between schematic symbols and footprints. As @Joan_Sparky suggested, open a simple netlist file in “Notepad++” (or your favorite text editor) and examine it for a while.

As you said, all of the KiCAD files are stored as ASCII plain-text (“human readable”), and I recall encountering a document in the KiCAD documentation that described the syntax and contents of each KiCAD file, so it seems quite possible for you to generate a valid KiCAD netlist using a scripting language, spreadsheet macro, text editor, or other tools. As a practical matter . . . considering that KiCAD’s development history spans decades and the accumulated effort is on the order of man-years, I have to wonder if this is a wise use of resources.

Dale

Maybe he’s training a ‘machine’ to create ‘machines’?
At some point machines will need that to get ahead in the evolutionary game… I am not kidding. :expressionless:

Hi,

Many thanks for your comments and files.

Would you mind posting the schematics file too? I could probably try to load it onto pcbnew, then, if it’s got separate sections of text inside it, strip the schematic drawing from it and see if it still loads, then see what else can be eliminated from it without pcbnew refusing to load it, maybe I can obtain something that’s minimal enough for me to create from a text editor or script.

[EDIT: please ignore the request above as the comments by @dchisholm and @bobc make it clear that it’s the netlist I need to focus in, thanks!]

With regards to my reasons, it’s my preference to avoid GUIs / WYSIWYG wherever possible. I write my stuff in HTML plain text rather than Word. I write my music sheets in Lilypond plain text rather than Finale or Sibelius. Obviously you wouldn’t want to design a PCB using a non graphical tool, but all previous steps should be handled just fine.

  1. Typing is usually much, much faster than drawing, regardless of hours of use (at first, it’s a case of getting used to some syntax vs. getting used to a GUI, after a while it’s just to do with the input method, and fact is keystrokes just beat point and click).
  2. Computers deal with text really fast too, whereas the opposite is typically true for GUIs. The whole process of getting something described becomes a lot more efficient.
  3. Using text means I always interface to the same few tools (chiefly text editor) regardless of the nature of what I need to produce. Whatever GUI out there can be great or crap, my text editor, on the other hand, just rocks.
  4. Most other editors out there will do just fine too, which means I have total flexibility to use whatever operating systems I fancy on my different dual boot computers.
  5. Also to do with flexibility, you are not restricted to using one tool (text editor). For automated tasks such as replicating things introducing small changes, you can program your own scripts (*)
  6. Searching for anything is straightforward and powerful (bash “find” and “grep” or equivalent Windows’ file manager, find facility of the editor, and so on).
  7. Having a perfectly clean source is much easier. For example, you can copy a block without having to bother about a grid to align things. This is specially good if your source is a deliverable to customer.
  8. Backups are much safer. You are a lot less likely to face a situation where a reinstall will result in whatever project refusing to load altogether from a backup because it relied on “library” files common to multiple projects and, if that should happen, you are in a much better position to recover. You know very well which are the files containing this or that bit of your effort because you put that bit of effort in each.

:smiley:

Alex

(*) Consider for example a voltage reference array made with some resistors in series forming a rail from Vcc to GND, for a flash A/D application. You have calculated your precision resistors using a spreadsheet. The reason why the upper ones are slightly different in value from the lower ones is to account for the input bias current of the comparators you are connecting them to. Why add each of those by searching for it, clicking on it, placing it and connecting it? You could just export your spreadsheet to CVS and use a couple lines of script code to convert that to a part-net-part-net… chain. The example may look stupid, but I’ve been in situations similar to that very, very often.

Hi Dale,

Thanks for you help. Yes, there’s format info available:

https://kicad.org/help/file-formats/

Ideally, I’d like to feed not only nets, but also some footprint information, though. I’d rather tell pcbnew what shape each reference has in one go through a text file than fighting with a mouse to find them. That’s why I want to look at the schematics file, since it surely has the net information in it too.

As for the wise use of resources consideration, which I agree with, well, I guess I’ll have a quick look to how these files look like on the editor and judge whether the whole idea makes sense from how neat or horrible they look :smiley:

Alex

The schematic file does not contain a net list as such, it is a collection of graphic objects. To generate the netlist, eeschema goes through each graphic element to determine if the coordinates match coordinates of other elements.

pcbnew gets footprints from the data in the netlist, so I think that is all the information needed for pcbnew without a schematic.

I have been generating various KiCad files by code, I was also thinking of creating a new schematic editor but the effort is quite considerable!

Hi,

Thanks a lot. It’s good news to know the netlist should be enough for the specific information I’d like to handle :slight_smile:

Alex

I’m scratching my head a bit here. Sure you can roll your own netlist, though you’ll still have to create footprints too…

What kind of circuit design are you involved in that wouldn’t benefit from having a schematic in front of you? How will you share your design with others without a schematic? What record will you have of what parts must be used for each footprint or vice versa?

I understand the desire to stay away from the mouse (vim user here!) and Eeschema and Pcbnew can both be nearly 100% controlled via keyboard, but I think you’re throwing away a pretty useful tool here (schematic editors in general).

Hi,

I do draw any circuits I design, but depending on size, complexity and application, I do this in different ways. Sometimes I grab a piece of paper and a pencil, and that’s perfectly good enough to build a vero board-like prototype I can power up to do whatever debugging. Sometimes I’m interested in running a bit of simulation, in which case I use a schematics capture tool to draw what I already have in paper. Often times, that schematic is again good enough to serve as my reference for the design (and because of this, I could do with a script to translate netlists across, I favour LTSpice for simulation).

As an electronics designer, I’ve worked in close collaboration with PCB offices in different companies throughout the years, but I’ve never done PCB design myself as a professional. As an enthusiast, I don’t really need a professional grade tool with stuff like configuration control, back annotation and so on, so the risk of my schematics not matching my PCB artwork is acceptable and, because of that, I can have my schematics in paper, or done using whatever other tool.

Alex

1 Like

Maybe it is only tradition that the schematic is drawn. I rarely draw diagrams for software, and in general software is solely text based. The spatial positions of symbols is not fundamental, the interconnections are. So I think it is an interesting idea to write a schematic like one might write code.

I do find drawing the schematic quite tedious, there is a lot of drafting work not related to the actual electronic design. Wires should really rubber band and snap to connection points, rather than be treated as separate bit of graphics. Visio had that years ago.

The spatial layout of the PCB is fundamental of course, copper tracks must physically align with component leads.

I totally, absolutely need to have a drawing in front of me whenever I’m designing :smiley: I need a structural representation of what I have in mind, shown in a way that is logical in terms of “explaining” what the thing is meant to do :slight_smile: But, most often, pencil and paper will do just fine for me. Then again, I do mostly analogue, mixed signal, and power, maybe digital guys can do without I guess?

Alex

1 Like

Hi,

I have loaded the netlist provided by @Joan_Sparky on my text editor, and it looks very friendly. I was expecting some ugly XML requiring lots of lines and text. It’s pretty meaningful and intuitive.

pcbnew refuses to load it, complaining about “SOTx”, but that’s a different story and one for me to deal with.

Many thanks, guys.

Alex

Netlist Centric designs are uncommon, but not rare.
Some users find working from PART and CONNECTION ASCII lists easier than managing the custom schematic.

If you look at that supplied netlist, it has some hard library paths included.
You should generate a similar, simple netlist on your own system, and check that imports OK into PCBnew.
That will have the library paths known and aligned for your system.

Then, use your editor to ‘throw stuff overboard’ until it stops working. That gives you a minimal-net format as a base.

LTSpice can export a great many netlists & wirelists, create some, and check which are nearest to your needs,
LTSpice also has an ASCII main file format, so you could look at scripts that read both the main file and the LTSPice.NET, if you want a complete information set.

eg Try Accel net, as quite similar, and the .ASC file has mfg= and pn= string info, if you want to tag more BOM info into LTSpice.

KiCad SCH can also generate LTSpice netlists, and launch LTSpice, so you could trial that too, as time allows.

Oh. Wow. What a great idea. I didn’t even think of this. Using the schematic is so cumbersome. I will also investigate the format and may try this myself!

After all, you already use Verilog and such languages to design digital circuits. All I do in the schematics usually is put down a bunch of components, label them to make connections. This could be done much more quickly and clearly in a text editor.

You might also look at PHDL which is an HDL for creating schematic netlists. The project doesn’t look active, but possibly it has some ideas that are useful.

1 Like

NETLISTs can be quite powerful, and they are something CAD designers should look to improve.
I’m sure KiCad can borrow this idea.

Taking the PADS ASCII Netlist, as one example

This is a minimal version : (CON-SIP-10P must exist in the library set)
PART
J1 CON-SIP-10P
J2 CON-SIP-10P

NET
SIGNAL GND
J1.3
J1.2
SIGNAL SomeNetName
J2.2
J1.9

but (not well documented :wink: ) is that this is also a valid NETLIST, for new imports.
(If J1,J2 already exist, and second import will skip PART addition)

PART
J1 CON-SIP-10P,Value@Footprint X Y R U M
J2 CON-SIP-10P,Value2@Footprint2 X2 Y2 R2 U M

This allows also assign of Value field, and a re-map of a default footprint, plus an initial placement /rotation, with M field even selecting PCB side.

One possible use of this, is to ‘seed’ the initial PCB placement with the schematic location, as often related parts are close together on the SCH.

Yes, that is interesting work - There are signs of a pulse buried in the mailing lists for PHDL here
https://sourceforge.net/p/phdl/mailman/phdl-devel/

I can see this appealing to someone with HDL Centric design flows already in place. Could work well with CPLDs/FPGAs

"The PHDL compiler automatically supports the output of PADS and Eagle netlists, and through extending a simple java class, users can generate a netlist in practically any format required by their choice of a layout tool."

Looks like adding KiCad netlist would not be too hard ? KiCad is mentioned in the mailing lists chatter.

1 Like

That’s the whole project - I made it a couple of days ago to test/troubleshoot BOM generation and my python install:
Test.zip (11.2 KB)
(the libraries to run these are my own, it’s not based on anything you can get from KiCAD/github)

“SOTx” would be my footprint library that contains all SOT footprints.

Even better if the PHDL can be mixed with schematic entry. Many boards are a combination of high pin count BGA and power supplies and audio IO