walk(lines, item.ldraw, item.db.ldraw.tree(item.ldraw))
return CHAR_NEWLINE.join(lines)
+ def to_boxes(
+ item: Self
+ ) -> str:
+ assert item.db is not None
+ brick_ids = tuple(b.id_ for b in item.db.bricks.values()
+ if b.design_id in item.all_ids)
+ boxes = set()
+ for box in item.db.boxes.values():
+ for _ in [t[1] for t in box.brick_listings_flat()
+ if t[1] in brick_ids]:
+ boxes.add(box.id_)
+ break
+ return f'{item.id_indented()}: {",".join(list(boxes))}'
+
return super().formatters() | {
- 'ldraw_tree': ('tree of LDRAW references', ldraw_tree)}
+ 'ldraw_tree': ('tree of LDRAW references', ldraw_tree),
+ 'to_boxes': ('to containing boxes', to_boxes)
+ }
@classmethod
def matchers(