diff --git a/AnnularChecker/AnnularDlg.fbp b/AnnularChecker/AnnularDlg.fbp index e950dca..feb6204 100644 --- a/AnnularChecker/AnnularDlg.fbp +++ b/AnnularChecker/AnnularDlg.fbp @@ -107,7 +107,7 @@ Resizable 1 - + 180,114 ; ; forward_declare 0 diff --git a/AnnularChecker/AnnularDlg.py b/AnnularChecker/AnnularDlg.py index 8ade45d..41a13b4 100644 --- a/AnnularChecker/AnnularDlg.py +++ b/AnnularChecker/AnnularDlg.py @@ -23,7 +23,7 @@ class AnnularDlg ( wx.Dialog ): bSizer3 = wx.BoxSizer( wx.VERTICAL ) - self.m_bitmapAR = wx.StaticBitmap( self, wx.ID_ANY, wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_bitmapAR = wx.StaticBitmap( self, wx.ID_ANY, wx.NullBitmap, wx.DefaultPosition, wx.Size( 180,114 ), 0 ) bSizer3.Add( self.m_bitmapAR, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 ) self.m_LabelTitle = wx.StaticText( self, wx.ID_ANY, u"Check annular ring", wx.DefaultPosition, wx.DefaultSize, 0 ) diff --git a/AnnularChecker/annular-help.png b/AnnularChecker/annular-help.png new file mode 100644 index 0000000..bc0b1b5 Binary files /dev/null and b/AnnularChecker/annular-help.png differ diff --git a/AnnularChecker/annular-help.svg b/AnnularChecker/annular-help.svg new file mode 100644 index 0000000..7ce6aef --- /dev/null +++ b/AnnularChecker/annular-help.svg @@ -0,0 +1,221 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DRILL + AR + + diff --git a/AnnularChecker/annular_checker.py b/AnnularChecker/annular_checker.py index 9a782d1..92a5cc3 100644 --- a/AnnularChecker/annular_checker.py +++ b/AnnularChecker/annular_checker.py @@ -126,7 +126,7 @@ class Annular_Dlg(AnnularDlg.AnnularDlg): #c1.Bind(wx.EVT_CHECKBOX, self.OntextMetric, c1) #self.m_checkBoxPHD.Bind(wx.EVT_CHECKBOX, self.OnClickCheck, self.m_checkBoxPHD) self.m_checkBoxPHD.Bind(wx.EVT_CHECKBOX, self.OnClickCheck) - self.m_bitmapAR.SetBitmap(wx.Bitmap(os.path.join(os.path.dirname(__file__), "./annular.png"))) + self.m_bitmapAR.SetBitmap(wx.Bitmap(os.path.join(os.path.dirname(__file__), "./annular-help.png"))) #self.Bind(wx.EVT_CHECKBOX, self.OnClickCheck) #self.m_buttonDelete.Bind(wx.EVT_BUTTON, self.onDeleteClick) @@ -185,7 +185,7 @@ class annular_check( pcbnew.ActionPlugin ): _pcbnew_frame = [x for x in wx.GetTopLevelWindows() if x.GetTitle().lower().startswith('pcbnew')][0] #aParameters = RoundTrackDlg(None) aParameters = Annular_Dlg(_pcbnew_frame) - aParameters.m_LabelTitle.SetLabel("Check annular ring: version: "+___version___) + aParameters.m_LabelTitle.SetLabel("version: "+___version___) aParameters.m_textCtrlARP.SetToolTip( wx.ToolTip(u"Annular Ring for Pads (mm)" )) aParameters.m_staticTextPHD.SetToolTip( wx.ToolTip(u"Drill extra margin (mm)" )) aParameters.m_textCtrlARV.SetToolTip( wx.ToolTip(u"Annular Ring for Vias (mm)" )) diff --git a/FabricationPositions/PositionsDlg.fbp b/FabricationPositions/PositionsDlg.fbp index 6eeb1cf..295d1c4 100644 --- a/FabricationPositions/PositionsDlg.fbp +++ b/FabricationPositions/PositionsDlg.fbp @@ -45,7 +45,7 @@ PositionsDlg - 499,296 + 499,377 wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER Generating Fab Positions @@ -168,7 +168,7 @@ Resizable 1 - + 180,90 ; ; forward_declare 0 diff --git a/FabricationPositions/PositionsDlg.py b/FabricationPositions/PositionsDlg.py index 36cd0c3..9d729a4 100644 --- a/FabricationPositions/PositionsDlg.py +++ b/FabricationPositions/PositionsDlg.py @@ -17,7 +17,7 @@ import wx.xrc class PositionsDlg ( wx.Dialog ): def __init__( self, parent ): - wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"Generating Fab Positions", pos = wx.DefaultPosition, size = wx.Size( 499,296 ), style = wx.CAPTION|wx.CLOSE_BOX|wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER ) + wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"Generating Fab Positions", pos = wx.DefaultPosition, size = wx.Size( 499,377 ), style = wx.CAPTION|wx.CLOSE_BOX|wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER ) self.SetSizeHints( wx.DefaultSize, wx.DefaultSize ) @@ -28,7 +28,7 @@ class PositionsDlg ( wx.Dialog ): bSizer3.Add( self.m_comment, 0, wx.ALL|wx.EXPAND, 5 ) - self.m_bitmapFab = wx.StaticBitmap( self, wx.ID_ANY, wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_bitmapFab = wx.StaticBitmap( self, wx.ID_ANY, wx.NullBitmap, wx.DefaultPosition, wx.Size( 180,90 ), 0 ) bSizer3.Add( self.m_bitmapFab, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 ) self.m_staticline2 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) diff --git a/FabricationPositions/fabrication-footprint-positions.png b/FabricationPositions/fabrication-footprint-positions.png new file mode 100644 index 0000000..ba2d0d8 Binary files /dev/null and b/FabricationPositions/fabrication-footprint-positions.png differ diff --git a/FabricationPositions/fabrication-footprint-positions.svg b/FabricationPositions/fabrication-footprint-positions.svg new file mode 100644 index 0000000..bb576a5 --- /dev/null +++ b/FabricationPositions/fabrication-footprint-positions.svg @@ -0,0 +1,209 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FabricationPositions/fabrication_positions.py b/FabricationPositions/fabrication_positions.py index 98c1eb3..6da3d70 100644 --- a/FabricationPositions/fabrication_positions.py +++ b/FabricationPositions/fabrication_positions.py @@ -291,7 +291,7 @@ class Positions_Dlg(PositionsDlg.PositionsDlg): PositionsDlg.PositionsDlg.__init__(self, parent) #self.GetSizer().Fit(self) self.SetMinSize(self.GetSize()) - self.m_bitmapFab.SetBitmap(wx.Bitmap(os.path.join(os.path.dirname(__file__), "./fabrication.png"))) + self.m_bitmapFab.SetBitmap(wx.Bitmap(os.path.join(os.path.dirname(__file__), "./fabrication-footprint-positions.png"))) # self.m_buttonDelete.Bind(wx.EVT_BUTTON, self.onDeleteClick) # self.m_buttonReconnect.Bind(wx.EVT_BUTTON, self.onConnectClick) # if wx.__version__ < '4.0': diff --git a/Snap2Grid/Snap2GridDlg.fbp b/Snap2Grid/Snap2GridDlg.fbp index 4371a0b..930c753 100644 --- a/Snap2Grid/Snap2GridDlg.fbp +++ b/Snap2Grid/Snap2GridDlg.fbp @@ -45,7 +45,7 @@ Snap2GridDlg - 499,491 + 499,584 wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER Snap to Grid @@ -119,6 +119,64 @@ -1 + + 5 + wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_bitmapS2G + 1 + + + protected + 1 + + Resizable + 1 + 100,100 + ; ; forward_declare + 0 + + + + + + 5 @@ -254,64 +312,6 @@ - - 5 - wxALIGN_CENTER_VERTICAL|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_bitmapS2G - 1 - - - protected - 1 - - Resizable - 1 - - ; ; forward_declare - 0 - - - - - - diff --git a/Snap2Grid/Snap2GridDlg.py b/Snap2Grid/Snap2GridDlg.py index 7119dd9..0de6ae9 100644 --- a/Snap2Grid/Snap2GridDlg.py +++ b/Snap2Grid/Snap2GridDlg.py @@ -17,7 +17,7 @@ import wx.xrc class Snap2GridDlg ( wx.Dialog ): def __init__( self, parent ): - wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"Snap to Grid", pos = wx.DefaultPosition, size = wx.Size( 499,491 ), style = wx.CAPTION|wx.CLOSE_BOX|wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER ) + wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"Snap to Grid", pos = wx.DefaultPosition, size = wx.Size( 499,584 ), style = wx.CAPTION|wx.CLOSE_BOX|wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER ) self.SetSizeHints( wx.DefaultSize, wx.DefaultSize ) @@ -28,6 +28,9 @@ class Snap2GridDlg ( wx.Dialog ): bSizer3.Add( self.m_comment, 0, wx.ALL|wx.EXPAND, 5 ) + self.m_bitmapS2G = wx.StaticBitmap( self, wx.ID_ANY, wx.NullBitmap, wx.DefaultPosition, wx.Size( 100,100 ), 0 ) + bSizer3.Add( self.m_bitmapS2G, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) + bSizer31 = wx.BoxSizer( wx.HORIZONTAL ) self.m_staticTextGrid = wx.StaticText( self, wx.ID_ANY, u"Grid", wx.DefaultPosition, wx.DefaultSize, 0 ) @@ -40,9 +43,6 @@ class Snap2GridDlg ( wx.Dialog ): self.m_comboBoxGrid.SetSelection( 0 ) bSizer31.Add( self.m_comboBoxGrid, 0, wx.ALL|wx.EXPAND, 5 ) - self.m_bitmapS2G = wx.StaticBitmap( self, wx.ID_ANY, wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, 0 ) - bSizer31.Add( self.m_bitmapS2G, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) - bSizer3.Add( bSizer31, 0, 0, 5 ) diff --git a/Snap2Grid/snap2grid-help.png b/Snap2Grid/snap2grid-help.png new file mode 100644 index 0000000..61b3327 Binary files /dev/null and b/Snap2Grid/snap2grid-help.png differ diff --git a/Snap2Grid/snap2grid-help.svg b/Snap2Grid/snap2grid-help.svg new file mode 100644 index 0000000..5f628df --- /dev/null +++ b/Snap2Grid/snap2grid-help.svg @@ -0,0 +1,243 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Snap2Grid/snap2grid.py b/Snap2Grid/snap2grid.py index 3f021ac..953f34b 100644 --- a/Snap2Grid/snap2grid.py +++ b/Snap2Grid/snap2grid.py @@ -56,7 +56,7 @@ class Snap2Grid_Dlg(Snap2GridDlg.Snap2GridDlg): Snap2GridDlg.Snap2GridDlg.__init__(self, parent) #self.GetSizer().Fit(self) self.SetMinSize(self.GetSize()) - self.m_bitmapS2G.SetBitmap(wx.Bitmap(os.path.join(os.path.dirname(__file__), "./snap2grid.png"))) + self.m_bitmapS2G.SetBitmap(wx.Bitmap(os.path.join(os.path.dirname(__file__), "./snap2grid-help.png"))) #self.SetIcon(wx.IconFromBitmap(wx.Bitmap(os.path.join(os.path.dirname(__file__), "./snap2grid.png")))) #self.m_buttonDelete.Bind(wx.EVT_BUTTON, self.onDeleteClick) #self.m_buttonReconnect.Bind(wx.EVT_BUTTON, self.onConnectClick) diff --git a/Snap2Grid/snap2grid.py.bak b/Snap2Grid/snap2grid.py.bak index 0d50bc7..15ecdfc 100644 --- a/Snap2Grid/snap2grid.py.bak +++ b/Snap2Grid/snap2grid.py.bak @@ -8,11 +8,7 @@ #import snaptogrid; import importlib; importlib.reload(snaptogrid) -### plugins errors -#import pcbnew -#pcbnew.GetWizardsBackTrace() - -__version__ = '1.0.2' +__version__ = '1.0.1' import sys, os import pcbnew import datetime @@ -21,11 +17,11 @@ from pcbnew import * use_grid_origin = True -gridReference = 0.1 #1.27 #mm pcbnew.FromMM(1.0) #0.1mm +gridReference = 2.54 #1.27 #mm pcbnew.FromMM(1.0) #0.1mm gridSizeMM = gridReference -from . import Snap2GridDlg +#from . import Send2GridDlg sys.path.append(os.path.dirname(__file__)) @@ -36,38 +32,36 @@ def wxLogDebug(msg,dbg): wx.LogMessage(msg) # -class Snap2Grid_Dlg(Snap2GridDlg.Snap2GridDlg): - # from https://github.com/MitjaNemec/Kicad_action_plugins - # hack for new wxFormBuilder generating code incompatible with old wxPython - # noinspection PyMethodOverriding - def SetSizeHints(self, sz1, sz2): - if wx.__version__ < '4.0': - self.SetSizeHintsSz(sz1, sz2) - else: - super(Snap2Grid_Dlg, self).SetSizeHints(sz1, sz2) - - # def onDeleteClick(self, event): - # return self.EndModal(wx.ID_DELETE) - # - # def onConnectClick(self, event): - # return self.EndModal(wx.ID_REVERT) - - def __init__(self, parent): - import wx - Snap2GridDlg.Snap2GridDlg.__init__(self, parent) - #self.GetSizer().Fit(self) - self.SetMinSize(self.GetSize()) - self.m_bitmapS2G.SetBitmap(wx.Bitmap(os.path.join(os.path.dirname(__file__), "./snap2grid.png"))) - #self.SetIcon(wx.IconFromBitmap(wx.Bitmap(os.path.join(os.path.dirname(__file__), "./snap2grid.png")))) - #self.m_buttonDelete.Bind(wx.EVT_BUTTON, self.onDeleteClick) - #self.m_buttonReconnect.Bind(wx.EVT_BUTTON, self.onConnectClick) - #if wx.__version__ < '4.0': - # self.m_buttonReconnect.SetToolTipString( u"Select two converging Tracks to re-connect them\nor Select tracks including one round corner to be straighten" ) - # self.m_buttonRound.SetToolTipString( u"Select two connected Tracks to round the corner\nThen choose distance from intersection and the number of segments" ) - #else: - # self.m_buttonReconnect.SetToolTip( u"Select two converging Tracks to re-connect them\nor Select tracks including one round corner to be straighten" ) - # self.m_buttonRound.SetToolTip( u"Select two connected Tracks to round the corner\nThen choose distance from intersection and the number of segments" ) - +#class Snap2Grid_Dlg(Snap2GridDlg.Snap2GridDlg): +# # from https://github.com/MitjaNemec/Kicad_action_plugins +# # hack for new wxFormBuilder generating code incompatible with old wxPython +# # noinspection PyMethodOverriding +# def SetSizeHints(self, sz1, sz2): +# if wx.__version__ < '4.0': +# self.SetSizeHintsSz(sz1, sz2) +# else: +# super(RoundTrack_Dlg, self).SetSizeHints(sz1, sz2) +# +# # def onDeleteClick(self, event): +# # return self.EndModal(wx.ID_DELETE) +# # +# # def onConnectClick(self, event): +# # return self.EndModal(wx.ID_REVERT) +# +# def __init__(self, parent): +# import wx +# Send2GridDlg.Send2GridDlg.__init__(self, parent) +# #self.GetSizer().Fit(self) +# self.SetMinSize(self.GetSize()) +# #self.m_buttonDelete.Bind(wx.EVT_BUTTON, self.onDeleteClick) +# #self.m_buttonReconnect.Bind(wx.EVT_BUTTON, self.onConnectClick) +# #if wx.__version__ < '4.0': +# # self.m_buttonReconnect.SetToolTipString( u"Select two converging Tracks to re-connect them\nor Select tracks including one round corner to be straighten" ) +# # self.m_buttonRound.SetToolTipString( u"Select two connected Tracks to round the corner\nThen choose distance from intersection and the number of segments" ) +# #else: +# # self.m_buttonReconnect.SetToolTip( u"Select two converging Tracks to re-connect them\nor Select tracks including one round corner to be straighten" ) +# # self.m_buttonRound.SetToolTip( u"Select two connected Tracks to round the corner\nThen choose distance from intersection and the number of segments" ) +# # Python plugin stuff class snap_to_grid( pcbnew.ActionPlugin ): """ @@ -83,9 +77,9 @@ class snap_to_grid( pcbnew.ActionPlugin ): self.description should be a comprehensive description of the plugin """ - self.name = "Snap Selected Footprint(s) to Grid \nversion "+__version__ + self.name = "Snap Selected Module(s) to Grid\nversion "+__version__ self.category = "Modify PCB" - self.description = "Automaticaly Snap Selected Footprint Module(s) to Grid on an existing PCB" + self.description = "Automaticaly Snap Selected Module(s) to Grid on an existing PCB" #self.pcbnew_icon_support = hasattr(self, "show_toolbar_button") self.show_toolbar_button = True self.icon_file_name = os.path.join(os.path.dirname(__file__), './snap2grid.png') @@ -95,131 +89,111 @@ class snap_to_grid( pcbnew.ActionPlugin ): #self.pcb = GetBoard() import sys,os #mm_ius = 1000000.0 - _pcbnew_frame = [x for x in wx.GetTopLevelWindows() if x.GetTitle().lower().startswith('pcbnew')][0] - #aParameters = RoundTrackDlg(None) - aParameters = Snap2Grid_Dlg(_pcbnew_frame) - gridIndex = aParameters.m_comboBoxGrid.FindString('0.1mm (3.94mils)') - aParameters.m_comboBoxGrid.SetSelection(gridIndex) - #aParameters.m_comboBoxGrid.Append('0.1mm (3.94mils)') - aParameters.m_radioBtnGO.SetValue(True) - aParameters.Show() - modal_result = aParameters.ShowModal() - if modal_result == wx.ID_OK: - grid = aParameters.m_comboBoxGrid.GetStringSelection() - gridSizeMM = float(grid.split('mm')[0]) - if aParameters.m_radioBtnGO.GetValue(): - use_grid_origin = True - else: - use_grid_origin = False - snap2grid(gridSizeMM,use_grid_origin) - else: - None # Cancel -## - -def snap2grid(gridSizeMM,use_grid_origin): - - pcb = pcbnew.GetBoard() - gridOrigin = pcb.GetGridOrigin() - auxOrigin = pcb.GetAuxOrigin() - content='' - locked_fp='' - #wxPoint(77470000, 135890000) - for module in pcb.GetModules(): - if module.IsSelected(): - if use_grid_origin: - mpx = module.GetPosition().x - gridOrigin.x - mpy = module.GetPosition().y - gridOrigin.y - #print(mpx,mpy) - mpxOnG = int(mpx/FromMM(gridSizeMM))*FromMM(gridSizeMM)+ gridOrigin.x - mpyOnG = int(mpy/FromMM(gridSizeMM))*FromMM(gridSizeMM)+ gridOrigin.y - #print(mpxOnG,mpyOnG) - locked='' - if not module.IsLocked(): - module.SetPosition(wxPoint(mpxOnG,mpyOnG)) + pcb = pcbnew.GetBoard() + gridOrigin = pcb.GetGridOrigin() + auxOrigin = pcb.GetAuxOrigin() + content='' + locked_fp='' + #wxPoint(77470000, 135890000) + for module in pcb.GetModules(): + if module.IsSelected(): + if use_grid_origin: + mpx = module.GetPosition().x - gridOrigin.x + mpy = module.GetPosition().y - gridOrigin.y + print(mpx,mpy) + mpxOnG = int(mpx/FromMM(gridSizeMM))*FromMM(gridSizeMM)+ gridOrigin.x + mpyOnG = int(mpy/FromMM(gridSizeMM))*FromMM(gridSizeMM)+ gridOrigin.y + print(mpxOnG,mpyOnG) + locked='' + if not module.IsLocked(): + module.SetPosition(wxPoint(mpxOnG,mpyOnG)) + else: + locked='LOCKED' + X_POS=str(module.GetPosition().x) # - gridOrigin.x) + #X_POS='{0:.4f}'.format(pcbnew.ToMM(module.GetPosition().x - gridOrigin.x )) + X_POS="{0:<11}".format(X_POS) + Y_POS=str(module.GetPosition().y) # - gridOrigin.y) + Y_POS="{0:<11}".format(Y_POS) + ## mpOnGx = PutOnGridMM(module.GetPosition().x, gridSizeMM) + ## mpOnGy = PutOnGridMM(module.GetPosition().y, gridSizeMM) + ## module.SetPosition(wxPoint(mpOnGx,mpOnGy)) + #module.SetPosition(wxPoint(mpOnGx+FromMM(100.0),mpOnGy+FromMM(2.0))) + #module.SetOrientation(10) + #Y_POS='{0:.4f}'.format(-1*pcbnew.ToMM(module.GetPosition().y - gridOrigin.y)) + # else: + # mpx = module.GetPosition().x - auxOrigin().x + # mpy = module.GetPosition().y - auxOrigin().y + # X_POS='{0:.4f}'.format(pcbnew.ToMM(module.GetPosition().x - auxOrigin().x )) + # X_POS="{0:<11}".format(X_POS) + # Y_POS='{0:.4f}'.format(-1*pcbnew.ToMM(module.GetPosition().y - auxOrigin().y)) + # Y_POS="{0:<11}".format(Y_POS) + Reference="{0:<10}".format(str(module.GetReference())) + Value = str(module.GetValue()) + Value=(Value[:17] + '..') if len(Value) > 19 else Value + Value="{0:<20}".format(Value) + Rotation='{0:.1f}'.format((module.GetOrientation()/10)) + Rotation="{0:>6}".format(Rotation)+' ' + if module.GetLayer() == 0: + Layer=" top" else: - locked='LOCKED' - X_POS=str(module.GetPosition().x) # - gridOrigin.x) - #X_POS='{0:.4f}'.format(pcbnew.ToMM(module.GetPosition().x - gridOrigin.x )) - X_POS="{0:<11}".format(X_POS) - Y_POS=str(module.GetPosition().y) # - gridOrigin.y) - Y_POS="{0:<11}".format(Y_POS) - ## mpOnGx = PutOnGridMM(module.GetPosition().x, gridSizeMM) - ## mpOnGy = PutOnGridMM(module.GetPosition().y, gridSizeMM) - ## module.SetPosition(wxPoint(mpOnGx,mpOnGy)) - #module.SetPosition(wxPoint(mpOnGx+FromMM(100.0),mpOnGy+FromMM(2.0))) - #module.SetOrientation(10) - #Y_POS='{0:.4f}'.format(-1*pcbnew.ToMM(module.GetPosition().y - gridOrigin.y)) - else: # AuxOrigin - mpx = module.GetPosition().x - auxOrigin.x - mpy = module.GetPosition().y - auxOrigin.y - #print(mpx,mpy) - mpxOnG = int(mpx/FromMM(gridSizeMM))*FromMM(gridSizeMM)+ auxOrigin.x - mpyOnG = int(mpy/FromMM(gridSizeMM))*FromMM(gridSizeMM)+ auxOrigin.y - #print(mpxOnG,mpyOnG) - locked='' - if not module.IsLocked(): - module.SetPosition(wxPoint(mpxOnG,mpyOnG)) - else: - locked='LOCKED' - X_POS=str(module.GetPosition().x) # - gridOrigin.x) - #X_POS='{0:.4f}'.format(pcbnew.ToMM(module.GetPosition().x - gridOrigin.x )) - X_POS="{0:<11}".format(X_POS) - Y_POS=str(module.GetPosition().y) # - gridOrigin.y) - Y_POS="{0:<11}".format(Y_POS) - ## mpOnGx = PutOnGridMM(module.GetPosition().x, gridSizeMM) - ## mpOnGy = PutOnGridMM(module.GetPosition().y, gridSizeMM) - ## module.SetPosition(wxPoint(mpOnGx,mpOnGy)) - #module.SetPosition(wxPoint(mpOnGx+FromMM(100.0),mpOnGy+FromMM(2.0))) - #module.SetOrientation(10) - #Y_POS='{0:.4f}'.format(-1*pcbnew.ToMM(module.GetPosition().y - gridOrigin.y)) - Reference="{0:<10}".format(str(module.GetReference())) - Value = str(module.GetValue()) - Value=(Value[:17] + '..') if len(Value) > 19 else Value - Value="{0:<20}".format(Value) - Rotation='{0:.1f}'.format((module.GetOrientation()/10)) - Rotation="{0:>6}".format(Rotation)+' ' - if module.GetLayer() == 0: - Layer=" top" - else: - Layer=" bottom" - #Side="## Side :"+Layer+lsep - Layer="{0:<10}".format(Layer) - content+=Reference - if 'LOCKED' in locked: - locked_fp+=Reference + ' LOCKED'+'\n' #os.linesep - #content+=Value - content+=X_POS - content+=Y_POS - #content+=str(mpOnGx) - #content+=str(mpOnGy) - content+=str(mpxOnG) - content+=str(mpyOnG) - content+=Layer+'\n' #os.linesep - if len(content)>0: - content+=str(pcbnew.FromMM(gridSizeMM))+'\n' - info='Snapped to grid: '+str(gridSizeMM)+'mm\n' - if use_grid_origin: - content+="Using GridOrigin as Ref"+'\n' - info+="Using GridOrigin as Ref"+'\n' - else: - content+="Using AuxOrigin as Ref"+'\n' - info+="Using AuxOrigin as Ref"+'\n' - if debug: + Layer=" bottom" + #Side="## Side :"+Layer+lsep + Layer="{0:<10}".format(Layer) + content+=Reference + if 'LOCKED' in locked: + locked_fp+=Reference + ' LOCKED'+'\n' #os.linesep + #content+=Value + content+=X_POS + content+=Y_POS + #content+=str(mpOnGx) + #content+=str(mpOnGy) + content+=str(mpxOnG) + content+=str(mpyOnG) + content+=Layer+'\n' #os.linesep + if len(content)>0: + content+=str(pcbnew.FromMM(gridReference)) wxLogDebug(content,debug) - #else: - wxLogDebug(info,True) - if len (locked_fp)>0: - locked_fp+='\n'+'NOT Moved (Locked fp)' - locked_fp+='\n'+info - wxLogDebug(locked_fp,True) + if len (locked_fp)>0: + locked_fp+='\n'+'NOT Moved' + wxLogDebug(locked_fp,True) else: - wxLogDebug(info,True) - else: - wxLogDebug('No Modules Selected',True) - Refresh() - #return content + wxLogDebug('No Modules Selected',True) + Refresh() + #return content + #if 0: + # #from https://github.com/MitjaNemec/Kicad_action_plugins + # #hack wxFormBuilder py2/py3 + # _pcbnew_frame = [x for x in wx.GetTopLevelWindows() if x.GetTitle().lower().startswith('pcbnew')][0] + # #aParameters = RoundTrackDlg(None) + # aParameters = RoundTrack_Dlg(_pcbnew_frame) + # #aParameters = RoundTrack_DlgEx(_pcbnew_frame) + # aParameters.Show() + # #end hack + # aParameters.m_distanceMM.SetValue("5") + # aParameters.m_segments.SetValue("16") + # aParameters.m_bitmap1.SetBitmap(wx.Bitmap( os.path.join(os.path.dirname(os.path.realpath(__file__)), "round_track_help.png") ) ) + # modal_result = aParameters.ShowModal() + # segments = self.CheckSegmentsInput( + # aParameters.m_segments.GetValue(), "number of segments") + # distI = FromMM(self.CheckDistanceInput(aParameters.m_distanceMM.GetValue(), "distance from intersection")) + # if segments is not None and distI is not None: + # if modal_result == wx.ID_OK: + # Round_Selection(pcb, distI, segments) + # elif modal_result == wx.ID_DELETE: + # Delete_Segments(pcb) + # #wx.LogMessage('Round Segments on Track Net Deleted') + # elif modal_result == wx.ID_REVERT: + # wxLogDebug('Connecting Tracks',debug) + # Connect_Segments(pcb) + # else: + # None # Cancel + # else: + # None # Invalid input + # aParameters.Destroy() + + # wxLogDebug('showing Selected Tracks',debug) # wx.LogMessage('Select Tracks to calculate the Length\nor One Pad to select connected Tracks') # diff --git a/Snap2Grid/snap2grid.svg b/Snap2Grid/snap2grid.svg index 3875f66..b27798a 100644 --- a/Snap2Grid/snap2grid.svg +++ b/Snap2Grid/snap2grid.svg @@ -7,15 +7,15 @@ xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - height="26" - width="26" - version="1.1" - id="svg2" - inkscape:version="0.92.3 (2405546, 2018-03-11)" + inkscape:export-ydpi="553.84998" + inkscape:export-xdpi="553.84998" + inkscape:export-filename="C:\Users\userC\AppData\Roaming\kicad\scripting\plugins\kicad-action-tools\Snap2Grid\snap2grid.png" sodipodi:docname="snap2grid.svg" - inkscape:export-filename="/home/mau/.kicad_plugins/kicad-action-tools/Snap2Grid/snap2grid.png" - inkscape:export-xdpi="118.15385" - inkscape:export-ydpi="118.15385"> + inkscape:version="1.0beta2 (c8d5c0e, 2020-01-08)" + id="svg2" + version="1.1" + width="26" + height="26"> @@ -31,212 +31,213 @@ + inkscape:window-y="-7" + inkscape:window-x="-7" + inkscape:cy="20.096351" + inkscape:cx="12.998223" + inkscape:zoom="11.480769" + inkscape:snap-to-guides="true" + inkscape:snap-grids="true" + showgrid="true" + id="namedview68" + inkscape:window-height="1010" + inkscape:window-width="1920" + inkscape:pageshadow="2" + inkscape:pageopacity="0" + guidetolerance="10" + gridtolerance="10" + objecttolerance="10" + borderopacity="1" + bordercolor="#666666" + pagecolor="#ffffff"> + spacingy="0.5" + spacingx="0.5" + snapvisiblegridlinesonly="true" + enabled="true" + visible="true" + empspacing="1" + id="grid3049" + type="xygrid" /> - + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + inkscape:connector-curvature="0" + style="fill:#333333;fill-rule:evenodd;fill-opacity:1" /> + id="g4164" + transform="matrix(0.67334578,0,0,0.67334578,6.072015,-0.80029514)"> + id="rect51" + inkscape:connector-curvature="0" /> + id="g3983" + transform="translate(-0.53360319)"> - + - + + y="18.488895" + width="6.0590835" + height="4.0659709" + transform="rotate(-90)" + style="fill:#00c921;fill-opacity:1;stroke:#545454;stroke-width:0.93241322;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + transform="translate(-0.53360319,16.090848)" + id="g3983-1"> - + - + + y="18.488895" + width="6.0590835" + height="4.0659709" + transform="rotate(-90)" + style="fill:#00c921;fill-opacity:1;stroke:#545454;stroke-width:0.93241322;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> - + - + id="path3815" + d="m 11,19 a 1,1.0015023 0 0 1 -2,0 1,1.0015023 0 1 1 2,0 z" /> +