tons of cad tweaks, plus updating all the assemblies. also updates bom files, and edits the CI to export three boms for each of the three widths

This commit is contained in:
Stephen Hawes
2023-06-07 17:20:42 -04:00
parent 40a29fef72
commit b8b7f18827
14 changed files with 153 additions and 99 deletions

View File

@@ -13,108 +13,113 @@ if not os.path.exists(dirName):
else:
print("Directory " , dirName , " already exists")
versions = [
["8mm", "bom-8.csv"],
["12mm", "bom-12.csv"],
["16mm", "bom-16.csv"]
]
# make html file that will become our BOM
f = open(dirName + "/bom_" + sys.argv[1] + ".html", "w")
f.write("""
<!DOCTYPE html>
<head>
<style>
body {
background-color: #222;
padding: 30px;
font-family: helvetica;
color: #fff
}
table {
width: 100%;
position: relative;
border-collapse: collapse;
}
h1 {
color:white;
}
.optional {
background-color: #430;
}
tr.titlerow th {
background-color: goldenrod;
position: sticky;
top: 0;
}
for version in versions:
th, td {
padding: 10px;
text-align: left;
border-bottom: 2px solid #fff
}
a {
color:goldenrod;
}
# make html file that will become our BOM
f = open(dirName + "/" + version[0] + "_feeder_bom_" + sys.argv[1] + ".html", "w")
f.write("""
<!DOCTYPE html>
<head>
<style>
body {
background-color: #222;
padding: 30px;
font-family: helvetica;
color: #fff
}
table {
width: 100%;
position: relative;
border-collapse: collapse;
}
h1 {
color:white;
}
.optional {
background-color: #430;
}
tr.titlerow th {
background-color: goldenrod;
position: sticky;
top: 0;
}
img {
width: 150px;
}
th, td {
padding: 10px;
text-align: left;
border-bottom: 2px solid #fff
}
a {
color:goldenrod;
}
#logo {
width: 250px;
position: absolute;
top: 30px;
right: 50px;
}
img {
width: 150px;
}
tr:hover {
background-color: #444;
}
</style>
</head>
<body>
<h1>
""")
#logo {
width: 250px;
position: absolute;
top: 30px;
right: 50px;
}
#write page title based on script
f.write("LumenPnP Feeder BOM " + sys.argv[1])
tr:hover {
background-color: #444;
}
</style>
</head>
<body>
<h1>
""")
#write the beginning of table, and row for header
f.write("</h1><a href='https://www.github.com/opulo-inc/feeder/releases/' target='_blank' rel='noopener noreferrer'><h2>Download the Source Here</h2></a><a href='https://www.opulo.io/' target='_blank' rel='noopener noreferrer'><img src='https://cdn.shopify.com/s/files/1/0570/4256/7355/files/opulo-white-alpha_1200x1200.png?v=1644515300' id='logo'/></a><table>")
#write page title based on script
f.write("LumenPnP " + version[0] + " Feeder BOM " + sys.argv[1])
with open('bom.csv') as bom:
csv_reader = csv.reader(bom, delimiter=',')
line_count = 0
for row in csv_reader:
column = 0
#write the beginning of table, and row for header
f.write("</h1><a href='https://www.github.com/opulo-inc/feeder/releases/' target='_blank' rel='noopener noreferrer'><h2>Download the Source Here</h2></a><a href='https://www.opulo.io/' target='_blank' rel='noopener noreferrer'><img src='https://cdn.shopify.com/s/files/1/0570/4256/7355/files/opulo-white-alpha_1200x1200.png?v=1644515300' id='logo'/></a><table>")
if line_count == 0: #if header row, just print what's there
f.write("<tr class='titlerow'>")
while column < len(row):
f.write("<th style='color:black;'>" + row[column] + "</th>")
column += 1
else: #if content row
if row[6] != "":
f.write("<tr class='optional'>")
else:
f.write("<tr>")
with open(version[1]) as bom:
csv_reader = csv.reader(bom, delimiter=',')
line_count = 0
for row in csv_reader:
column = 0
while column < len(row):
# handling images
if column == 1 and row[3] != "FDM":
f.write("<th><img src='" + row[column] + "' /></th>")
elif column == 1 and row[3] == "FDM":
f.write("<th><img src='img/" + row[0] + ".png' /></th>")
# handling links
elif (column == 4 or column == 5) and row[3] != "FDM" and row[column] != "":
f.write("<th><a href='" + row[column] + "' target='_blank' rel='noopener noreferrer'/>Link</a></th>")
# all other cells
if line_count == 0: #if header row, just print what's there
f.write("<tr class='titlerow'>")
while column < len(row):
f.write("<th style='color:black;'>" + row[column] + "</th>")
column += 1
else: #if content row
if row[6] != "":
f.write("<tr class='optional'>")
else:
f.write("<th>" + row[column] + "</th>")
column += 1
f.write("</tr>")
line_count += 1
f.write("<tr>")
f.write("</table></body></html>")
while column < len(row):
# handling images
if column == 1 and row[3] != "FDM":
f.write("<th><img src='" + row[column] + "' /></th>")
elif column == 1 and row[3] == "FDM":
f.write("<th><img src='img/" + row[0] + ".png' /></th>")
f.close()
# handling links
elif (column == 4 or column == 5) and row[3] != "FDM" and row[column] != "":
f.write("<th><a href='" + row[column] + "' target='_blank' rel='noopener noreferrer'/>Link</a></th>")
# all other cells
else:
f.write("<th>" + row[column] + "</th>")
column += 1
f.write("</tr>")
line_count += 1
f.write("</table></body></html>")
f.close()