Skip to content

Commit d5003d5

Browse files
author
Jens Kürten
committed
feat: Add part linking functionality to BOMItem class
1 parent 100a579 commit d5003d5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

csfunctions/objects/part.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,3 +247,12 @@ class BOMItem(BaseObject):
247247
mengeneinheit: str | None = Field(None, description="Unit of Measure")
248248
teilenummer: str = Field(..., description="part number")
249249
t_index: str = Field(..., description="part index")
250+
251+
part: Part | None = Field(None, description="Part of the BOM item", exclude=True)
252+
253+
def link_objects(self, data: "EventData"):
254+
parts = get_items_of_type(data, Part)
255+
for part in parts:
256+
if part.teilenummer == self.teilenummer and part.t_index == self.t_index:
257+
self.part = part
258+
break

0 commit comments

Comments
 (0)