Preserve previously extracted brick family indices

merge/2021-11-19
kaetemi 4 years ago
parent 5346d2b15e
commit c4025de222
No known key found for this signature in database
GPG Key ID: 9873C4D40BB479BC

@ -22,6 +22,21 @@ listPathExt(sbrickPath, ".sbrick")
sbrickMap = {}
def loadTsv(filename):
table = []
with open(filename, "r") as f:
for l in f:
table += [ l.strip().split("\t") ]
return table;
preserveIndex = True
if preserveIndex:
table = loadTsv("sbrick_index.tsv")
for entry in table:
e = filter(None, entry)
entryName = e[0] + str(int(e[1])).zfill(4) # + name
sbrickMap[entryName] = e
for sbrick in fileMap:
contents = ""
name = sbrick.split(".")[0].lower()
@ -59,7 +74,7 @@ for sbrick in fileMap:
#print(name)
#print(sitem)
templateName = familyId.lower() + str(int(indexInFamily)).zfill(2)
entryName = familyId + str(int(indexInFamily)).zfill(4) + name
entryName = familyId + str(int(indexInFamily)).zfill(4) # + name
entry = [ familyId, indexInFamily ]
if name != templateName:
entry += [ name ]

@ -4,4 +4,5 @@
- Run extract_shapes.py to list all shapes into shape_list.txt
- Run scheme_shape_parser.py to generate shape_parsed from shape_list.txt excluding _mission_ shapes
- Run sitem_shape_matcher.py to generate match_sitem_shape.tsv from shape_parsed.tsv and sitem_parsed.tsv
- Run extract_sbrick.py to generate the sbrick_index.tsv to ensure indices are correctly reused
- Run generate_sitem.py to generate sitems from the tsv

Loading…
Cancel
Save