def WhereUsed(part): desc = pysyteline.getitems(part)[0][1] timeformat = format = "%d-%m-%Y %H:%M:%S" timenow = datetime.datetime.today().strftime(timeformat) part_text = part + ' ' + str(desc) date_text = 'As of: ' + timenow f.write('<node STYLE="fork" TEXT="WHERE USED:\n' + part_text + '\n' + date_text + '">\n') f.write('<edge WIDTH="thin"/>\n') result = pysyteline.whereused(part) if result != []: for row in result: material = str(row[0]) materialdesc = str(row[1]) html = string.replace(str(materialdesc), '&' , '&') html2 = string.replace(html, '"' , '"') line = str(row[0]) + ' ' + html2 #print line f.write('<node POSITION="right" TEXT="' + line + '"') f.write('/>\n') #f.write('</node>\n') else: f.write('/>\n') return 'nochild'
outputfile = args[1] if outputfile[-3:] != ".mm": outputfile+=".mm" else: print "WhereUsed version %s" % __VERSION__ print "\n" print "Enter all or part of the part-number or assembly:" part = raw_input() outputfile = "WUmindmap.mm" item_num = 0 item = '%' + part + '%' toplevel = pysyteline.getitems(item) if toplevel == []: print "\nPart %s doesn't exist in Syteline Current Materials." % (part) print "\nPress return to end script.\n" z=raw_input() sys.exit() if len(toplevel) > 1: print "\nMore than one item found:\n" for i, row in enumerate(toplevel): print "%i: %s %s" % (i, row.Item, row.Name) print "\nType number of item or press return to end script.\n" z=raw_input() try: item_num = int(z)