(kicad_sch, kicadPath='', language="SLICAP")
| 34 | return title.replace('""', '"') |
| 35 | |
| 36 | def _parseKiCADnetlist(kicad_sch, kicadPath='', language="SLICAP"): |
| 37 | fileName = '.'.join(kicad_sch.split('.')[0:-1]) |
| 38 | cirTitle = fileName.split('/')[-1].split('.')[0] |
| 39 | cirName = cirTitle + ".cir" |
| 40 | cirFile = ini.cir_path + cirName |
| 41 | try: |
| 42 | subprocess.run([ini.kicad, 'sch', 'export', 'netlist', '-o', ini.cir_path + kicadPath + fileName + ".net", ini.cir_path + kicadPath + fileName + ".kicad_sch"]) |
| 43 | f = open(ini.cir_path + kicadPath + fileName + ".net", "r") |
| 44 | lines = f.readlines() |
| 45 | f.close() |
| 46 | netlist, subckt, subckt_lib = _parseKiCADnetlistlines(lines, cirTitle, language) |
| 47 | f = open(cirFile, 'w') |
| 48 | f.write(netlist) |
| 49 | f.close() |
| 50 | except FileNotFoundError: |
| 51 | print("\nError: could not run Kicad using '{}'.".format(ini.kicad)) |
| 52 | return cirName |
| 53 | |
| 54 | def _parseKiCADnetlistlines(lines, cirTitle, language): |
| 55 | reserved = ["Description", "Footprint", "Datasheet"] |
no test coverage detected