home
·
contact
·
privacy
projects
/
bricksplom
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b3ad99e
)
For designs, add -f to_boxes.
master
author
Plom Heller
<plom@plomlompom.com>
Thu, 6 Aug 2026 21:24:59 +0000
(23:24 +0200)
committer
Plom Heller
<plom@plomlompom.com>
Thu, 6 Aug 2026 21:24:59 +0000
(23:24 +0200)
src/bricksplom/misc.py
patch
|
blob
|
history
diff --git
a/src/bricksplom/misc.py
b/src/bricksplom/misc.py
index 90aa8ec6ca260a06b098237ce6e80776fd65da3f..0a4c4a209cfe0b5d6ed3e1b8f6532663de4518f5 100644
(file)
--- a/
src/bricksplom/misc.py
+++ b/
src/bricksplom/misc.py
@@
-330,8
+330,24
@@
class BrickDesign(Textfiled, WithDb, Lookupable):
walk(lines, item.ldraw, item.db.ldraw.tree(item.ldraw))
return CHAR_NEWLINE.join(lines)
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() | {
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(
@classmethod
def matchers(