diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2019-05-23 21:08:36 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2019-05-26 21:55:41 +0200 |
commit | 1699cca793c6a8ebc00942557b6764fff6739044 (patch) | |
tree | ee8162390db5a7607298fe5f40841bb131b60542 /src/ee/kicad | |
parent | 4afac7dc4c743284e5243428f00928aa7eaacfdc (diff) | |
download | ee-python-1699cca793c6a8ebc00942557b6764fff6739044.tar.gz ee-python-1699cca793c6a8ebc00942557b6764fff6739044.tar.bz2 ee-python-1699cca793c6a8ebc00942557b6764fff6739044.tar.xz ee-python-1699cca793c6a8ebc00942557b6764fff6739044.zip |
part-find-requirements: wip
Diffstat (limited to 'src/ee/kicad')
-rw-r--r-- | src/ee/kicad/functions.py | 25 |
1 files changed, 20 insertions, 5 deletions
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 |