@@ -27,7 +27,7 @@ def __init__(self):
27
27
28
28
self ._pcbnew_frame = None
29
29
30
- self .supportedVersions = ['7.' ,'8.' ]
30
+ self .supportedVersions = ['7.' ,'8.' , '9.' ]
31
31
32
32
self .kicad_build_version = pcbnew .GetBuildVersion ()
33
33
@@ -96,84 +96,84 @@ def Run(self):
96
96
def run_panelizer (dlg , p_panelizer ):
97
97
self .logger .log (logging .INFO , "Running Panelizer" )
98
98
99
- if self .IsSupported ():
100
- command = []
101
-
102
- convertDimensions = 1.0
103
- if dlg .CurrentSettings ()["dimensionsInchesBtn" ]:
104
- convertDimensions = 25.4
105
-
106
- panelx = float (dlg .CurrentSettings ()["panelSizeXCtrl" ]) * convertDimensions
107
- panely = float (dlg .CurrentSettings ()["panelSizeYCtrl" ]) * convertDimensions
108
- command .extend (['--panelx' ,'{:.6f}' .format (panelx )])
109
- command .extend (['--panely' ,'{:.6f}' .format (panely )])
110
-
111
- smallerThan = dlg .CurrentSettings ()["panelSizeSmallerBtn" ]
112
- if smallerThan :
113
- command .append ('--smaller' )
114
- else :
115
- command .append ('--larger' )
116
-
117
- vscorelayer = dlg .CurrentSettings ()[dlg .vscore_layer ]
118
- command .extend (['--vscorelayer' , vscorelayer , '--vscoretextlayer' , vscorelayer ])
119
-
120
- gapx = float (dlg .CurrentSettings ()["gapsVerticalCtrl" ]) * convertDimensions
121
- gapy = float (dlg .CurrentSettings ()["gapsHorizontalCtrl" ]) * convertDimensions
122
- command .extend (['--gapx' ,'{:.6f}' .format (gapx )])
123
- command .extend (['--gapy' ,'{:.6f}' .format (gapy )])
124
-
125
- removeRight = dlg .CurrentSettings ()["removeRightVerticalCheck" ]
126
- if removeRight :
127
- command .append ('--norightgap' )
128
-
129
- exposeedge = dlg .CurrentSettings ()["productionExposeCheck" ]
130
- if exposeedge :
131
- command .append ('--exposeedge' )
132
-
133
- fiducials = dlg .CurrentSettings ()["productionBordersCheck" ]
134
- leftright = dlg .CurrentSettings ()["productionFiducialsCheck" ]
135
- if not exposeedge :
136
- if fiducials :
137
- # Default the rail width to 1/4" and nudge by 1/4 of the rail width.
138
- # This provides the clearance needed for clamping and AOI Inspection of the fiducials.
139
- # This is nasty. The default should be in panelizer.py. But I can't think of a solution
140
- # which is good for everyone - including anyone running the panelizer from the command line.
141
- command .extend (['--hrail' ,'6.35' ,'--vrail' ,'6.35' ])
142
- command .extend (['--fiducialpos' ,'0.25' ])
143
- if leftright :
144
- command .append ('--fiducialslr' )
145
- else :
146
- command .append ('--fiducialstb' )
147
- else :
148
- if fiducials :
149
- # Same comment as above
150
- command .extend (['--vrail' ,'6.35' ])
151
- command .extend (['--fiducialpos' ,'0.25' ])
152
- command .append ('--fiducialslr' )
99
+ if not self .IsSupported ():
100
+ # Log a warning if this version of KiCad has not been tested
101
+ self .logger .log (logging .WARNING , "Version check failed. \" {}\" may not be supported. Panelizing may fail" .format (self .kicad_build_version ))
102
+
103
+ command = []
104
+
105
+ convertDimensions = 1.0
106
+ if dlg .CurrentSettings ()["dimensionsInchesBtn" ]:
107
+ convertDimensions = 25.4
108
+
109
+ panelx = float (dlg .CurrentSettings ()["panelSizeXCtrl" ]) * convertDimensions
110
+ panely = float (dlg .CurrentSettings ()["panelSizeYCtrl" ]) * convertDimensions
111
+ command .extend (['--panelx' ,'{:.6f}' .format (panelx )])
112
+ command .extend (['--panely' ,'{:.6f}' .format (panely )])
153
113
154
- self .logger .log (logging .INFO , command )
155
-
156
- board = pcbnew .GetBoard ()
157
-
158
- if board is not None :
159
- sysExit , report = p_panelizer .startPanelizerCommand (command , board , self .ordering_instructions , self .logger )
160
- logWarn = logging .INFO
161
- if sysExit >= 1 :
162
- logWarn = logging .WARN
163
- if sysExit >= 2 :
164
- logWarn = logging .ERROR
165
- self .logger .log (logWarn , report )
166
- if sysExit > 0 :
167
- wx .MessageBox ("Panelizer " + ("warning" if (sysExit == 1 ) else "error" ) + ".\n Please check panelizer.log for details." ,
168
- ("Warning" if (sysExit == 1 ) else "Error" ), wx .OK | (wx .ICON_WARNING if (sysExit == 1 ) else wx .ICON_ERROR ))
114
+ smallerThan = dlg .CurrentSettings ()["panelSizeSmallerBtn" ]
115
+ if smallerThan :
116
+ command .append ('--smaller' )
117
+ else :
118
+ command .append ('--larger' )
119
+
120
+ vscorelayer = dlg .CurrentSettings ()[dlg .vscore_layer ]
121
+ command .extend (['--vscorelayer' , vscorelayer , '--vscoretextlayer' , vscorelayer ])
122
+
123
+ gapx = float (dlg .CurrentSettings ()["gapsVerticalCtrl" ]) * convertDimensions
124
+ gapy = float (dlg .CurrentSettings ()["gapsHorizontalCtrl" ]) * convertDimensions
125
+ command .extend (['--gapx' ,'{:.6f}' .format (gapx )])
126
+ command .extend (['--gapy' ,'{:.6f}' .format (gapy )])
127
+
128
+ removeRight = dlg .CurrentSettings ()["removeRightVerticalCheck" ]
129
+ if removeRight :
130
+ command .append ('--norightgap' )
131
+
132
+ exposeedge = dlg .CurrentSettings ()["productionExposeCheck" ]
133
+ if exposeedge :
134
+ command .append ('--exposeedge' )
135
+
136
+ fiducials = dlg .CurrentSettings ()["productionBordersCheck" ]
137
+ leftright = dlg .CurrentSettings ()["productionFiducialsCheck" ]
138
+ if not exposeedge :
139
+ if fiducials :
140
+ # Default the rail width to 1/4" and nudge by 1/4 of the rail width.
141
+ # This provides the clearance needed for clamping and AOI Inspection of the fiducials.
142
+ # This is nasty. The default should be in panelizer.py. But I can't think of a solution
143
+ # which is good for everyone - including anyone running the panelizer from the command line.
144
+ command .extend (['--hrail' ,'6.35' ,'--vrail' ,'6.35' ])
145
+ command .extend (['--fiducialpos' ,'0.25' ])
146
+ if leftright :
147
+ command .append ('--fiducialslr' )
169
148
else :
170
- wx .MessageBox ("Panelizer complete.\n Please check panelizer.log for details." ,
171
- "Info" , wx .OK | wx .ICON_INFORMATION )
149
+ command .append ('--fiducialstb' )
150
+ else :
151
+ if fiducials :
152
+ # Same comment as above
153
+ command .extend (['--vrail' ,'6.35' ])
154
+ command .extend (['--fiducialpos' ,'0.25' ])
155
+ command .append ('--fiducialslr' )
156
+
157
+ self .logger .log (logging .INFO , command )
158
+
159
+ board = pcbnew .GetBoard ()
160
+
161
+ if board is not None :
162
+ sysExit , report = p_panelizer .startPanelizerCommand (command , board , self .ordering_instructions , self .logger )
163
+ logWarn = logging .INFO
164
+ if sysExit >= 1 :
165
+ logWarn = logging .WARNING
166
+ if sysExit >= 2 :
167
+ logWarn = logging .ERROR
168
+ self .logger .log (logWarn , report )
169
+ if sysExit > 0 :
170
+ wx .MessageBox ("Panelizer " + ("warning" if (sysExit == 1 ) else "error" ) + ".\n Please check panelizer.log for details." ,
171
+ ("Warning" if (sysExit == 1 ) else "Error" ), wx .OK | (wx .ICON_WARNING if (sysExit == 1 ) else wx .ICON_ERROR ))
172
172
else :
173
- self . logger . log ( logging . ERROR , "Could not get the board" )
174
-
173
+ wx . MessageBox ( "Panelizer complete. \n Please check panelizer.log for details." ,
174
+ "Info" , wx . OK | wx . ICON_INFORMATION )
175
175
else :
176
- self .logger .log (logging .ERROR , "Version check failed. \" {} \" not supported" . format ( self . kicad_build_version ) )
176
+ self .logger .log (logging .ERROR , "Could not get the board" )
177
177
178
178
dlg .GetParent ().EndModal (wx .ID_OK )
179
179
0 commit comments