Pcbnew without eeschema (again)

Many thanks :slight_smile:

From other posts in this thread, it now looks like it’s the netlist I need to focus on, though.

Cheers,

Alex

But my point is I want to use a text editor, you see! :smiley:

Thanks for the suggestion. It’s great to know any possible options out there :slight_smile:

Cheers,

Alex

I’m really glad that my cry for help actually helped you :smiley:

Cheers,

Alex

Like you, I want to use a text editor as well. A schematic-specific language would still be text-based and editable with a text editor. But it would also be able to do error checking, support hierarchy, and allow easy refactoring of the circuitry. Just editing the netlist doesn’t. It’s like the difference between writing machine code or writing Python. The main advantage of editing the netlist is you can do that right now.

The advantage of a hybrid method. Make the root PHDL and allow sub modules that are actually schematic pages. It would have to be that way round due to the impracticality of hierarchical sheets with very high numbers of connections

Cross probing still works, either pulling up a schematic sheet or highlighting the PHDL line

Oh, OK, point taken :slight_smile:

I have really enjoyed your story :slight_smile: My profile has very little to do with the one you describe (basically I’m a one man band doing very small jobs), but it’s really interesting to hear your rare experience of a professional business going that way for proper size projects and the pros and cons involved.

As an exercise, for creating PCBNew NETLISTs using Scripts, I first looked for the minimal information content that would still load components into PcbNew.

Turns out, that is quite a lot removed ( & an editor with brace balancing helps the quick checks here )
Example attached, if anyone is interested.

KiCAD_Smallest_NET.net (2.0 KB)

Addit: Example with no header - removed Absolute path and time,
KiCAD_Smallest_NET_nH.net (1.9 KB)

2 Likes

Nice one!

I think it’s a real shame that PCBnew still requires information like timestamp and (more annoyingly) one absolute path, but it’s great to know where we stand.

Cheers,

Alex

Oops, do you mean the design( section I have in there ?

I left that in, as I consider that souce, date, tool useful minimal audit information, but I’ve just tested if it is mandatory, and it still works fine with design() sub-block removed… (ie no timestamp or absolute path)

See the second example attached above.

Na, @Andy_P was thinking of (tstamp 56FD43D6) fields within (comp ... ) brackets.
But even your first file is missing them, so PCBnew doesn’t insist on them apparently?
Would be interesting to know what happens when you do an import in pcbnew with this option activated:

Btw, while you guys are solving riddles there, I got a problem I couldn’t solve the other day - how to add extra fields to .sch files so they stick when one safes the file in Eeschema?
@devbisme 's KiField must master that somehow (didn’t test it yet as I didn’t had time).
OK, here is what I did:

  • open any .sch file and add an extra field to a component in a text editor and safe it
    (in my case I added an F 6 field and put in “_” as a placeholder for the information, copied the F 5 line more or less)
  • start KiCAD/Eeschema and load that file and then check the component’s properties for that extra field - it was gone
  • safe the .sch file and the line also vanishes from the .sch file
  • adding the extra field “_” via Eeschema’s component properties dialog funnily does create the same line again (when the file is saved) but this time the field sticks and doesn’t vanish

… I modified .bak files, the .lib symbols also got the field later on, changed standard field in Eeschema to have this one as 6th… but nothing of that helped.
All in all just mentioning it in case you need this functionality in your endeavors in case you need/want to create .sch files down the road for visual inspection/check for some of the stuff.

Correct. They are not required for normal NET import.

I would expect issues…
I flipped to TimeStamp, and for a file with no timestamps, it actually almost/sort-of worked…
Reports attached - looks close, but the cursor had only a single C attached.(ie many parts lost)

KiCad_MinNET_RefDes_report.txt (2.9 KB)
KiCad_MinNET_Timestamp_report.txt (2.6 KB)

1 Like

I’ve seen this issue in LTSpice. Some things preserve, and some do not - patchy & varies with part type.

In eeschema, it seems to all work for me ?
I can paste in (eg) after F 3…
F 4 “Edit_AddField4A” H 6950 1600 60 0001 C CNN "Field4"

to either gate of a Hex inverter, and is preserves across a eeschema Load/save cycle ?
(and of course, shows up under E )

… and following the Simplest NET rules, here is a first result from a Script to import a PADS design into kiCad :slight_smile:

Script (.bas) can run in either PADS SCH or PCB, in Eval mode, and exports a KiCad .NET file.
This does not try to be ‘too clever’, it extracts the nets, parts, refdes, and tries to label correctly.
A simple ASCII file is the transfer point between the two.
Script adds a KiCad_footprint attribute field into PADS database, & has a mapping table to fill this in.

Actually worked first time (amazing) - All looks good, even the error messages make sense.
Part labels need to flip between values and parts, which they do.

PADS net list uses A-K for LED and kiCad expects 1-2,
Y1 has 1.2.3.3 mapping, illegal in PADS, which has 1.2.3.4
In this case, 3&4 are gnd so it makes no difference.

Target uses are

  • Using PADS SCH Eval-mode to create many (smaller) SCH, to one large kiCad PCB
  • Commercial users can evaluate kiCad in parallel with PADS whilst evauating high license fees…
  • Employees can do private jobs
  • Some parts of the company can use KiCad instead of PADS
  • KiCad users can train in PADS, to bolster their CV’s

Next info that would be nice to pass over, would be placement XYR, but the kiCad NET format has nowhere for that ?

1 Like

No, don’t think so.
That’s what I get when I hit production output pos file in PCBnew for the test project up there:

### Module positions - created on 28/06/16 15:55:20 ###
### Printed by Pcbnew version kicad (2016-03-04 BZR 6608, Git ba038ac)-product
## Unit = mm, Angle = deg.
## Side : top
# Ref Val Package PosX PosY Rot Side
C101 C_100n-16V-X7R-kemet_0805 C_0805 162.5600 -76.9620 0.0000 top
C102 C_100n-16V-X7R-kemet_0805 C_0805 155.9560 -76.9620 180.0000 top
U101 LDO_MIC5205-3.3V_SOT23-5 SOT-23-5 159.2580 -76.9620 180.0000 top
## End

Or did I misunderstand your XYR reference?
Though PCBnew won’t be able to read/import that anyway, so you’d have to look at the .kicad_pcb file to get those moved with all the implications - eww. :scream:

As for my (unrelated) problem… I’m running BZR6608 on Win7 64bit atmo… might need to upgrade to the latest and see if this persists.

My test is on build 6943, Win8.64b

No you are correct. PADS has an ASCII (undocumented?) feature where you can add XYR to the ascii line, and that is used as initial placement suggestion. Re-import ignores that (as it probably should).
Another approach would be a script that can move parts once loaded, but that then makes this a 2 step process.

1 Like

Wow, guys, I’m really glad you are taking this pretty far already :slight_smile:

Thanks for the second “template” / minimal netlist. That is in fact so simple that I reckon one could actually even memorize the syntax!

Cheers,

Alex

Yes, such placement files will be widely available, from almost any other EDA flow, which is why I was looking for a means to apply that info.
Digging about in your examples, and using the references here & some google, my learner Python comes to be this

import sys
from pcbnew import *
pcb = GetBoard()  # Read loaded PCB design
RefNm   = ['U1','U2','J1','J2']              # Lists of Ref X Y R M to apply to just imported netlist/coarse placement.
RefX    = [7050.0,7050.0,6400.0,6400.0]
RefY    = [4700.0,4100.0,4100.0,5250.0]   
RefOri  = [0,45,90,135,180]
RefSide = [False,True,False,True]   # Flipped is True for Bottom

# Scan the lists test - Requires lists of RefNm, RefX, RefY (mils), RefOri, RefSide, & scans to apply those to the parts.
for Idx,Rn in enumerate(RefNm):
  print "# RefNm:",Rn," ",RefX[Idx]," ",RefY[Idx]," ",RefOri[Idx]," ",RefSide[Idx]                          
  nPart = pcb.FindModuleByReference(Rn) 
  nPart.SetPosition(wxPoint(FromMils(RefX[Idx]), FromMils(RefY[Idx])))  # Update XY
  nPart.SetOrientationDegrees (RefOri[Idx])                             # Update Rot
  if RefSide[Idx]!= nPart.IsFlipped():                                  # Current Side <> Reqd Side ? then flip
        nPart.Flip (nPart.GetPosition())

print "Press 'B' when done, to refresh display & copper" 

which is quite compact.
Seems to work, tho display refresh seems variable, & read-back checks seem ‘sticky’.

Next is to try & see if there is a PcbNew command line method to
a) first load a NET file then
b) run a Python script (above) on that loaded data set.

Using the above script, this is the result POS files.
Placement is correct, but rotation is build-relative, so (of course) that varies depending on how the decals sit in the library.
It is corrected visually in a few seconds, with some 'R’otates…

### Module positions - created on 06/30/16 21:14:26 ###
### Printed by Pcbnew version pcbnew (2016-06-19 BZR 6943, Git e27f90a)-product
## Unit = inches, Angle = deg.
## Side : top
# Ref     Val        Package                              PosX       PosY       Rot  Side
D1        LED        LED_1206                           3.5350     1.5650   45.0000  top
D2        LED        LED_1206                           3.4650     0.5650  315.0000  top
Q1        +5VREG     TO-263-3Lead                       3.1000     1.2000   90.0000  top
R1        12k        R_1206                             2.0500     0.5500    0.0000  top
R2        12k        R_1206                             2.0500     1.2000    0.0000  top
R5        12k        R_1206                             0.4000     1.7000    0.0000  top
R6        10k        R_1206                             3.6750     0.9250  255.0000  top
R7        10k        R_1206                             3.6750     1.2750  105.0000  top
U1        87C256     SOIC-28_7.5x17.9mm_Pitch1.27mm     1.4000     0.8000   90.0000  top
U2        87C256     SOIC-28_7.5x17.9mm_Pitch1.27mm     1.4000     1.4500   90.0000  top
U3        AM100415   SOIC-16_3.9x9.9mm_Pitch1.27mm      2.0500     0.8000   90.0000  top
U4        AM100415   SOIC-16_3.9x9.9mm_Pitch1.27mm      2.0500     1.4500   90.0000  top
U5        CD4001B    SOIC-14_3.9x8.7mm_Pitch1.27mm      0.7500     1.6000   90.0000  top
U6        CD4069     SOIC-14_3.9x8.7mm_Pitch1.27mm      0.7500     1.2500   90.0000  top
U7        PAL16R8    SOIC-20_7.5x12.8mm_Pitch1.27mm     0.6500     0.8000   90.0000  top
Y1        24-576MHZ  Crystal_SMD_7050_4Pads             0.4000     1.4000   90.0000  top
## End

## Module positions - created on 06/30/16 21:14:26 ###
### Printed by Pcbnew version pcbnew (2016-06-19 BZR 6943, Git e27f90a)-product
## Unit = inches, Angle = deg.
## Side : bottom
# Ref     Val       Package                PosX       PosY       Rot  Side
C1        .1uf      C_1206               1.1500     1.0000  180.0000  bottom
C2        .1uf      C_1206               0.5000     1.0000  180.0000  bottom
C3        .1uf      C_1206               1.9500     1.5500  180.0000  bottom
C4        .1uf      C_1206               0.7000     1.7000  180.0000  bottom
C5        .1uf      C_1206               0.7000     1.3500  180.0000  bottom
C6        .1uf      C_1206               1.9500     0.9000  180.0000  bottom
C7        .1uf      C_1206               0.4000     1.5500  180.0000  bottom
C10       .1uf      C_1206               1.1500     1.6500  180.0000  bottom
## End

An update, over the weekend, I experimented with .kicad_pcb files net and trace portions.
The above examples convert NET and Placement info, but uses each packages libraries.
Some rotate-type cleanup is needed after script-place, to take care of library spins.

Turns out you can APPEND a partial kicad_pcb file, which works best in OpenGL mode
Here is the before file, in Mentor-PADS:

and here is the design in KiCad

1 Like