Skip to content

Commit c00edef

Browse files
committed
Add fields parsable by KiCost to KiCad part info
1 parent a235f05 commit c00edef

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/Services/EDA/KiCadHelper.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,25 @@ public function getKiCADPart(Part $part): array
262262
}
263263
}
264264

265+
//Add fields for KiCost:
266+
if ($part->getManufacturer() !== null) {
267+
$result["fields"]["manf"] = $this->createField($part->getManufacturer()->getName());
268+
}
269+
if ($part->getManufacturerProductNumber() !== null) {
270+
$result['fields']['manf#'] = $this->createField($part->getManufacturerProductNumber());
271+
}
272+
273+
//For each supplier, add a field with the supplier name and the supplier part number for KiCost
274+
if ($part->getOrderdetails(false)->count() > 0) {
275+
foreach ($part->getOrderdetails(false) as $orderdetail) {
276+
if ($orderdetail->getSupplier() !== null && $orderdetail->getSupplierPartNr() !== '') {
277+
$fieldName = mb_strtolower($orderdetail->getSupplier()->getName()) . '#';
278+
279+
$result["fields"][$fieldName] = $this->createField($orderdetail->getSupplierPartNr());
280+
}
281+
}
282+
}
283+
265284
return $result;
266285
}
267286

0 commit comments

Comments
 (0)