From b462f533cba12d58c4b265c0a658909b0752153e Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Thu, 28 Mar 2019 21:23:27 +0100 Subject: 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. --- src/ee/part/create_distributor_search_list.py | 11 ++++++++++- src/ee/part/fact_keys.py | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'src/ee/part') 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" -- cgit v1.2.3