MitjaNemec / Kicad_action_plugins

Kicad action plugins
413 stars 62 forks source link

Swap pins fails to draw nets #27

Open robert128 opened 5 years ago

robert128 commented 5 years ago

Hello Again,

Although you fixed swap_pins, I've found that it fails to move a pin that has already been swapped. I think it's related to the way the nets are drawn on the schematic. When swap_pins moves a pin, it's moving the label to a non-existent net on top of the symbol pin instead of moving the label with it's attached net. If I fix the schematic to include a net, then the swap works.

The anchor for the label could use some adjustment if it's possible. Looks like labels have their anchor on the side of the text that is closest to the symbol, so when labels are moved from one side of a symbol to the other, maybe the anchor can move as well.

Here is the exception I get when I try swap a pin that has already been swapped before:

image

and here is what the schematic looks like as a result of swapped pins:

image

MitjaNemec commented 5 years ago

Can you be more specific, which pins are you trying to swap. Also log for first and second swap would be nice to have.

robert128 commented 5 years ago

Here is what the symbol looks like after some swaps:

swap_pins_image

As you can see, those labels aren't on a net. The nets they would have come from are clear on the left side of the symbol, all short nets with a label. Looks like I can swap a pair of pins over and over, but often if I try to swap one of those swapped pins with another pin, it fails.

Here is the swap file that I saved when I had an error message trying to swap: swap_pins.log

After a day of swapping without trouble, I finally checked the schematic against the layout, and found that the schematic often wasn't getting the changes in the layout. I had to do many of the changes by hand.

I'm sorry I haven't been able to identify any clear patterns for what's happening. I thought it was all related to the labeling issue I highlighted above, but now I'm not so sure.

Here's a new log that includes the swaps that weren't reflected in the schematic. swap_pins.log

MitjaNemec commented 5 years ago

Firstly, I apologize for the data loss.

Secondly, looking at the logs, you are doing some serious testing, and I really appreciate it. I've written the plugin and I've tested it on real projects that I am working on, but my designs are much simpler.

Thirdly, I've located the bug which caused a crash mentioned in the first post and I've pushed the fix.

Regarding the labeling issue, from the your figure did you have the labels connected directly to the pins before swapping? If so, is the main problem the orientation of the labels?

And finally for the data loss, I have one suspect, but as it is late and my head is not working anymore, I am going to deal with this tomorrow.

robert128 commented 5 years ago

Don't worry about the data loss, it's no big deal. I just wanted to give you an accurate account of what is happening.

I'm not in a rush, I'm really thankful that you volunteer your time to make Kicad a more useful tool. I'll try the new update to see if I learn anything else.

robert128 commented 5 years ago

Here's another exception and log:

swap_pins

swap_pins.log

MitjaNemec commented 5 years ago

Man you are really testing it.

This looks like a new issue. If you can recreate it I'd like you to update the plugin as I should have a bit more instrumentation available.