devbisme / kinet2pcb

Utility to convert a KiCad netlist into a PCBNEW .kicad_pcb file.
MIT License
11 stars 7 forks source link

Some Netlist files don't have libraries separated from part by colon #1

Closed ScottHilton closed 4 years ago

ScottHilton commented 4 years ago

Description

I want to run the script from python

The netlist file generated from kicad has parts that aren't parsed correctly by the footprint loading logic.

What I Did

This .net file complained about splitting "LED_0201_0603Metric" because there is no colon to mark the library

(components
    (comp (ref D1)
      (value D)
      (footprint LED_0201_0603Metric)
      (fields
        (field (name keywords) diode)
        (field (name description) Diode))
      (libsource (lib device) (part D))
      (sheetpath (names /top/14404651971475440255) (tstamps /top/14404651971475440255)))

This .net file complained about splitting and empty string because there is no colon to mark the library however it has an area in the netlist called libraries.

 (components
    (comp (ref RN1)
      (value R_Pack11)
      (datasheet ~)
      (libsource (lib Device) (part R_Pack11) (description "11 resistor network, parallel topology, DIP package"))
      (sheetpath (names /) (tstamps /))
      (tstamp 5DBB00A5)))
  (libparts  ...)
  (libraries ...)

This netlist didn't like the .pretty part. After removing it I still got a null object for fb.

  (components                                                                                          
    (comp (ref R1)                                                                                     
      (value 1K)                                                                                       
      (footprint Resistor_SMD.pretty:R_0805_2012Metric)                                                                 
      (fields                                                                                          
        (field (name description) Resistor)                                                            
        (field (name keywords) "r res resistor"))                                                      
      (libsource (lib device) (part R))                                                                
      (sheetpath (names /top/12995167876889795071) (tstamps /top/12995167876889795071)))  
xesscorp commented 4 years ago

Hi, Scott. My apologies for the difficulties with kinet2pcb. As I always say: "it can never be easy."

To examine the problem, I created a small design with a resistor, capacitor, and LED from the device.lib symbol library. Inside EESCHEMA, I ran the cvpcb tool to assign footprints to the symbols, and then I exported a .net file.

Inside the .net file, I had three components that all looked similar to this:

  (components
    (comp (ref C1)
      (value C)
      (footprint Capacitor_SMD:CP_Elec_5x3)
      (datasheet ~)
      (libsource (lib Device) (part C) (description "Unpolarized capacitor"))
      (sheetpath (names /) (tstamps /))
      (tstamp 5DBC3998))
    (comp (ref D1)
      (value LED)
      (footprint LED_SMD:LED_0201_0603Metric)
      (datasheet ~)
      (libsource (lib Device) (part LED) (description "Light emitting diode"))
      (sheetpath (names /) (tstamps /))
      (tstamp 5DBC3E23))
    (comp (ref R1)
      (value R)
      (footprint Resistor_SMD:R_0603_1608Metric)
      (datasheet ~)
      (libsource (lib Device) (part R) (description Resistor))
      (sheetpath (names /) (tstamps /))
      (tstamp 5DBC51E3)))

As you can see, all the components have a footprint field that consists of the footprint library nickname and the footprint name separated by a colon.

You also need a fp-lib-table file that associates the footprint library nicknames with the locations of their footprint directories. This file should be created when you installed KiCad and should be in the \Users\<your name>\AppData\Roaming\KiCad directory. A typical entry in that file looks like this:

(lib (name LED_SMD)(type KiCad)(uri ${KISYSMOD}/LED_SMD.pretty)(options "")(descr "Light emitting diodes (LED), surface mount"))

So my questions are:

  1. Why did KiCad give you get a .net file with just the footprint name and no library nickname or colon?
  2. Do you have an fp-lib-table and is it in the right place?
  3. What version of KiCad are you running? (I'm using the latest release: 5.1.4 under Windows 10.)
xesscorp commented 4 years ago

I haven't gotten any reply on this. Should I close this issue?

ScottHilton commented 4 years ago

Sorry, I got pulled away to another project. I will eventually get back to this project. I think I should be able to fix it with the help you already gave. Thanks for the help.