@@ -196,13 +196,33 @@ def parse_schematic_files(self, filename, dict_of_sheets):
196196 sheetname = ""
197197 sheetfile = ""
198198 sheet_id = ""
199+ sn_found = False
200+ sf_found = False
199201 for j in range (i ,i + 10 ):
200202 if "(uuid " in contents [j ]:
201- sheet_id = contents [j ].lstrip ("(uuid " ).rstrip (")" )
202- if "(property \" Sheet name\" " in contents [j ]:
203- sheetname = contents [j ].lstrip ("(property \" Sheet name\" " ).split ()[0 ].replace ("\" " , "" )
204- if "(property \" Sheet file\" " in contents [j ]:
205- sheetfile = contents [j ].lstrip ("(property \" Sheet file\" " ).split ()[0 ].replace ("\" " , "" )
203+ path = contents [j ].replace ("(uuid " , '' ).rstrip (")" ).upper ().strip ()
204+ sheet_id = path .replace ('00000000-0000-0000-0000-0000' , '' )
205+ if "(property \" Sheet name\" " in contents [j ] or "(property \" Sheetname\" " in contents [j ]:
206+ if "(property \" Sheet name\" " in contents [j ]:
207+ sheetname = contents [j ].replace ("(property \" Sheet name\" " , '' ).split ("(" )[0 ].replace ("\" " , "" ).strip ()
208+ sn_found = True
209+ if "(property \" Sheetname\" " in contents [j ]:
210+ sheetname = contents [j ].replace ("(property \" Sheetname\" " , '' ).split ("(" )[0 ].replace ("\" " , "" ).strip ()
211+ sn_found = True
212+ if "(property \" Sheet file\" " in contents [j ] or "(property \" Sheetfile\" " in contents [j ]:
213+ if "(property \" Sheet file\" " in contents [j ]:
214+ sheetfile = contents [j ].replace ("(property \" Sheet file\" " , '' ).split ("(" )[0 ].replace ("\" " , "" ).strip ()
215+ sf_found = True
216+ if "(property \" Sheetfile\" " in contents [j ]:
217+ sheetfile = contents [j ].replace ("(property \" Sheetfile\" " , '' ).split ("(" )[0 ].replace ("\" " , "" ).strip ()
218+ sf_found = True
219+ # properly handle property not found
220+ if not sn_found or not sf_found :
221+ logger .info (f'Did not found sheetfile and/or sheetname properties in the schematic file '
222+ f'in { filename } line:{ str (i )} ' )
223+ raise LookupError (f'Did not found sheetfile and/or sheetname properties in the schematic file '
224+ f'in { filename } line:{ str (i )} . Unsupported schematics file format' )
225+
206226 # here I should find all sheet data
207227 dict_of_sheets [sheet_id ] = [sheetname , sheetfile ]
208228 # open a newfound file and look for nested sheets
0 commit comments