help='Update the pricing') parser.add_argument('--verbose', '-v', action='store_true', help='Show the verbose output to the terminal') parser.add_argument('--writeCSV', '-w', action='store_true', help='Write BOM to CSV file') args = parser.parse_args() prjname = args.input.split('/')[-1].split('.')[0] print ('Input argument: {0}'.format(args.input)) if args.edaTool.lower() == 'eagle': print ('Eagle EDA-Tool Chosen') bomParts = extractEagleComponents(args.input) elif args.edaTool.lower() == 'kicad': print ('KiCAD EDA-Tool Chosen') bomParts = extractKiCADComponents(args.input) if args.writeCSV: print('Project Name: {0}'.format(prjname)) combinedBOMparts = BOMparts.combineBOMparts(bomParts) numberofparts = len(bomParts) #createCSV(bomParts, prjname, args.output, args.edaTool) createCSV(combinedBOMparts, prjname, args.output, args.edaTool, numberofparts, args.verbose) if args.verbose: print ('Project Components') print ('-'*40)
if foundFlag is False: # part not already in combined parts list # add it combinedparts.append(ipart) return combinedparts if __name__ == 'BOMparts': # Module has been imported # Blank initialization of a global in the scope of the BOMparts partgroups = [] # create the groups createGroupsList() elif __name__ == '__main__': import BOMtools from kicadNetlistParser import extractKiCADComponents # Module is being run directly # This should be done for testing purposes partgroups = [] createGroupsList() # Define some test parts # Test Kicad Parts: kicadNetlistFile = '../SampleFiles/Mainboard.net' kicadparts = extractKiCADComponents(kicadNetlistFile) print('!-----===== Testing Grouping =====-----!') kicadparts[5].setComponentGroup(True) for kpart in kicadparts[6:]: kpart.setComponentGroup(True)