From 61a8fe7885b7c4668e22a730bd74a77a9ebf4956 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Wed, 3 May 2023 14:09:35 -0300 Subject: [PATCH] [Filters][Added] `value_split` - To extract information from the Value field and put it in separated fields. I.e. tolerance, voltage, etc. --- CHANGELOG.md | 11 + README.md | 39 ++- docs/README.in | 2 + kibot/bom/units.py | 4 + kibot/fil_base.py | 6 + kibot/fil_value_split.py | 112 ++++++ kibot/globals.py | 26 +- kibot/gs.py | 4 + kibot/kicad/v5_sch.py | 47 ++- kibot/kicad/v6_sch.py | 23 +- tests/board_samples/kicad_5/value_split.sch | 84 +++++ .../kicad_6/value_split.kicad_sch | 303 ++++++++++++++++ .../kicad_7/value_split.kicad_sch | 324 ++++++++++++++++++ .../kicad_8/value_split.kicad_sch | 324 ++++++++++++++++++ tests/test_plot/test_misc.py | 8 + tests/yaml_samples/value_split_1.kibot.yaml | 26 ++ tests/yaml_samples/value_split_2.kibot.yaml | 21 ++ tests/yaml_samples/value_split_3.kibot.yaml | 21 ++ 18 files changed, 1370 insertions(+), 15 deletions(-) create mode 100644 kibot/fil_value_split.py create mode 100644 tests/board_samples/kicad_5/value_split.sch create mode 100644 tests/board_samples/kicad_6/value_split.kicad_sch create mode 100644 tests/board_samples/kicad_7/value_split.kicad_sch create mode 100644 tests/board_samples/kicad_8/value_split.kicad_sch create mode 100644 tests/yaml_samples/value_split_1.kibot.yaml create mode 100644 tests/yaml_samples/value_split_2.kibot.yaml create mode 100644 tests/yaml_samples/value_split_3.kibot.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a554aa6..55c2e9ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Global options: - `use_os_env_for_expand` to disable OS environment expansion - `environment`.`extra_os` to define environment variables + - `field_voltage` Name/s of the field/s used for the voltage raiting + - `field_package` Name/s of the field/s used for the package, not footprint + - `field_temp_coef` Name/s of the field/s used for the temperature coefficient + - `field_power` Name/s of the field/s used for the power raiting +- New filters: + - `value_split` to extract information from the Value field and put it in + separated fields. I.e. tolerance, voltage, etc. +- New internal filters: + - `_value_split` splits the Value field but the field remains and the extra + data is not visible + - `_value_split_replace` splits the Value field and replaces it ### Changed - KiCad v6/7 schematic: diff --git a/README.md b/README.md index 3739cfd5..a7811f53 100644 --- a/README.md +++ b/README.md @@ -811,9 +811,21 @@ global: - `field_3D_model`: [string='_3D_model'] Name for the field controlling the 3D models used for a component. - `field_lcsc_part`: [string=''] The name of the schematic field that contains the part number for the LCSC/JLCPCB distributor. When empty KiBot will try to discover it. + - `field_package`: [string|list(string)] Name/s of the field/s used for the package, not footprint. + I.e. 0805, SOT-23, etc. Used for the value split filter. + The default is ['package', 'pkg']. + - `field_power`: [string|list(string)] Name/s of the field/s used for the power raiting. + Used for the value split filter. + The default is ['power', 'pow']. + - `field_temp_coef`: [string|list(string)] Name/s of the field/s used for the temperature coefficient. + I.e. X7R, NP0, etc. Used for the value split filter. + The default is ['temp_coef', 'tmp_coef']. - `field_tolerance`: [string|list(string)] Name/s of the field/s used for the tolerance. - Used while creating colored resistors. - The default is ['tol', 'tolerance']. + Used while creating colored resistors and for the value split filter. + The default is ['tolerance', 'tol']. + - `field_voltage`: [string|list(string)] Name/s of the field/s used for the voltage raiting. + Used for the value split filter. + The default is ['voltage', 'v']. - `filters`: [list(dict)] KiBot warnings to be ignored. * Valid keys: - `error`: [string=''] Error id we want to exclude. @@ -1032,6 +1044,27 @@ filters: - `comment`: [string=''] A comment for documentation purposes. - `fields`: [string|list(string)='Datasheet'] Fields to convert. - `name`: [string=''] Used to identify this particular filter definition. +- value_split: Value_Split + This filter extracts information from the value and fills other fields. + I.e. extracts the tolerance and puts it in the `tolerance` field. + * Valid keys: + - `autoplace`: [boolean=true] Try to figure out the position for the added fields. + - `autoplace_mechanism`: [string='bottom'] [bottom,top] Put the new field at the bottom/top of the last field. + - `comment`: [string=''] A comment for documentation purposes. + - `name`: [string=''] Used to identify this particular filter definition. + - `package`: [string='yes'] [yes,no,soft] Policy for the package. + yes = overwrite existing value, no = don't touch, soft = copy if not defined. + - `power`: [string='yes'] [yes,no,soft] Policy for the power rating. + yes = overwrite existing value, no = don't touch, soft = copy if not defined. + - `replace_source`: [boolean=true] Replace the content of the source field using a normalized representation of the interpreted value. + - `source`: [string='Value'] Name of the field to use as source of information. + - `temp_coef`: [string='yes'] [yes,no,soft] Policy for the temperature coefficient. + yes = overwrite existing value, no = don't touch, soft = copy if not defined. + - `tolerance`: [string='yes'] [yes,no,soft] Policy for the tolerance. + yes = overwrite existing value, no = don't touch, soft = copy if not defined. + - `visible`: [boolean=false] Make visible the modified fields. + - `voltage`: [string='yes'] [yes,no,soft] Policy for the voltage rating. + yes = overwrite existing value, no = don't touch, soft = copy if not defined. - var_rename: Var_Rename This filter implements the VARIANT:FIELD=VALUE renamer to get FIELD=VALUE when VARIANT is in use. * Valid keys: @@ -1097,6 +1130,8 @@ The [tests/yaml_samples](https://github.com/INTI-CMNB/KiBot/tree/master/tests/ya - **_only_tht** is used to get only THT parts - **_only_virtual** is used to get only virtual parts - **_rot_footprint** is a default `rot_footprint` filter +- **_value_split** splits the Value field but the field remains and the extra data is not visible +- **_value_split_replace** splits the Value field and replaces it - **_var_rename** is a default `var_rename` filter - **_var_rename_kicost** is a default `var_rename_kicost` filter diff --git a/docs/README.in b/docs/README.in index 020b4781..6b3cb7a8 100644 --- a/docs/README.in +++ b/docs/README.in @@ -572,6 +572,8 @@ The [tests/yaml_samples](https://github.com/INTI-CMNB/KiBot/tree/master/tests/ya - **_only_tht** is used to get only THT parts - **_only_virtual** is used to get only virtual parts - **_rot_footprint** is a default `rot_footprint` filter +- **_value_split** splits the Value field but the field remains and the extra data is not visible +- **_value_split_replace** splits the Value field and replaces it - **_var_rename** is a default `var_rename` filter - **_var_rename_kicost** is a default `var_rename_kicost` filter diff --git a/kibot/bom/units.py b/kibot/bom/units.py index 150db616..dafe3e78 100644 --- a/kibot/bom/units.py +++ b/kibot/bom/units.py @@ -55,6 +55,10 @@ decimal_point = None parser_cache = {} +def get_decima_point(): + return decimal_point + + class ParsedValue(object): def __init__(self, v, pow, unit, extra=None): # From a value that matched the regex diff --git a/kibot/fil_base.py b/kibot/fil_base.py index 9bf07f89..f4fdc6b0 100644 --- a/kibot/fil_base.py +++ b/kibot/fil_base.py @@ -81,6 +81,12 @@ SIMP_FIL = {'_only_smd': {'comment': 'Internal filter for only SMD parts', 'comment': 'Internal default variant field renamer filter'}, '_var_rename_kicost': {'type': 'var_rename_kicost', 'comment': 'Internal default variant field renamer filter (KiCost style)'}, + '_value_split_replace': {'type': 'value_split', + 'visible': True, + 'comment': 'Internal value split filter oriented to replace the Value'}, + '_value_split': {'type': 'value_split', + 'replace_source': False, + 'comment': 'Internal value split filter oriented to just add information'}, } diff --git a/kibot/fil_value_split.py b/kibot/fil_value_split.py new file mode 100644 index 00000000..ca32d4e8 --- /dev/null +++ b/kibot/fil_value_split.py @@ -0,0 +1,112 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2023 Salvador E. Tropea +# Copyright (c) 2023 Instituto Nacional de Tecnología Industrial +# License: GPL-3.0 +# Project: KiBot (formerly KiPlot) +# Description: Extracts information from the value field and creates/updates new fields +from .bom.bom import normalize_value +from .bom.units import comp_match, get_decima_point, get_prefix, ParsedValue +from .gs import GS +from .macros import macros, document, filter_class # noqa: F401 +from . import log + +logger = log.get_logger() + + +@filter_class +class Value_Split(BaseFilter): # noqa: F821 + """ Value_Split + This filter extracts information from the value and fills other fields. + I.e. extracts the tolerance and puts it in the `tolerance` field """ + def __init__(self): + super().__init__() + self._is_transform = True + with document: + self.source = 'Value' + """ Name of the field to use as source of information """ + self.tolerance = 'yes' + """ [yes,no,soft] Policy for the tolerance. + yes = overwrite existing value, no = don't touch, soft = copy if not defined """ + self.voltage = 'yes' + """ [yes,no,soft] Policy for the voltage rating. + yes = overwrite existing value, no = don't touch, soft = copy if not defined """ + self.package = 'yes' + """ [yes,no,soft] Policy for the package. + yes = overwrite existing value, no = don't touch, soft = copy if not defined """ + self.temp_coef = 'yes' + """ [yes,no,soft] Policy for the temperature coefficient. + yes = overwrite existing value, no = don't touch, soft = copy if not defined """ + self.power = 'yes' + """ [yes,no,soft] Policy for the power rating. + yes = overwrite existing value, no = don't touch, soft = copy if not defined """ + self.replace_source = True + """ Replace the content of the source field using a normalized representation of the interpreted value """ + self.autoplace = True + """ Try to figure out the position for the added fields """ + self.autoplace_mechanism = 'bottom' + """ [bottom,top] Put the new field at the bottom/top of the last field """ + self.visible = False + """ Make visible the modified fields """ + + def do_split(self, c, res, val, attr, policy, field_names, pattern="{}", units=""): + if policy != 'no' and field_names and len(field_names) > 0: + field_name = field_names[0] + if field_name: + value = res.get_extra(attr) + if value and (policy == 'yes' or not c.get_field_value(field_name)): + if isinstance(value, float): + if int(value) == value: + value = int(value) + if units: + # Change things like 0.125 to 125 m + v, pow = get_prefix(value, '') + parsed = ParsedValue(v, pow, units) + value = str(parsed) + value = pattern.format(value) + logger.debugl(2, "- {} -> {} = {}".format(val, field_name, value)) + vis = self.visible if self.visible else None + added, f = c.set_field(field_name, value, visible=vis) + if added and self.autoplace: + self._last_y += self._inc_y + f.set_xy(self._last_x, self._last_y, hjustify='L') + + def find_field_position(self, c): + inc_sign = 1 if self.autoplace_mechanism == 'bottom' else -1 + # Default is the center of the symbol + self._last_x = c.x + self._last_y = c.y + self._inc_y = inc_sign*c.fields[0].get_height()*1.8 + fields = c.get_visible_fields() + if not fields: + # No fields, we can't figure out + return + # Take the first + self._last_x, self._last_y = fields[0].get_xy() + if len(fields) > 1: + # Look for the bottom/top field + for f in fields[1:]: + x, y = f.get_xy() + if (y > self._last_y and inc_sign > 0) or (y < self._last_y and inc_sign < 0): + self._last_x = x + self._last_y = y + + def filter(self, comp): + """ Analyze the `source` field and copy the information to other fields """ + value = comp.get_field_value(self.source) + if not value: + return + res = comp_match(value, comp.ref_prefix, comp.ref) + if res is None: + return + comp.value_sort = res + if self.autoplace: + self.find_field_position(comp) + self.do_split(comp, res, value, 'tolerance', self.tolerance, GS.global_field_tolerance, "{}%") + self.do_split(comp, res, value, 'voltage_rating', self.voltage, GS.global_field_voltage, units="V") + self.do_split(comp, res, value, 'size', self.package, GS.global_field_package) + self.do_split(comp, res, value, 'characteristic', self.temp_coef, GS.global_field_temp_coef) + self.do_split(comp, res, value, 'power_rating', self.power, GS.global_field_power, units="W") + if self.replace_source: + new_value = normalize_value(comp, get_decima_point()) + logger.debug("- {} = {} -> {}".format(self.source, value, new_value)) + comp.set_field(self.source, new_value) diff --git a/kibot/globals.py b/kibot/globals.py index fa3e2770..cda654a1 100644 --- a/kibot/globals.py +++ b/kibot/globals.py @@ -305,8 +305,8 @@ class Globals(FiltersOptions): """ Try to add color bands to the 3D models of KiCad THT resistors """ self.field_tolerance = Optionable """ [string|list(string)] Name/s of the field/s used for the tolerance. - Used while creating colored resistors. - The default is ['tol', 'tolerance'] """ + Used while creating colored resistors and for the value split filter. + The default is ['tolerance', 'tol'] """ self.default_resistor_tolerance = 20 """ When no tolerance is specified we use this value. Note that I know 5% is a common default, but technically speaking 20% is the default. @@ -322,6 +322,22 @@ class Globals(FiltersOptions): which is used by the KiBot docker images, on other OSs *your mileage may vary* """ self.use_os_env_for_expand = True """ In addition to KiCad text variables also use the OS environment variables when expanding ${VARIABLE} """ + self.field_voltage = Optionable + """ [string|list(string)] Name/s of the field/s used for the voltage raiting. + Used for the value split filter. + The default is ['voltage', 'v'] """ + self.field_package = Optionable + """ [string|list(string)] Name/s of the field/s used for the package, not footprint. + I.e. 0805, SOT-23, etc. Used for the value split filter. + The default is ['package', 'pkg'] """ + self.field_temp_coef = Optionable + """ [string|list(string)] Name/s of the field/s used for the temperature coefficient. + I.e. X7R, NP0, etc. Used for the value split filter. + The default is ['temp_coef', 'tmp_coef'] """ + self.field_power = Optionable + """ [string|list(string)] Name/s of the field/s used for the power raiting. + Used for the value split filter. + The default is ['power', 'pow'] """ self.set_doc('filters', " [list(dict)] KiBot warnings to be ignored ") self._filter_what = 'KiBot warnings' self.filters = FilterOptionsKiBot @@ -430,7 +446,11 @@ class Globals(FiltersOptions): if GS.ki6 and GS.pcb_file and os.path.isfile(GS.pcb_file): self.get_stack_up() super().config(parent) - self.field_tolerance = Optionable.force_list(self.field_tolerance, default=['tol', 'tolerance']) + self.field_tolerance = Optionable.force_list(self.field_tolerance, default=['tolerance', 'tol']) + self.field_voltage = Optionable.force_list(self.field_voltage, default=['voltage', 'v']) + self.field_package = Optionable.force_list(self.field_package, default=['package', 'pkg']) + self.field_temp_coef = Optionable.force_list(self.field_temp_coef, default=['temp_coef', 'tmp_coef']) + self.field_power = Optionable.force_list(self.field_power, default=['power', 'pow']) # Transfer options to the GS globals for option in filter(lambda x: x[0] != '_', self.__dict__.keys()): gl = 'global_'+option diff --git a/kibot/gs.py b/kibot/gs.py index 1fb770af..7d8eb79c 100644 --- a/kibot/gs.py +++ b/kibot/gs.py @@ -144,7 +144,11 @@ class GS(object): global_extra_pth_drill = None global_field_3D_model = None global_field_lcsc_part = None + global_field_package = None + global_field_power = None + global_field_temp_coef = None global_field_tolerance = None + global_field_voltage = None global_hide_excluded = None global_impedance_controlled = None global_kiauto_time_out_scale = None diff --git a/kibot/kicad/v5_sch.py b/kibot/kicad/v5_sch.py index 1259aa0d..7f6c2e3f 100644 --- a/kibot/kicad/v5_sch.py +++ b/kibot/kicad/v5_sch.py @@ -764,6 +764,26 @@ class SchematicField(object): self.italic = False self.bold = False + def visible(self, v): + v = 0 if v else 1 + self.flags = "%04x" % ((int(self.flags) & 0xFFFE) | v) + + def is_visible(self): + return not(int(self.flags, 16) and 1) + + def get_height(self): + """ Font height in mm """ + return self.size*0.0254 + + def get_xy(self): + return self.x*0.0254, -self.y*0.0254 + + def set_xy(self, x, y, hjustify=None): + self.x = int(x/0.0254) + self.y = -int(y/0.0254) + if hjustify: + self.hjustify = hjustify + @staticmethod def parse(line, f): m = SchematicField.field_re.match(line) @@ -918,8 +938,9 @@ class SchematicComponent(object): max_num = f.number return max_num+1 - def set_field(self, field, value): - """ Change the value for an existing field """ + def set_field(self, field, value, visible=None): + """ Change the value for an existing field. + Or create a new one (returns True). """ field_lc = field.lower() if field_lc in self.dfields: target = self.dfields[field_lc] @@ -927,12 +948,21 @@ class SchematicComponent(object): # Adjust special fields if target.number < 4: self._solve_fields(LineReader(None, '**Internal**')) - else: - f = type(self.fields[0])() - f.name = field - f.value = value - f.number = self.get_free_field_number() - self.add_field(f) + if visible is not None: + target.visible(visible) + return False, target + f = type(self.fields[0])() + f.name = field + f.value = value + f.number = self.get_free_field_number() + f.visible(bool(visible)) + f.x = self.x + f.y = self.y + self.add_field(f) + return True, f + + def get_visible_fields(self): + return [f for f in self.fields if f.is_visible()] def get_field_names(self): """ List of all the available field names for this component """ @@ -1108,6 +1138,7 @@ class SchematicComponent(object): field.name = 'part' field.value = comp.name field.number = -1 + field.visible(False) comp.add_field(field) # Redundant pos if not line.startswith('\t'+str(comp.unit)): diff --git a/kibot/kicad/v6_sch.py b/kibot/kicad/v6_sch.py index 12f89dfb..666a1aa4 100644 --- a/kibot/kicad/v6_sch.py +++ b/kibot/kicad/v6_sch.py @@ -648,11 +648,29 @@ class SchematicFieldV6(object): self.x = x self.y = y self.ang = ang - self.effects = None - self.hide = False + self.effects = FontEffects() self.do_not_autoplace = False self.show_name = False + def visible(self, v): + self.effects.hide = not v + + def is_visible(self): + return not self.effects.hide + + def get_height(self): + """ Font height in mm """ + return self.effects.h + + def get_xy(self): + return self.x, self.y + + def set_xy(self, x, y, hjustify=None): + self.x = x + self.y = y + if hjustify: + self.effects.hjustify = hjustify + @staticmethod def parse(items, number): field = SchematicFieldV6() @@ -1145,6 +1163,7 @@ class SchematicComponentV6(SchematicComponent): field.name = 'part' field.value = comp.name field.number = -1 + field.effects.hide = True comp.add_field(field) # Memorize the current path, used for expanded hierarchy comp.path = parent.sheet_path diff --git a/tests/board_samples/kicad_5/value_split.sch b/tests/board_samples/kicad_5/value_split.sch new file mode 100644 index 00000000..c33a82db --- /dev/null +++ b/tests/board_samples/kicad_5/value_split.sch @@ -0,0 +1,84 @@ +EESchema Schematic File Version 4 +EELAYER 30 0 +EELAYER END +$Descr A4 11693 8268 +encoding utf-8 +Sheet 1 1 +Title "Value field split test" +Date "2023-05-03" +Rev "" +Comp "Instituto Nacional de Tecnología Industrial - CMNT" +Comment1 "KiBot" +Comment2 "" +Comment3 "" +Comment4 "" +$EndDescr +$Comp +L Device:C C1 +U 1 1 64524E13 +P 3000 2150 +F 0 "C1" H 3115 2197 50 0000 L CNN +F 1 "1uF 0603 ±30%" H 3115 2104 50 0000 L CNN +F 2 "" H 3038 2000 50 0001 C CNN +F 3 "~" H 3000 2150 50 0001 C CNN + 1 3000 2150 + 1 0 0 -1 +$EndComp +$Comp +L Device:C C2 +U 1 1 645255C4 +P 4000 2150 +F 0 "C2" H 4115 2197 50 0000 L CNN +F 1 "100p 0805 NPO 50V" H 4115 2104 50 0000 L CNN +F 2 "" H 4038 2000 50 0001 C CNN +F 3 "~" H 4000 2150 50 0001 C CNN + 1 4000 2150 + 1 0 0 -1 +$EndComp +$Comp +L Device:R R1 +U 1 1 645257E4 +P 3000 2650 +F 0 "R1" H 3070 2697 50 0000 L CNN +F 1 "12k 1% 0402 1/8W" H 3070 2604 50 0000 L CNN +F 2 "" V 2930 2650 50 0001 C CNN +F 3 "~" H 3000 2650 50 0001 C CNN + 1 3000 2650 + 1 0 0 -1 +$EndComp +$Comp +L Device:R R2 +U 1 1 64525CC7 +P 4000 2650 +F 0 "R2" H 4070 2697 50 0000 L CNN +F 1 "1M 10%" H 4070 2604 50 0000 L CNN +F 2 "" V 3930 2650 50 0001 C CNN +F 3 "~" H 4000 2650 50 0001 C CNN +F 4 "5%" H 4000 2650 50 0001 C CNN "tolerance" + 1 4000 2650 + 1 0 0 -1 +$EndComp +$Comp +L Device:L L1 +U 1 1 645261A6 +P 3000 3150 +F 0 "L1" H 3055 3197 50 0000 L CNN +F 1 "3n3 0603 10%" H 3055 3104 50 0000 L CNN +F 2 "" H 3000 3150 50 0001 C CNN +F 3 "~" H 3000 3150 50 0001 C CNN + 1 3000 3150 + 1 0 0 -1 +$EndComp +$Comp +L Device:L L2 +U 1 1 645266D9 +P 4000 3150 +F 0 "L2" H 4056 3197 50 0000 L CNN +F 1 "1nH 100V" H 4056 3104 50 0000 L CNN +F 2 "" H 4000 3150 50 0001 C CNN +F 3 "~" H 4000 3150 50 0001 C CNN +F 4 "50V" H 4000 3150 50 0001 C CNN "Voltage" + 1 4000 3150 + 1 0 0 -1 +$EndComp +$EndSCHEMATC diff --git a/tests/board_samples/kicad_6/value_split.kicad_sch b/tests/board_samples/kicad_6/value_split.kicad_sch new file mode 100644 index 00000000..b7cee49b --- /dev/null +++ b/tests/board_samples/kicad_6/value_split.kicad_sch @@ -0,0 +1,303 @@ +(kicad_sch (version 20211123) (generator eeschema) + + (uuid 16055b73-ee6c-45c4-98a9-8f00c5ec8fbd) + + (paper "A4") + + (title_block + (title "Value field split test") + (date "2023-05-03") + (company "Instituto Nacional de Tecnología Industrial - CMNT") + (comment 1 "KiBot") + ) + + (lib_symbols + (symbol "Device:C" (pin_numbers hide) (pin_names (offset 0.254)) (in_bom yes) (on_board yes) + (property "Reference" "C" (id 0) (at 0.635 2.54 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Value" "C" (id 1) (at 0.635 -2.54 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Footprint" "" (id 2) (at 0.9652 -3.81 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (id 3) (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_keywords" "cap capacitor" (id 4) (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_description" "Unpolarized capacitor" (id 5) (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_fp_filters" "C_*" (id 6) (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (symbol "C_0_1" + (polyline + (pts + (xy -2.032 -0.762) + (xy 2.032 -0.762) + ) + (stroke (width 0.508) (type default) (color 0 0 0 0)) + (fill (type none)) + ) + (polyline + (pts + (xy -2.032 0.762) + (xy 2.032 0.762) + ) + (stroke (width 0.508) (type default) (color 0 0 0 0)) + (fill (type none)) + ) + ) + (symbol "C_1_1" + (pin passive line (at 0 3.81 270) (length 2.794) + (name "~" (effects (font (size 1.27 1.27)))) + (number "1" (effects (font (size 1.27 1.27)))) + ) + (pin passive line (at 0 -3.81 90) (length 2.794) + (name "~" (effects (font (size 1.27 1.27)))) + (number "2" (effects (font (size 1.27 1.27)))) + ) + ) + ) + (symbol "Device:L" (pin_numbers hide) (pin_names (offset 1.016) hide) (in_bom yes) (on_board yes) + (property "Reference" "L" (id 0) (at -1.27 0 90) + (effects (font (size 1.27 1.27))) + ) + (property "Value" "L" (id 1) (at 1.905 0 90) + (effects (font (size 1.27 1.27))) + ) + (property "Footprint" "" (id 2) (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (id 3) (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_keywords" "inductor choke coil reactor magnetic" (id 4) (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_description" "Inductor" (id 5) (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_fp_filters" "Choke_* *Coil* Inductor_* L_*" (id 6) (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (symbol "L_0_1" + (arc (start 0 -2.54) (mid 0.635 -1.905) (end 0 -1.27) + (stroke (width 0) (type default) (color 0 0 0 0)) + (fill (type none)) + ) + (arc (start 0 -1.27) (mid 0.635 -0.635) (end 0 0) + (stroke (width 0) (type default) (color 0 0 0 0)) + (fill (type none)) + ) + (arc (start 0 0) (mid 0.635 0.635) (end 0 1.27) + (stroke (width 0) (type default) (color 0 0 0 0)) + (fill (type none)) + ) + (arc (start 0 1.27) (mid 0.635 1.905) (end 0 2.54) + (stroke (width 0) (type default) (color 0 0 0 0)) + (fill (type none)) + ) + ) + (symbol "L_1_1" + (pin passive line (at 0 3.81 270) (length 1.27) + (name "1" (effects (font (size 1.27 1.27)))) + (number "1" (effects (font (size 1.27 1.27)))) + ) + (pin passive line (at 0 -3.81 90) (length 1.27) + (name "2" (effects (font (size 1.27 1.27)))) + (number "2" (effects (font (size 1.27 1.27)))) + ) + ) + ) + (symbol "Device:R" (pin_numbers hide) (pin_names (offset 0)) (in_bom yes) (on_board yes) + (property "Reference" "R" (id 0) (at 2.032 0 90) + (effects (font (size 1.27 1.27))) + ) + (property "Value" "R" (id 1) (at 0 0 90) + (effects (font (size 1.27 1.27))) + ) + (property "Footprint" "" (id 2) (at -1.778 0 90) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (id 3) (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_keywords" "R res resistor" (id 4) (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_description" "Resistor" (id 5) (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_fp_filters" "R_*" (id 6) (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (symbol "R_0_1" + (rectangle (start -1.016 -2.54) (end 1.016 2.54) + (stroke (width 0.254) (type default) (color 0 0 0 0)) + (fill (type none)) + ) + ) + (symbol "R_1_1" + (pin passive line (at 0 3.81 270) (length 1.27) + (name "~" (effects (font (size 1.27 1.27)))) + (number "1" (effects (font (size 1.27 1.27)))) + ) + (pin passive line (at 0 -3.81 90) (length 1.27) + (name "~" (effects (font (size 1.27 1.27)))) + (number "2" (effects (font (size 1.27 1.27)))) + ) + ) + ) + ) + + + (symbol (lib_id "Device:C") (at 76.2 54.61 0) (unit 1) + (in_bom yes) (on_board yes) + (uuid 00000000-0000-0000-0000-000064524e13) + (property "Reference" "C1" (id 0) (at 79.121 53.4162 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Value" "1uF 0603 ±30%" (id 1) (at 79.121 55.7784 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Footprint" "" (id 2) (at 77.1652 58.42 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (id 3) (at 76.2 54.61 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid 7e841f98-7f62-48dc-be27-a7a37f643d7a)) + (pin "2" (uuid fff13a0c-50fe-43a7-a6cb-83a940f7baa6)) + ) + + (symbol (lib_id "Device:C") (at 101.6 54.61 0) (unit 1) + (in_bom yes) (on_board yes) + (uuid 00000000-0000-0000-0000-0000645255c4) + (property "Reference" "C2" (id 0) (at 104.521 53.4162 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Value" "100p 0805 NPO 50V" (id 1) (at 104.521 55.7784 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Footprint" "" (id 2) (at 102.5652 58.42 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (id 3) (at 101.6 54.61 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid 5c3aaa4b-cde0-4e05-85ec-f75c2d72c4aa)) + (pin "2" (uuid ef99695e-6599-445e-8155-ac14683bdc11)) + ) + + (symbol (lib_id "Device:R") (at 76.2 67.31 0) (unit 1) + (in_bom yes) (on_board yes) + (uuid 00000000-0000-0000-0000-0000645257e4) + (property "Reference" "R1" (id 0) (at 77.978 66.1162 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Value" "12k 1% 0402 1/8W" (id 1) (at 77.978 68.4784 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Footprint" "" (id 2) (at 74.422 67.31 90) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (id 3) (at 76.2 67.31 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid 48e7f17f-519b-47f0-8f53-0f9563c05468)) + (pin "2" (uuid daec92d6-edae-426b-a9ff-16e2fd2d2426)) + ) + + (symbol (lib_id "Device:R") (at 101.6 67.31 0) (unit 1) + (in_bom yes) (on_board yes) + (uuid 00000000-0000-0000-0000-000064525cc7) + (property "Reference" "R2" (id 0) (at 103.378 66.1162 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Value" "1M 10%" (id 1) (at 103.378 68.4784 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Footprint" "" (id 2) (at 99.822 67.31 90) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (id 3) (at 101.6 67.31 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "tolerance" "5%" (id 4) (at 101.6 67.31 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid c1aab299-69ec-42ca-aab7-c3448d03750a)) + (pin "2" (uuid 34f4620b-1363-497b-aff8-d0258610a85c)) + ) + + (symbol (lib_id "Device:L") (at 76.2 80.01 0) (unit 1) + (in_bom yes) (on_board yes) + (uuid 00000000-0000-0000-0000-0000645261a6) + (property "Reference" "L1" (id 0) (at 77.597 78.8162 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Value" "3n3 0603 10%" (id 1) (at 77.597 81.1784 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Footprint" "" (id 2) (at 76.2 80.01 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (id 3) (at 76.2 80.01 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid ba210845-625b-4377-8f32-751ab188ad5d)) + (pin "2" (uuid fc0eaa22-a361-4ab2-855a-8237c32272d4)) + ) + + (symbol (lib_id "Device:L") (at 101.6 80.01 0) (unit 1) + (in_bom yes) (on_board yes) + (uuid 00000000-0000-0000-0000-0000645266d9) + (property "Reference" "L2" (id 0) (at 103.0224 78.8162 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Value" "1nH 100V" (id 1) (at 103.0224 81.1784 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Footprint" "" (id 2) (at 101.6 80.01 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (id 3) (at 101.6 80.01 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Voltage" "50V" (id 4) (at 101.6 80.01 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid dd304ee2-05ae-46b1-972d-15e2637cfd88)) + (pin "2" (uuid 6fc23c19-6f7d-46fb-b0e5-2b0333aa2eb0)) + ) + + (sheet_instances + (path "/" (page "1")) + ) + + (symbol_instances + (path "/00000000-0000-0000-0000-000064524e13" + (reference "C1") (unit 1) (value "1uF 0603 ±30%") (footprint "") + ) + (path "/00000000-0000-0000-0000-0000645255c4" + (reference "C2") (unit 1) (value "100p 0805 NPO 50V") (footprint "") + ) + (path "/00000000-0000-0000-0000-0000645261a6" + (reference "L1") (unit 1) (value "3n3 0603 10%") (footprint "") + ) + (path "/00000000-0000-0000-0000-0000645266d9" + (reference "L2") (unit 1) (value "1nH 100V") (footprint "") + ) + (path "/00000000-0000-0000-0000-0000645257e4" + (reference "R1") (unit 1) (value "12k 1% 0402 1/8W") (footprint "") + ) + (path "/00000000-0000-0000-0000-000064525cc7" + (reference "R2") (unit 1) (value "1M 10%") (footprint "") + ) + ) +) diff --git a/tests/board_samples/kicad_7/value_split.kicad_sch b/tests/board_samples/kicad_7/value_split.kicad_sch new file mode 100644 index 00000000..9e438f7c --- /dev/null +++ b/tests/board_samples/kicad_7/value_split.kicad_sch @@ -0,0 +1,324 @@ +(kicad_sch (version 20230121) (generator eeschema) + + (uuid 179ba928-cf99-4278-8b0e-db8b29c47284) + + (paper "A4") + + (title_block + (title "Value field split test") + (date "2023-05-03") + (company "Instituto Nacional de Tecnología Industrial - CMNT") + (comment 1 "KiBot") + ) + + (lib_symbols + (symbol "Device:C" (pin_numbers hide) (pin_names (offset 0.254)) (in_bom yes) (on_board yes) + (property "Reference" "C" (at 0.635 2.54 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Value" "C" (at 0.635 -2.54 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Footprint" "" (at 0.9652 -3.81 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_keywords" "cap capacitor" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_description" "Unpolarized capacitor" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_fp_filters" "C_*" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (symbol "C_0_1" + (polyline + (pts + (xy -2.032 -0.762) + (xy 2.032 -0.762) + ) + (stroke (width 0.508) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy -2.032 0.762) + (xy 2.032 0.762) + ) + (stroke (width 0.508) (type default)) + (fill (type none)) + ) + ) + (symbol "C_1_1" + (pin passive line (at 0 3.81 270) (length 2.794) + (name "~" (effects (font (size 1.27 1.27)))) + (number "1" (effects (font (size 1.27 1.27)))) + ) + (pin passive line (at 0 -3.81 90) (length 2.794) + (name "~" (effects (font (size 1.27 1.27)))) + (number "2" (effects (font (size 1.27 1.27)))) + ) + ) + ) + (symbol "Device:L" (pin_numbers hide) (pin_names (offset 1.016) hide) (in_bom yes) (on_board yes) + (property "Reference" "L" (at -1.27 0 90) + (effects (font (size 1.27 1.27))) + ) + (property "Value" "L" (at 1.905 0 90) + (effects (font (size 1.27 1.27))) + ) + (property "Footprint" "" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_keywords" "inductor choke coil reactor magnetic" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_description" "Inductor" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_fp_filters" "Choke_* *Coil* Inductor_* L_*" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (symbol "L_0_1" + (arc (start 0 -2.54) (mid 0.6323 -1.905) (end 0 -1.27) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (arc (start 0 -1.27) (mid 0.6323 -0.635) (end 0 0) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (arc (start 0 0) (mid 0.6323 0.635) (end 0 1.27) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (arc (start 0 1.27) (mid 0.6323 1.905) (end 0 2.54) + (stroke (width 0) (type default)) + (fill (type none)) + ) + ) + (symbol "L_1_1" + (pin passive line (at 0 3.81 270) (length 1.27) + (name "1" (effects (font (size 1.27 1.27)))) + (number "1" (effects (font (size 1.27 1.27)))) + ) + (pin passive line (at 0 -3.81 90) (length 1.27) + (name "2" (effects (font (size 1.27 1.27)))) + (number "2" (effects (font (size 1.27 1.27)))) + ) + ) + ) + (symbol "Device:R" (pin_numbers hide) (pin_names (offset 0)) (in_bom yes) (on_board yes) + (property "Reference" "R" (at 2.032 0 90) + (effects (font (size 1.27 1.27))) + ) + (property "Value" "R" (at 0 0 90) + (effects (font (size 1.27 1.27))) + ) + (property "Footprint" "" (at -1.778 0 90) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_keywords" "R res resistor" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_description" "Resistor" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_fp_filters" "R_*" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (symbol "R_0_1" + (rectangle (start -1.016 -2.54) (end 1.016 2.54) + (stroke (width 0.254) (type default)) + (fill (type none)) + ) + ) + (symbol "R_1_1" + (pin passive line (at 0 3.81 270) (length 1.27) + (name "~" (effects (font (size 1.27 1.27)))) + (number "1" (effects (font (size 1.27 1.27)))) + ) + (pin passive line (at 0 -3.81 90) (length 1.27) + (name "~" (effects (font (size 1.27 1.27)))) + (number "2" (effects (font (size 1.27 1.27)))) + ) + ) + ) + ) + + + (symbol (lib_id "Device:C") (at 76.2 54.61 0) (unit 1) + (in_bom yes) (on_board yes) (dnp no) + (uuid 00000000-0000-0000-0000-000064524e13) + (property "Reference" "C1" (at 79.121 53.4162 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Value" "1uF 0603 ±30%" (at 79.121 55.7784 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Footprint" "" (at 77.1652 58.42 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 76.2 54.61 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid 5f844bb0-3d54-4c86-88ec-af86e9451d15)) + (pin "2" (uuid 0a4fb726-0c1a-4701-a725-ee986145e4a0)) + (instances + (project "value_split" + (path "/179ba928-cf99-4278-8b0e-db8b29c47284" + (reference "C1") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "Device:C") (at 101.6 54.61 0) (unit 1) + (in_bom yes) (on_board yes) (dnp no) + (uuid 00000000-0000-0000-0000-0000645255c4) + (property "Reference" "C2" (at 104.521 53.4162 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Value" "100p 0805 NPO 50V" (at 104.521 55.7784 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Footprint" "" (at 102.5652 58.42 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 101.6 54.61 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid 1a5349dc-6b5f-46b5-a82e-fb4a4ce76785)) + (pin "2" (uuid d0f0d8f4-8c92-434a-91d3-826c5db4cfc7)) + (instances + (project "value_split" + (path "/179ba928-cf99-4278-8b0e-db8b29c47284" + (reference "C2") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "Device:R") (at 76.2 67.31 0) (unit 1) + (in_bom yes) (on_board yes) (dnp no) + (uuid 00000000-0000-0000-0000-0000645257e4) + (property "Reference" "R1" (at 77.978 66.1162 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Value" "12k 1% 0402 1/8W" (at 77.978 68.4784 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Footprint" "" (at 74.422 67.31 90) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 76.2 67.31 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid 31bcb9be-4874-4abc-b949-33a9ab4b0617)) + (pin "2" (uuid 70853912-8b76-42a4-b17c-8ddf582202ad)) + (instances + (project "value_split" + (path "/179ba928-cf99-4278-8b0e-db8b29c47284" + (reference "R1") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "Device:R") (at 101.6 67.31 0) (unit 1) + (in_bom yes) (on_board yes) (dnp no) + (uuid 00000000-0000-0000-0000-000064525cc7) + (property "Reference" "R2" (at 103.378 66.1162 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Value" "1M 10%" (at 103.378 68.4784 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Footprint" "" (at 99.822 67.31 90) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 101.6 67.31 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "tolerance" "5%" (at 104.14 71.12 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (pin "1" (uuid e80f2427-21c4-4f79-9651-aa4141324485)) + (pin "2" (uuid c138ecfa-b0c2-4814-8442-90afb26b2b46)) + (instances + (project "value_split" + (path "/179ba928-cf99-4278-8b0e-db8b29c47284" + (reference "R2") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "Device:L") (at 76.2 80.01 0) (unit 1) + (in_bom yes) (on_board yes) (dnp no) + (uuid 00000000-0000-0000-0000-0000645261a6) + (property "Reference" "L1" (at 77.597 78.8162 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Value" "3n3 0603 10%" (at 77.597 81.1784 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Footprint" "" (at 76.2 80.01 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 76.2 80.01 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid 58e23817-50a2-4977-8e84-afab23d1b456)) + (pin "2" (uuid dfe081d3-8f66-4a53-96d1-16e824274d7e)) + (instances + (project "value_split" + (path "/179ba928-cf99-4278-8b0e-db8b29c47284" + (reference "L1") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "Device:L") (at 101.6 80.01 0) (unit 1) + (in_bom yes) (on_board yes) (dnp no) + (uuid 00000000-0000-0000-0000-0000645266d9) + (property "Reference" "L2" (at 103.0224 78.8162 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Value" "1nH 100V" (at 103.0224 81.1784 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Footprint" "" (at 101.6 80.01 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 101.6 80.01 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Voltage" "50V" (at 105.41 83.82 0) + (effects (font (size 1.27 1.27))) + ) + (pin "1" (uuid 26fd10a0-33ae-47c2-af12-31a3f632d1f6)) + (pin "2" (uuid 1e6c2ee6-8273-4e5f-a91b-8e402ea1772e)) + (instances + (project "value_split" + (path "/179ba928-cf99-4278-8b0e-db8b29c47284" + (reference "L2") (unit 1) + ) + ) + ) + ) + + (sheet_instances + (path "/" (page "1")) + ) +) diff --git a/tests/board_samples/kicad_8/value_split.kicad_sch b/tests/board_samples/kicad_8/value_split.kicad_sch new file mode 100644 index 00000000..9e438f7c --- /dev/null +++ b/tests/board_samples/kicad_8/value_split.kicad_sch @@ -0,0 +1,324 @@ +(kicad_sch (version 20230121) (generator eeschema) + + (uuid 179ba928-cf99-4278-8b0e-db8b29c47284) + + (paper "A4") + + (title_block + (title "Value field split test") + (date "2023-05-03") + (company "Instituto Nacional de Tecnología Industrial - CMNT") + (comment 1 "KiBot") + ) + + (lib_symbols + (symbol "Device:C" (pin_numbers hide) (pin_names (offset 0.254)) (in_bom yes) (on_board yes) + (property "Reference" "C" (at 0.635 2.54 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Value" "C" (at 0.635 -2.54 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Footprint" "" (at 0.9652 -3.81 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_keywords" "cap capacitor" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_description" "Unpolarized capacitor" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_fp_filters" "C_*" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (symbol "C_0_1" + (polyline + (pts + (xy -2.032 -0.762) + (xy 2.032 -0.762) + ) + (stroke (width 0.508) (type default)) + (fill (type none)) + ) + (polyline + (pts + (xy -2.032 0.762) + (xy 2.032 0.762) + ) + (stroke (width 0.508) (type default)) + (fill (type none)) + ) + ) + (symbol "C_1_1" + (pin passive line (at 0 3.81 270) (length 2.794) + (name "~" (effects (font (size 1.27 1.27)))) + (number "1" (effects (font (size 1.27 1.27)))) + ) + (pin passive line (at 0 -3.81 90) (length 2.794) + (name "~" (effects (font (size 1.27 1.27)))) + (number "2" (effects (font (size 1.27 1.27)))) + ) + ) + ) + (symbol "Device:L" (pin_numbers hide) (pin_names (offset 1.016) hide) (in_bom yes) (on_board yes) + (property "Reference" "L" (at -1.27 0 90) + (effects (font (size 1.27 1.27))) + ) + (property "Value" "L" (at 1.905 0 90) + (effects (font (size 1.27 1.27))) + ) + (property "Footprint" "" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_keywords" "inductor choke coil reactor magnetic" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_description" "Inductor" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_fp_filters" "Choke_* *Coil* Inductor_* L_*" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (symbol "L_0_1" + (arc (start 0 -2.54) (mid 0.6323 -1.905) (end 0 -1.27) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (arc (start 0 -1.27) (mid 0.6323 -0.635) (end 0 0) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (arc (start 0 0) (mid 0.6323 0.635) (end 0 1.27) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (arc (start 0 1.27) (mid 0.6323 1.905) (end 0 2.54) + (stroke (width 0) (type default)) + (fill (type none)) + ) + ) + (symbol "L_1_1" + (pin passive line (at 0 3.81 270) (length 1.27) + (name "1" (effects (font (size 1.27 1.27)))) + (number "1" (effects (font (size 1.27 1.27)))) + ) + (pin passive line (at 0 -3.81 90) (length 1.27) + (name "2" (effects (font (size 1.27 1.27)))) + (number "2" (effects (font (size 1.27 1.27)))) + ) + ) + ) + (symbol "Device:R" (pin_numbers hide) (pin_names (offset 0)) (in_bom yes) (on_board yes) + (property "Reference" "R" (at 2.032 0 90) + (effects (font (size 1.27 1.27))) + ) + (property "Value" "R" (at 0 0 90) + (effects (font (size 1.27 1.27))) + ) + (property "Footprint" "" (at -1.778 0 90) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_keywords" "R res resistor" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_description" "Resistor" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_fp_filters" "R_*" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (symbol "R_0_1" + (rectangle (start -1.016 -2.54) (end 1.016 2.54) + (stroke (width 0.254) (type default)) + (fill (type none)) + ) + ) + (symbol "R_1_1" + (pin passive line (at 0 3.81 270) (length 1.27) + (name "~" (effects (font (size 1.27 1.27)))) + (number "1" (effects (font (size 1.27 1.27)))) + ) + (pin passive line (at 0 -3.81 90) (length 1.27) + (name "~" (effects (font (size 1.27 1.27)))) + (number "2" (effects (font (size 1.27 1.27)))) + ) + ) + ) + ) + + + (symbol (lib_id "Device:C") (at 76.2 54.61 0) (unit 1) + (in_bom yes) (on_board yes) (dnp no) + (uuid 00000000-0000-0000-0000-000064524e13) + (property "Reference" "C1" (at 79.121 53.4162 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Value" "1uF 0603 ±30%" (at 79.121 55.7784 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Footprint" "" (at 77.1652 58.42 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 76.2 54.61 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid 5f844bb0-3d54-4c86-88ec-af86e9451d15)) + (pin "2" (uuid 0a4fb726-0c1a-4701-a725-ee986145e4a0)) + (instances + (project "value_split" + (path "/179ba928-cf99-4278-8b0e-db8b29c47284" + (reference "C1") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "Device:C") (at 101.6 54.61 0) (unit 1) + (in_bom yes) (on_board yes) (dnp no) + (uuid 00000000-0000-0000-0000-0000645255c4) + (property "Reference" "C2" (at 104.521 53.4162 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Value" "100p 0805 NPO 50V" (at 104.521 55.7784 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Footprint" "" (at 102.5652 58.42 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 101.6 54.61 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid 1a5349dc-6b5f-46b5-a82e-fb4a4ce76785)) + (pin "2" (uuid d0f0d8f4-8c92-434a-91d3-826c5db4cfc7)) + (instances + (project "value_split" + (path "/179ba928-cf99-4278-8b0e-db8b29c47284" + (reference "C2") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "Device:R") (at 76.2 67.31 0) (unit 1) + (in_bom yes) (on_board yes) (dnp no) + (uuid 00000000-0000-0000-0000-0000645257e4) + (property "Reference" "R1" (at 77.978 66.1162 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Value" "12k 1% 0402 1/8W" (at 77.978 68.4784 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Footprint" "" (at 74.422 67.31 90) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 76.2 67.31 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid 31bcb9be-4874-4abc-b949-33a9ab4b0617)) + (pin "2" (uuid 70853912-8b76-42a4-b17c-8ddf582202ad)) + (instances + (project "value_split" + (path "/179ba928-cf99-4278-8b0e-db8b29c47284" + (reference "R1") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "Device:R") (at 101.6 67.31 0) (unit 1) + (in_bom yes) (on_board yes) (dnp no) + (uuid 00000000-0000-0000-0000-000064525cc7) + (property "Reference" "R2" (at 103.378 66.1162 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Value" "1M 10%" (at 103.378 68.4784 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Footprint" "" (at 99.822 67.31 90) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 101.6 67.31 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "tolerance" "5%" (at 104.14 71.12 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (pin "1" (uuid e80f2427-21c4-4f79-9651-aa4141324485)) + (pin "2" (uuid c138ecfa-b0c2-4814-8442-90afb26b2b46)) + (instances + (project "value_split" + (path "/179ba928-cf99-4278-8b0e-db8b29c47284" + (reference "R2") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "Device:L") (at 76.2 80.01 0) (unit 1) + (in_bom yes) (on_board yes) (dnp no) + (uuid 00000000-0000-0000-0000-0000645261a6) + (property "Reference" "L1" (at 77.597 78.8162 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Value" "3n3 0603 10%" (at 77.597 81.1784 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Footprint" "" (at 76.2 80.01 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 76.2 80.01 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid 58e23817-50a2-4977-8e84-afab23d1b456)) + (pin "2" (uuid dfe081d3-8f66-4a53-96d1-16e824274d7e)) + (instances + (project "value_split" + (path "/179ba928-cf99-4278-8b0e-db8b29c47284" + (reference "L1") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "Device:L") (at 101.6 80.01 0) (unit 1) + (in_bom yes) (on_board yes) (dnp no) + (uuid 00000000-0000-0000-0000-0000645266d9) + (property "Reference" "L2" (at 103.0224 78.8162 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Value" "1nH 100V" (at 103.0224 81.1784 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Footprint" "" (at 101.6 80.01 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 101.6 80.01 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Voltage" "50V" (at 105.41 83.82 0) + (effects (font (size 1.27 1.27))) + ) + (pin "1" (uuid 26fd10a0-33ae-47c2-af12-31a3f632d1f6)) + (pin "2" (uuid 1e6c2ee6-8273-4e5f-a91b-8e402ea1772e)) + (instances + (project "value_split" + (path "/179ba928-cf99-4278-8b0e-db8b29c47284" + (reference "L2") (unit 1) + ) + ) + ) + ) + + (sheet_instances + (path "/" (page "1")) + ) +) diff --git a/tests/test_plot/test_misc.py b/tests/test_plot/test_misc.py index bab9a66e..3259aeeb 100644 --- a/tests/test_plot/test_misc.py +++ b/tests/test_plot/test_misc.py @@ -1645,3 +1645,11 @@ def test_netclass_flag_1(test_dir): ctx.run() ctx.expect_out_file_d(prj+'-bom.csv') ctx.clean_up() + + +def test_value_split_1(test_dir): + prj = 'value_split' + ctx = context.TestContextSCH(test_dir, prj, 'value_split_2', 'Modified') + ctx.run() + ctx.expect_out_file_d(prj+context.KICAD_SCH_EXT) + ctx.clean_up() diff --git a/tests/yaml_samples/value_split_1.kibot.yaml b/tests/yaml_samples/value_split_1.kibot.yaml new file mode 100644 index 00000000..cc387466 --- /dev/null +++ b/tests/yaml_samples/value_split_1.kibot.yaml @@ -0,0 +1,26 @@ +# Example KiBot config file +kibot: + version: 1 + +filters: + - name: value_split_filter + comment: 'Create fields from the value' + type: value_split + +variants: + - name: value_split + comment: 'Variant with separated value' + type: kibom + file_id: '_splitted' + pre_transform: value_split_filter + +global: + variant: value_split + +outputs: + - name: create_sch + comment: "Apply the variant to the Schematic" + type: sch_variant + dir: Modified + options: + copy_project: true diff --git a/tests/yaml_samples/value_split_2.kibot.yaml b/tests/yaml_samples/value_split_2.kibot.yaml new file mode 100644 index 00000000..cf1266ef --- /dev/null +++ b/tests/yaml_samples/value_split_2.kibot.yaml @@ -0,0 +1,21 @@ +# Example KiBot config file +kibot: + version: 1 + +variants: + - name: value_split + comment: 'Variant with separated value' + type: kibom + file_id: '_splitted' + pre_transform: _value_split_replace + +global: + variant: value_split + +outputs: + - name: create_sch + comment: "Apply the variant to the Schematic" + type: sch_variant + dir: Modified + options: + copy_project: true diff --git a/tests/yaml_samples/value_split_3.kibot.yaml b/tests/yaml_samples/value_split_3.kibot.yaml new file mode 100644 index 00000000..5f276b3c --- /dev/null +++ b/tests/yaml_samples/value_split_3.kibot.yaml @@ -0,0 +1,21 @@ +# Example KiBot config file +kibot: + version: 1 + +variants: + - name: value_split + comment: 'Variant with separated value' + type: kibom + file_id: '_splitted' + pre_transform: _value_split + +global: + variant: value_split + +outputs: + - name: create_sch + comment: "Apply the variant to the Schematic" + type: sch_variant + dir: Modified + options: + copy_project: true