Netlist Customization

We use the Schematic portion only of KiCad to make generic Electrical schematic. We’re not making PCBs…

We create NetClasses that define what type of cable we’re dealing with and make wires between symbols (or use global labels). The netlabel or global label will be our ‘wire label’ that we’ll fix to the cable

We’re trying to use Export - NetList to generate Wire Label lists name ( based on the NetClass and the 2 end connection)

We get the connection information just fine but we’re unable to extract the NetClass. Any idea how we could do this ?

The endgoal is to generate an excel (csv) file we can send to our label printer…

For this purpose, a custom( python? ) script should use the schematic file as input and not the netlist.

Also, you may want to thumb up this issue. I may reopen at some point but not yet.

IMHO netclasses is the closest thing on KiCad that can be used for cable grouping ( in a similar way at least ), but a wiring harness drawing tool should have a higher priority. ( and i think it does )

Edit: In addition, busses also have enough room for experiments. :slight_smile:

I thought about your idea while writing my question. I looked at the schematic file in Notepad and it’s fairly simple. I just didn’t see anything that connects a Net/Wire between 2 pins. I have the components, the pins, the netclass information (I can get that from the .pro file), the label… but nothing about the actual net (I think).

When you say Python script, would it be using KiCad API or simply reading a text file ?? If it’s just reading a file I would do it straight in Excel using VBA since I want/need to output the data in Excel. I wouldn’t mind using the script to verify that the name of the label is correct… or update the name if it’s not.

Our schematics are super simple… Network cables between ethernet switch and computers, HDMI cables between computers and Projectors, Power cables between PDU’s and computers and accessories… and other tons of cables/wires.

1 Like

In the .kicad_pro JSON file there is an array called netclass_patterns which contains objects stating the class name and matching pattern. I think you would use the pattern to find the class of a net.

Are you taking about this stuff ?
“netclass_assignments”: {
“/UPDATEName”: “Ethernet”,
“/newLabel”: “Video”,
“PW1”: “Power”
},

There I see my global label (PW1) and Net Label ("UpdateName and NewLabel)… This part is great but I’m still missing the connection of these nets which I can only find in the Export-NetList (at the moment anyways)

   "netclass_patterns": [
      {
        "netclass": "POWER",
        "pattern": "/V+"
      },
      {
        "netclass": "POWER",
        "pattern": "GND"
      },
      {
        "netclass": "POWER",
        "pattern": "VCC"
      }
    ]

The missing link maybe the netclass_assignments section of the *.kicad_pro file vs the (nets section of the *.net file. One has the nets, the other has the netlist assignments.

Edit: And/or netclass_patterns too as @retiredfeline pointed.

So it looks like I still need to create a NetList + the schematic + .pro file to generate what I need.

I don’t really understand where/how the Net Patterns come in to play ??

This is an alternative/different way to assign netclasses. If you don’t use this, you can ignore it.

1 Like

What is 'normal usage of patterns ?

I cannot explain this better than that.

(Assuming you are on v7)

1 Like

Adding to this topic… Or might be another one…

When you look at a net label in the .sch file, it doesn’t seems to be attached or linked to the ‘wire line’ or anything. How does Kicad Drags the label when you drag the wire ‘line’.

Where is that connection made ??

The net element represents a net and lists all the pins that are in it. The graphical lines are listed elsewhere. Think about it, if you drag a symbol around the net element doesn’t change, only the positions of the lines. Thus there is no need to go through the line geometry to find the pins, those are determined by the connections made in drawing the schematic.

Not forgetting that connections can also be made using labels.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.