kicad2ems.core.units¶
Part values with SI prefixes, as KiCad's fields write them ('4p7', '10k',
'1.2nH', '0R5'). A leaf: it imports nothing from kicad2ems, and pcbqs may
import it (tests/pcbqs/test_standalone.py lists what it may).
value('33n') 3.3e-08: the whole text is one value, else None
value('33n 10%') None
parse_value('33n 10%') 3.3e-08: the first word ('100n 50V X7R'), as a
part's Value field has it
part_value('R_0603_10k', 'R') 1e4: a library's or a BOM's spelling, its
package code passed over
- kicad2ems.core.units.parse_value(text)[source]¶
The value of a Value field's first word: '100n 50V X7R' 1e-7, '2.2 nH' 2.2e-9, '1,5p' 1.5e-12, '47Ω' 47; None if it is not one.
- kicad2ems.core.units.part_value(text, kind=None)[source]¶
The value of a part's Value field as libraries and BOMs write it: its first word ('100n 50V X7R', '10 kOhm', '1000pF_0402_GRM1555C1H102'), else the first of its words that is a value and not a package code ('R_0603_10k' 1e4, 'C_0402_100nF' 1e-7, 'C_22u_16V_0603' 2.2e-5). kind ('R', 'L' or 'C'): those words only after that letter ('C_10k' for a resistor is no value). None when there is none.