aboutsummaryrefslogtreecommitdiff
path: root/src/ee/part
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2019-03-28 21:23:27 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2019-03-28 21:23:27 +0100
commitb462f533cba12d58c4b265c0a658909b0752153e (patch)
tree516491980acc26c6da4e953704563f842d7aea0a /src/ee/part
parentf0c1785f42b17b5024c3e76681c603351013c780 (diff)
downloadee-python-b462f533cba12d58c4b265c0a658909b0752153e.tar.gz
ee-python-b462f533cba12d58c4b265c0a658909b0752153e.tar.bz2
ee-python-b462f533cba12d58c4b265c0a658909b0752153e.tar.xz
ee-python-b462f533cba12d58c4b265c0a658909b0752153e.zip
create-distributor-search-list: Ignore mechanical parts.
create-order: Adding an option for a strategy to ignore/modify parts. ninja/init: Moving strategy from ninja to init so they're more persistent.
Diffstat (limited to 'src/ee/part')
-rw-r--r--src/ee/part/create_distributor_search_list.py11
-rw-r--r--src/ee/part/fact_keys.py2
2 files changed, 12 insertions, 1 deletions
diff --git a/src/ee/part/create_distributor_search_list.py b/src/ee/part/create_distributor_search_list.py
index fef1690..8d70e3e 100644
--- a/src/ee/part/create_distributor_search_list.py
+++ b/src/ee/part/create_distributor_search_list.py
@@ -1,10 +1,14 @@
from pathlib import Path
-from ee.part import PartDb, load_db, save_db, Part
+from ee.part import PartDb, load_db, save_db, Part, fact_keys
from ee.xml import types
__all__ = ["create_distributor_search_list"]
+ignored_part_classes = [
+ "mechanical"
+]
+
def create_distributor_search_list(in_path: Path, out_path: Path):
in_parts = load_db(in_path)
@@ -16,6 +20,11 @@ def create_distributor_search_list(in_path: Path, out_path: Path):
part = Part(xml)
pn_value = next((p.valueProp for p in part.get_mpns()), None)
+ part_class = part.find_fact(fact_keys.part_class)
+ if part_class:
+ if part_class.valueProp in ignored_part_classes:
+ continue
+
if pn_value is None:
refs = [ref.referenceProp for ref in part.get_schematic_references()]
print("Skipping part with no part number: schematic reference: {}".format(", ".join(refs)))
diff --git a/src/ee/part/fact_keys.py b/src/ee/part/fact_keys.py
index 5ca3c5b..f1f02c5 100644
--- a/src/ee/part/fact_keys.py
+++ b/src/ee/part/fact_keys.py
@@ -11,3 +11,5 @@ value = "http://purl.org/ee/fact-type/value"
place_part = "http://purl.org/ee/fact-type/place-part"
imperial_footprint_size = "http://purl.org/ee/fact-type/imperial-footprint-size"
+
+part_class = "http://purl.org/ee/fact-type/part-class"