From 1699cca793c6a8ebc00942557b6764fff6739044 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Thu, 23 May 2019 21:08:36 +0200 Subject: part-find-requirements: wip --- src/ee/kicad/functions.py | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'src/ee/kicad') diff --git a/src/ee/kicad/functions.py b/src/ee/kicad/functions.py index a2f9f80..b8ad7f5 100644 --- a/src/ee/kicad/functions.py +++ b/src/ee/kicad/functions.py @@ -1,8 +1,8 @@ import re - import ee.kicad.model import ee.kicad.sch_fact_types as kicad_ft +from ee import EeVal from ee.kicad import sch_fact_types from ee.part import Part from ee.part import common_fact_types @@ -80,11 +80,26 @@ def fix_value_strategy(**kwargs): symbol_name = part.facts.get_value(sch_fact_types.symbol_name) - if ref_type in ("D", "R", "L", "C") and v == symbol_name: - part.remove_fact(uris.make_fact_key("value")) + # if ref_type in ("D", "R", "L", "C") and v == symbol_name: + # part.remove_fact(uris.make_fact_key("value")) + + if ref_type == "R": + ee_value = EeVal.try_parse(v) + if ee_value: + part.facts.add(common_fact_types.resistance, str(ee_value.value)) + + if ref_type == "C": + ee_value = EeVal.try_parse(v) + if ee_value: + part.facts.add(common_fact_types.capacitance, str(ee_value.value)) + + if ref_type == "L": + ee_value = EeVal.try_parse(v) + if ee_value: + part.facts.add(common_fact_types.inductance, str(ee_value.value)) - if ref_type == "Q" and v == symbol_name and re.match("^Q_[NP]MOS_[DSG]{3}$", symbol_name): - part.remove_fact(uris.make_fact_key("value")) + # if ref_type == "Q" and v == symbol_name and re.match("^Q_[NP]MOS_[DSG]{3}$", symbol_name): + # part.remove_fact(uris.make_fact_key("value")) return part -- cgit v1.2.3