Kicad6 Python bindings SetSelected() selects Vias after use, but cannot be deleted by pressing the Delete key

Either one of the footprints or any element needs to be removed and then undoed before these vias can be deleted using the Delete key

This needs a bit more context, and nobody will type the shown code character by character just to test it.

I might be wrong here, but IIRC the current Python API does not allow changing which items are selected. The [Set|Clear]Selected methods is pcbnew’s internal C++ stuff. Hopefully the new API will be available soon.

Tom

    for t in brd.GetTracks():
            if notselected and t.IsSelected():
                notselected = False
                connections.clear()
            if notselected or t.IsSelected():
                if type(t) is PCB_VIA:
                    # connections[t]  # autovivification
                    brd.Delete(t)
                    bDel = True

Try this code it should work

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