nturley / netlistsvg

draws an SVG schematic from a JSON netlist

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

java.lang.ClassCastException sometimes when pins of a part are connected only to each other

amstan opened this issue · comments

I've been working on some complex importing from kicad. The importer is not finished yet, so I have some malformed schematics (ex: stuff isn't all the way connected).

I came upon this error:
java.lang.ClassCastException
Then nothing, the svg file just contains "undefined".
Are there any good ways to start a debugger on this?
I'm still use nodejs ~/netlistsvg/bin/netlistsvg.js --skin ~/netlistsvg/lib/analog.svg out.json to run netlistsvg.

I tried to simplify my file to track down the problem. One of the problems is on U3.
{
	"modules": {
		"SVG Output": {
			"cells": {
				"power_symbol_16": {
					"connections": {
						"A": [
							16
						]
					},
					"attributes": {},
					"type": "gnd"
				},
				"power_symbol_15": {
					"connections": {
						"A": [
							112
						]
					},
					"attributes": {},
					"type": "gnd"
				},
				"U3": {
					"connections": {
						"A0 (2)": [
							0
						],
						"A1 (3)": [
							2
						],
						"A2 (4)": [
							4
						],
						"A3 (5)": [
							6
						],
						"A4 (6)": [
							8
						],
						"A5 (7)": [
							10
						],
						"A6 (8)": [
							12
						],
						"A7 (9)": [
							12
						],
						"G1 (1)": [
							16
						],
						"G2 (19)": [
							116
						],
						"VCC (20)": [
							19
						],
						"GND (10)": [
							20
						],
						"Y0 (18)": [
							21
						],
						"Y1 (17)": [
							22
						],
						"Y2 (16)": [
							23
						],
						"Y3 (15)": [
							25
						],
						"Y4 (14)": [
							26
						],
						"Y5 (13)": [
							28
						],
						"Y6 (12)": [
							29
						],
						"Y7 (11)": [
							31
						]
					},
					"port_directions": {
						"A0 (2)": "input",
						"A1 (3)": "input",
						"A2 (4)": "input",
						"A3 (5)": "input",
						"A4 (6)": "input",
						"A5 (7)": "input",
						"A6 (8)": "input",
						"A7 (9)": "input",
						"G1 (1)": "input",
						"G2 (19)": "input",
						"VCC (20)": "output",
						"GND (10)": "output",
						"Y0 (18)": "output",
						"Y1 (17)": "output",
						"Y2 (16)": "output",
						"Y3 (15)": "output",
						"Y4 (14)": "output",
						"Y5 (13)": "output",
						"Y6 (12)": "output",
						"Y7 (11)": "output"
					},
					"attributes": {
						"value": "74LS541"
					},
					"type": "U3"
				},

			},
			"ports": {}
		}
	}
}

It has to do with net number 12 (connected to pins A6 and A7). If I connect power_symbol_15 to it (s/112/12), then it renders without errors.

Oddly this works (a smaller example)
{
	"modules": {
		"SVG Output": {
			"cells": {
				"gnd": {
					"connections": {
						"A": [
							4
						]
					},
					"attributes": {},
					"type": "gnd"
				},
				"U3": {
					"connections": {
						"A0": [
							1
						],
						"A1": [
							1
						],
						"VCC": [
							3
						],
						"GND": [
							4
						],
					},
					"port_directions": {
						"A0": "input",
						"A1": "input",
						"VCC": "output",
						"GND": "output",
					},
					"attributes": {
						"value": "74LS541"
					},
					"type": "U3"
				},

			},
			"ports": {}
		}
	}
}
Look for net 1. I wanted to toggle the gnd between net 4 and net 1 to show when it crashes and when it doesn't. But it always works.