8.0.1 pcbnew refresh ui from python

Hi,

i try to get defaults for new pcbs and as far as i understand i can’t set things like default track widths or via sizes in some template which get loaded for every new board by default.

So i searched a bit and found some python commands which does what i want. I can add default track widths and via sizes programmatically. But when i do this in the scripting console the added track widths or via sizes are not visible in the ui. When i click to edit default tracks or vias i can see the new entries. When i now just click save the ui refreshs and shows my added entries.

I have not found any way to refresh the ui after i added these settings. I tried pcbnew.Refresh() and pcbnew.UpdateUserInterface() but it doesn’t refresh the shown entries in the list.

This is my very simple example to add a track with 0.8mm width and a via with 0.8mm/0.3mm size.

pcb = pcbnew.GetBoard()
designSettings = pcb.GetDesignSettings()

# Add track (0.8mm)
designSettings.m_TrackWidthList.append(800000)

# Add via (0,8mm, 0,3mm)
viaNew = pcbnew.VIA_DIMENSION()
viaNew.m_Diameter = 800000
viaNew.m_Drill = 300000
designSettings.m_ViasDimensionsList.append(viaNew)

Is there a way to refresh the ui after i added the new entries to the internal objects?

Ciao,
Rainer

1 Like