diff --git a/eeschema/connection_graph.cpp b/eeschema/connection_graph.cpp index ee0b48064f..2a2ab52bb1 100644 --- a/eeschema/connection_graph.cpp +++ b/eeschema/connection_graph.cpp @@ -1689,6 +1689,8 @@ void CONNECTION_GRAPH::buildConnectionGraph( std::function* a const CONNECTION_SUBGRAPH* driverSubgraph = nullptr; wxString netclass; + wxCHECK_RET( !subgraphs.empty(), wxT("Invalid empty subgraph" ) ); + for( const CONNECTION_SUBGRAPH* subgraph : subgraphs ) { for( SCH_ITEM* item : subgraph->m_items ) @@ -1699,7 +1701,7 @@ void CONNECTION_GRAPH::buildConnectionGraph( std::function* a break; } - if( !netclass.IsEmpty() || !driverSubgraph ) + if( !netclass.IsEmpty() ) { driverSubgraph = subgraph; break; @@ -1709,6 +1711,9 @@ void CONNECTION_GRAPH::buildConnectionGraph( std::function* a if( netclass.IsEmpty() ) return; + if( !driverSubgraph ) + driverSubgraph = subgraphs.front(); + const wxString netname = driverSubgraph->GetNetName(); if( driverSubgraph->m_driver_connection->IsBus() ) diff --git a/qa/data/eeschema/netlists/issue14494/issue14494.kicad_pro b/qa/data/eeschema/netlists/issue14494/issue14494.kicad_pro new file mode 100644 index 0000000000..739784ceb1 --- /dev/null +++ b/qa/data/eeschema/netlists/issue14494/issue14494.kicad_pro @@ -0,0 +1,673 @@ +{ + "board": { + "3dviewports": [], + "design_settings": { + "defaults": { + "board_outline_line_width": 0.09999999999999999, + "copper_line_width": 0.19999999999999998, + "copper_text_italic": false, + "copper_text_size_h": 1.5, + "copper_text_size_v": 1.5, + "copper_text_thickness": 0.3, + "copper_text_upright": false, + "courtyard_line_width": 0.049999999999999996, + "dimension_precision": 4, + "dimension_units": 3, + "dimensions": { + "arrow_length": 1270000, + "extension_offset": 500000, + "keep_text_aligned": true, + "suppress_zeroes": false, + "text_position": 0, + "units_format": 1 + }, + "fab_line_width": 0.09999999999999999, + "fab_text_italic": false, + "fab_text_size_h": 1.0, + "fab_text_size_v": 1.0, + "fab_text_thickness": 0.15, + "fab_text_upright": false, + "other_line_width": 0.15, + "other_text_italic": false, + "other_text_size_h": 1.0, + "other_text_size_v": 1.0, + "other_text_thickness": 0.15, + "other_text_upright": false, + "pads": { + "drill": 2.0, + "height": 5.4, + "width": 2.4 + }, + "silk_line_width": 0.15, + "silk_text_italic": false, + "silk_text_size_h": 1.0, + "silk_text_size_v": 1.0, + "silk_text_thickness": 0.15, + "silk_text_upright": false, + "zones": { + "45_degree_only": false, + "min_clearance": 0.19999999999999998 + } + }, + "diff_pair_dimensions": [ + { + "gap": 0.0, + "via_gap": 0.0, + "width": 0.0 + } + ], + "drc_exclusions": [], + "meta": { + "version": 2 + }, + "rule_severities": { + "annular_width": "error", + "clearance": "error", + "connection_width": "warning", + "copper_edge_clearance": "error", + "copper_sliver": "warning", + "courtyards_overlap": "error", + "diff_pair_gap_out_of_range": "error", + "diff_pair_uncoupled_length_too_long": "error", + "drill_out_of_range": "error", + "duplicate_footprints": "warning", + "extra_footprint": "warning", + "footprint": "error", + "footprint_type_mismatch": "error", + "hole_clearance": "error", + "hole_near_hole": "error", + "invalid_outline": "error", + "isolated_copper": "warning", + "item_on_disabled_layer": "error", + "items_not_allowed": "error", + "length_out_of_range": "error", + "lib_footprint_issues": "warning", + "lib_footprint_mismatch": "warning", + "malformed_courtyard": "error", + "microvia_drill_out_of_range": "error", + "missing_courtyard": "ignore", + "missing_footprint": "warning", + "net_conflict": "warning", + "npth_inside_courtyard": "ignore", + "padstack": "error", + "pth_inside_courtyard": "ignore", + "shorting_items": "error", + "silk_edge_clearance": "warning", + "silk_over_copper": "ignore", + "silk_overlap": "ignore", + "skew_out_of_range": "error", + "solder_mask_bridge": "error", + "starved_thermal": "error", + "text_height": "warning", + "text_thickness": "warning", + "through_hole_pad_without_hole": "error", + "too_many_vias": "error", + "track_dangling": "warning", + "track_width": "error", + "tracks_crossing": "error", + "unconnected_items": "error", + "unresolved_variable": "error", + "via_dangling": "warning", + "zones_intersect": "error" + }, + "rules": { + "allow_blind_buried_vias": false, + "allow_microvias": false, + "max_error": 0.005, + "min_clearance": 0.15, + "min_connection": 0.0, + "min_copper_edge_clearance": 0.19999999999999998, + "min_hole_clearance": 0.19999999999999998, + "min_hole_to_hole": 0.25, + "min_microvia_diameter": 0.19999999999999998, + "min_microvia_drill": 0.09999999999999999, + "min_resolved_spokes": 2, + "min_silk_clearance": 0.0, + "min_text_height": 0.7999999999999999, + "min_text_thickness": 0.08, + "min_through_hole_diameter": 0.19999999999999998, + "min_track_width": 0.15, + "min_via_annular_width": 0.15, + "min_via_diameter": 0.5, + "solder_mask_clearance": 0.0, + "solder_mask_min_width": 0.0, + "solder_mask_to_copper_clearance": 0.0, + "use_height_for_length_calcs": true + }, + "teardrop_options": [ + { + "td_allow_use_two_tracks": true, + "td_curve_segcount": 5, + "td_on_pad_in_zone": false, + "td_onpadsmd": true, + "td_onroundshapesonly": false, + "td_ontrackend": false, + "td_onviapad": true + } + ], + "teardrop_parameters": [ + { + "td_curve_segcount": 0, + "td_height_ratio": 1.0, + "td_length_ratio": 0.5, + "td_maxheight": 2.0, + "td_maxlen": 1.0, + "td_target_name": "td_round_shape", + "td_width_to_size_filter_ratio": 0.9 + }, + { + "td_curve_segcount": 0, + "td_height_ratio": 1.0, + "td_length_ratio": 0.5, + "td_maxheight": 2.0, + "td_maxlen": 1.0, + "td_target_name": "td_rect_shape", + "td_width_to_size_filter_ratio": 0.9 + }, + { + "td_curve_segcount": 0, + "td_height_ratio": 1.0, + "td_length_ratio": 0.5, + "td_maxheight": 2.0, + "td_maxlen": 1.0, + "td_target_name": "td_track_end", + "td_width_to_size_filter_ratio": 0.9 + } + ], + "track_widths": [ + 0.0, + 0.15, + 0.2, + 0.3, + 0.4, + 0.5, + 0.6, + 0.8, + 1.0 + ], + "via_dimensions": [ + { + "diameter": 0.0, + "drill": 0.0 + }, + { + "diameter": 0.6, + "drill": 0.2 + }, + { + "diameter": 0.7, + "drill": 0.3 + }, + { + "diameter": 0.8, + "drill": 0.4 + }, + { + "diameter": 0.9, + "drill": 0.5 + }, + { + "diameter": 1.0, + "drill": 0.6 + }, + { + "diameter": 1.2, + "drill": 0.8 + }, + { + "diameter": 1.5, + "drill": 1.0 + }, + { + "diameter": 1.8, + "drill": 1.2 + }, + { + "diameter": 3.0, + "drill": 2.0 + }, + { + "diameter": 4.2, + "drill": 3.2 + } + ], + "zones_allow_external_fillets": false, + "zones_use_no_outline": true + }, + "layer_presets": [ + { + "activeLayer": -2, + "layers": [ + 0, + 31, + 36, + 37, + 40, + 41, + 42, + 44, + 45, + 46, + 47 + ], + "name": "standard_ohne_namen", + "renderLayers": [ + 125, + 126, + 127, + 128, + 129, + 131, + 133, + 134, + 135, + 136, + 137, + 138, + 139, + 140, + 141, + 144, + 145, + 146, + 147, + 148, + 149, + 150, + 151, + 152, + 153, + 154, + 155, + 157, + 158, + 159, + 160, + 161 + ] + } + ], + "viewports": [ + { + "h": 142193520.34347045, + "name": "zoom_1:1", + "w": 279880908.0, + "x": -30040430.00000121, + "y": -25525756.17173401 + } + ] + }, + "boards": [], + "cvpcb": { + "equivalence_files": [] + }, + "erc": { + "erc_exclusions": [], + "meta": { + "version": 0 + }, + "pin_map": [ + [ + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 2 + ], + [ + 0, + 2, + 0, + 1, + 0, + 0, + 1, + 0, + 2, + 2, + 2, + 2 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 1, + 2 + ], + [ + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 2, + 1, + 1, + 2 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 2 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2 + ], + [ + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 2 + ], + [ + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 2 + ], + [ + 0, + 2, + 1, + 2, + 0, + 0, + 1, + 0, + 2, + 2, + 2, + 2 + ], + [ + 0, + 2, + 0, + 1, + 0, + 0, + 1, + 0, + 2, + 0, + 0, + 2 + ], + [ + 0, + 2, + 1, + 1, + 0, + 0, + 1, + 0, + 2, + 0, + 0, + 2 + ], + [ + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2 + ] + ], + "rule_severities": { + "bus_definition_conflict": "error", + "bus_entry_needed": "error", + "bus_to_bus_conflict": "error", + "bus_to_net_conflict": "error", + "conflicting_netclasses": "error", + "different_unit_footprint": "error", + "different_unit_net": "error", + "duplicate_reference": "error", + "duplicate_sheet_names": "error", + "endpoint_off_grid": "warning", + "extra_units": "error", + "global_label_dangling": "warning", + "hier_label_mismatch": "error", + "label_dangling": "error", + "lib_symbol_issues": "ignore", + "missing_bidi_pin": "warning", + "missing_input_pin": "warning", + "missing_power_pin": "error", + "missing_unit": "warning", + "multiple_net_names": "warning", + "net_not_bus_member": "warning", + "no_connect_connected": "warning", + "no_connect_dangling": "warning", + "pin_not_connected": "ignore", + "pin_not_driven": "error", + "pin_to_pin": "error", + "power_pin_not_driven": "error", + "similar_labels": "warning", + "simulation_model_issue": "error", + "unannotated": "error", + "unit_value_mismatch": "error", + "unresolved_variable": "error", + "wire_dangling": "error" + } + }, + "libraries": { + "pinned_footprint_libs": [], + "pinned_symbol_libs": [] + }, + "meta": { + "filename": "netclass_hierarchie_01.kicad_pro", + "version": 1 + }, + "net_settings": { + "classes": [ + { + "bus_width": 6, + "clearance": 0.2, + "diff_pair_gap": 0.25, + "diff_pair_via_gap": 0.25, + "diff_pair_width": 0.2, + "line_style": 0, + "microvia_diameter": 0.3, + "microvia_drill": 0.1, + "name": "Default", + "pcb_color": "rgba(0, 0, 0, 0.000)", + "schematic_color": "rgba(0, 0, 0, 0.000)", + "track_width": 0.2, + "via_diameter": 0.5, + "via_drill": 0.2, + "wire_width": 4 + }, + { + "bus_width": 6, + "clearance": 0.1, + "diff_pair_gap": 0.25, + "diff_pair_via_gap": 0.25, + "diff_pair_width": 0.2, + "line_style": 0, + "microvia_diameter": 0.3, + "microvia_drill": 0.1, + "name": "net_01", + "pcb_color": "rgba(0, 0, 0, 0.000)", + "schematic_color": "rgba(0, 0, 0, 0.000)", + "track_width": 0.1, + "via_diameter": 0.5, + "via_drill": 0.2, + "wire_width": 6 + }, + { + "bus_width": 6, + "clearance": 0.2, + "diff_pair_gap": 0.25, + "diff_pair_via_gap": 0.25, + "diff_pair_width": 0.2, + "line_style": 0, + "microvia_diameter": 0.3, + "microvia_drill": 0.1, + "name": "net_02", + "pcb_color": "rgba(0, 0, 0, 0.000)", + "schematic_color": "rgba(0, 0, 0, 0.000)", + "track_width": 0.2, + "via_diameter": 0.5, + "via_drill": 0.2, + "wire_width": 6 + }, + { + "bus_width": 6, + "clearance": 0.15, + "diff_pair_gap": 0.25, + "diff_pair_via_gap": 0.25, + "diff_pair_width": 0.28, + "line_style": 0, + "microvia_diameter": 0.3, + "microvia_drill": 0.1, + "name": "usb_diff", + "pcb_color": "rgba(0, 0, 0, 0.000)", + "schematic_color": "rgba(0, 0, 0, 0.000)", + "track_width": 0.15, + "via_diameter": 0.5, + "via_drill": 0.2, + "wire_width": 4 + } + ], + "meta": { + "version": 3 + }, + "net_colors": null, + "netclass_assignments": { + "/Y": "net_01", + "/subsheet_01/C": "net_01" + }, + "netclass_patterns": [] + }, + "pcbnew": { + "last_paths": { + "gencad": "", + "idf": "", + "netlist": "", + "specctra_dsn": "", + "step": "Pumpenmodul_Kicad_v2_0g.step", + "vrml": "" + }, + "page_layout_descr_file": "Zeichnungsblatt_kreuz_cross.kicad_wks" + }, + "schematic": { + "annotate_start_num": 0, + "drawing": { + "dashed_lines_dash_length_ratio": 12.0, + "dashed_lines_gap_length_ratio": 3.0, + "default_bus_thickness": 12.0, + "default_junction_size": 36.0, + "default_line_thickness": 6.0, + "default_text_size": 50.0, + "default_wire_thickness": 6.0, + "field_names": [], + "intersheets_ref_own_page": false, + "intersheets_ref_prefix": "", + "intersheets_ref_short": false, + "intersheets_ref_show": false, + "intersheets_ref_suffix": "", + "junction_size_choice": 3, + "label_size_ratio": 0.3, + "pin_symbol_size": 12.0, + "text_offset_ratio": 0.3 + }, + "legacy_lib_dir": "", + "legacy_lib_list": [], + "meta": { + "version": 1 + }, + "net_format_name": "", + "ngspice": { + "fix_include_paths": true, + "fix_passive_vals": false, + "meta": { + "version": 0 + }, + "model_mode": 0, + "workbook_filename": "" + }, + "page_layout_descr_file": "pagelayout_default_ibfeew_logo.kicad_wks", + "plot_directory": "", + "spice_adjust_passive_values": false, + "spice_current_sheet_as_root": false, + "spice_external_command": "spice \"%I\"", + "spice_model_current_sheet_as_root": true, + "spice_save_all_currents": false, + "spice_save_all_voltages": false, + "subpart_first_id": 65, + "subpart_id_separator": 0 + }, + "sheets": [ + [ + "9c65c6c4-f8a1-4869-9ee5-38624b40fdf6", + "" + ], + [ + "6b22bc55-3b0d-4d96-9827-112a2df8c14e", + "subsheet_01" + ] + ], + "text_variables": {} +} diff --git a/qa/data/eeschema/netlists/issue14494/issue14494.kicad_sch b/qa/data/eeschema/netlists/issue14494/issue14494.kicad_sch new file mode 100644 index 0000000000..1b4734ce3a --- /dev/null +++ b/qa/data/eeschema/netlists/issue14494/issue14494.kicad_sch @@ -0,0 +1,261 @@ +(kicad_sch (version 20230121) (generator eeschema) + + (uuid 9c65c6c4-f8a1-4869-9ee5-38624b40fdf6) + + (paper "A3") + + (title_block + (date "2021-08-13") + ) + + (lib_symbols + (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)))) + ) + ) + ) + ) + + + (wire (pts (xy 165.1 149.86) (xy 215.9 149.86)) + (stroke (width 0) (type default)) + (uuid 076fa176-3c29-47b8-9e5d-f156aee21817) + ) + (wire (pts (xy 165.1 88.9) (xy 198.12 88.9)) + (stroke (width 0) (type default)) + (uuid 14df9a9f-ea70-4d1e-a7ed-6994b7b145f2) + ) + (wire (pts (xy 165.1 104.14) (xy 198.12 104.14)) + (stroke (width 0) (type default)) + (uuid 2f5f6fd3-f0c9-4770-92f5-64e285c6d214) + ) + (wire (pts (xy 215.9 149.86) (xy 215.9 151.13)) + (stroke (width 0) (type default)) + (uuid 362065cc-cdca-4ace-b23a-0844d8f2c6d8) + ) + (wire (pts (xy 165.1 160.02) (xy 215.9 160.02)) + (stroke (width 0) (type default)) + (uuid 4db1f00f-a0dd-49e5-9e76-282be543d029) + ) + (wire (pts (xy 198.12 88.9) (xy 198.12 92.71)) + (stroke (width 0) (type default)) + (uuid 524b911e-ddb2-4a13-aded-d663ed003051) + ) + (wire (pts (xy 198.12 100.33) (xy 198.12 104.14)) + (stroke (width 0) (type default)) + (uuid 72a14e14-29a7-4d22-808c-1d48ef280d47) + ) + (wire (pts (xy 215.9 158.75) (xy 215.9 160.02)) + (stroke (width 0) (type default)) + (uuid 8219c9e6-6f41-4eaa-af7b-ee9aba836fde) + ) + + (text "Version v2_0d" (at 345.7028 279.1128 0) + (effects (font (size 3.048 3.048)) (justify left bottom)) + (uuid ac532a20-16e0-47d7-a2a7-5892d9336a45) + ) + + (label "Y" (at 182.88 104.14 0) (fields_autoplaced) + (effects (font (size 1.27 1.27)) (justify left bottom)) + (uuid b49ef90a-d5fe-435e-97ab-215d1baf4614) + ) + (label "X" (at 182.88 88.9 0) (fields_autoplaced) + (effects (font (size 1.27 1.27)) (justify left bottom)) + (uuid fe244123-0c26-4635-bafb-6ea45996c0f3) + ) + + (netclass_flag "" (length 2.54) (shape round) (at 172.72 104.14 0) (fields_autoplaced) + (effects (font (size 1.27 1.27)) (justify left bottom)) + (uuid c3364c08-43a4-4538-a10f-ea20b6615cf9) + (property "Netclass" "net_01" (at 173.609 101.6 0) + (effects (font (size 1.27 1.27) italic) (justify left)) + ) + ) + (netclass_flag "" (length 2.54) (shape round) (at 180.34 160.02 0) (fields_autoplaced) + (effects (font (size 1.27 1.27)) (justify left bottom)) + (uuid d361e7b8-e9c7-4e0a-ba0a-dcc4bcfa92c7) + (property "Netclass" "net_01" (at 181.229 157.48 0) + (effects (font (size 1.27 1.27) italic) (justify left)) + ) + ) + + (symbol (lib_id "Device:R") (at 198.12 96.52 180) (unit 1) + (in_bom yes) (on_board yes) (dnp no) (fields_autoplaced) + (uuid 1dd3c410-9299-41f8-a85a-cbefc6359e42) + (property "Reference" "R3" (at 200.66 95.885 0) + (effects (font (size 1.27 1.27)) (justify right)) + ) + (property "Value" "_R" (at 200.66 98.425 0) + (effects (font (size 1.27 1.27)) (justify right)) + ) + (property "Footprint" "0IBF_RCL:R_1206_3216Metric" (at 199.898 96.52 90) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 198.12 96.52 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Bemerkung" "" (at 198.12 96.52 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "MF" "" (at 198.12 96.52 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "MPN" "" (at 198.12 96.52 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "RS" "" (at 198.12 96.52 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Farnell" "" (at 198.12 96.52 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "mouser" "" (at 198.12 96.52 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "digikey" "" (at 198.12 96.52 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Alternative" "" (at 198.12 96.52 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid c94a9b41-c5f1-47dd-ac26-4394e88d0862)) + (pin "2" (uuid f8253d1a-a8b8-41d1-8370-48fbb8932f42)) + (instances + (project "issue14494" + (path "/9c65c6c4-f8a1-4869-9ee5-38624b40fdf6/6b22bc55-3b0d-4d96-9827-112a2df8c14e" + (reference "R3") (unit 1) + ) + (path "/9c65c6c4-f8a1-4869-9ee5-38624b40fdf6" + (reference "R2") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "Device:R") (at 215.9 154.94 180) (unit 1) + (in_bom yes) (on_board yes) (dnp no) (fields_autoplaced) + (uuid ffa8d79a-2371-411f-8da8-c03e956d0004) + (property "Reference" "R3" (at 218.44 154.305 0) + (effects (font (size 1.27 1.27)) (justify right)) + ) + (property "Value" "_R" (at 218.44 156.845 0) + (effects (font (size 1.27 1.27)) (justify right)) + ) + (property "Footprint" "0IBF_RCL:R_1206_3216Metric" (at 217.678 154.94 90) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 215.9 154.94 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Bemerkung" "" (at 215.9 154.94 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "MF" "" (at 215.9 154.94 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "MPN" "" (at 215.9 154.94 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "RS" "" (at 215.9 154.94 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Farnell" "" (at 215.9 154.94 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "mouser" "" (at 215.9 154.94 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "digikey" "" (at 215.9 154.94 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Alternative" "" (at 215.9 154.94 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid a553077b-a504-4abf-83e4-e75f38624727)) + (pin "2" (uuid 15f8dc4f-7b4f-46cd-8055-6d921af2cacf)) + (instances + (project "issue14494" + (path "/9c65c6c4-f8a1-4869-9ee5-38624b40fdf6/6b22bc55-3b0d-4d96-9827-112a2df8c14e" + (reference "R3") (unit 1) + ) + (path "/9c65c6c4-f8a1-4869-9ee5-38624b40fdf6" + (reference "R4") (unit 1) + ) + ) + ) + ) + + (sheet (at 50.8 80.01) (size 114.3 92.71) (fields_autoplaced) + (stroke (width 0.1524) (type solid)) + (fill (color 0 0 0 0.0000)) + (uuid 6b22bc55-3b0d-4d96-9827-112a2df8c14e) + (property "Sheetname" "subsheet_01" (at 50.8 79.2984 0) + (effects (font (size 1.27 1.27)) (justify left bottom)) + ) + (property "Sheetfile" "issue14494_subsheet1.kicad_sch" (at 50.8 173.3046 0) + (effects (font (size 1.27 1.27)) (justify left top)) + ) + (property "Field2" "" (at 50.8 80.01 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "B" input (at 165.1 88.9 0) + (effects (font (size 1.27 1.27)) (justify right)) + (uuid fc0a9944-760a-42c9-877a-5537ed23e7f0) + ) + (pin "A" input (at 165.1 104.14 0) + (effects (font (size 1.27 1.27)) (justify right)) + (uuid a0b61f39-ec0d-44a4-8781-f7c3d9f1712e) + ) + (pin "D" input (at 165.1 149.86 0) + (effects (font (size 1.27 1.27)) (justify right)) + (uuid be935fe9-6afc-4d2a-849f-7414820c14cd) + ) + (pin "C" input (at 165.1 160.02 0) + (effects (font (size 1.27 1.27)) (justify right)) + (uuid feb9e415-bfb6-40b5-a289-dea3ed2e40ab) + ) + (instances + (project "issue14494" + (path "/9c65c6c4-f8a1-4869-9ee5-38624b40fdf6" (page "2")) + ) + ) + ) + + (sheet_instances + (path "/" (page "1")) + ) +) diff --git a/qa/data/eeschema/netlists/issue14494/issue14494_subsheet1.kicad_sch b/qa/data/eeschema/netlists/issue14494/issue14494_subsheet1.kicad_sch new file mode 100644 index 0000000000..7c86cd0471 --- /dev/null +++ b/qa/data/eeschema/netlists/issue14494/issue14494_subsheet1.kicad_sch @@ -0,0 +1,235 @@ +(kicad_sch (version 20230121) (generator eeschema) + + (uuid 8dfd5f4a-2345-4e4b-9bc9-7cd3a57e205c) + + (paper "A4") + + (lib_symbols + (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)))) + ) + ) + ) + ) + + + (wire (pts (xy 76.2 109.22) (xy 105.41 109.22)) + (stroke (width 0) (type default)) + (uuid 01447ddc-bedb-471b-952e-5ba2c81ad039) + ) + (polyline (pts (xy 149.86 104.14) (xy 152.4 99.06)) + (stroke (width 2.54) (type default)) + (uuid 166af680-1576-4cd1-a19b-9bc87af6d472) + ) + (polyline (pts (xy 149.86 104.14) (xy 147.32 99.06)) + (stroke (width 2.54) (type default)) + (uuid 1dade4a3-fefa-403d-ac2c-a185e22ab209) + ) + + (wire (pts (xy 78.74 76.2) (xy 107.95 76.2)) + (stroke (width 0) (type default)) + (uuid 2ad60c8b-6fc7-4b5d-b8ff-e010679926d5) + ) + (polyline (pts (xy 147.32 86.36) (xy 152.4 86.36)) + (stroke (width 2.54) (type default)) + (uuid 30096600-6be4-4890-b50e-b70901679efb) + ) + (polyline (pts (xy 147.32 99.06) (xy 152.4 99.06)) + (stroke (width 2.54) (type default)) + (uuid 3699dafc-0ecd-4099-b5b4-e9ae81a9b951) + ) + (polyline (pts (xy 152.4 86.36) (xy 149.86 81.28)) + (stroke (width 2.54) (type default)) + (uuid 3c3f9e0e-8d70-42fd-97ba-40c04ee30b93) + ) + + (wire (pts (xy 115.57 76.2) (xy 157.48 76.2)) + (stroke (width 0) (type default)) + (uuid 838f529b-790f-4d99-b040-c619a5b524ce) + ) + (polyline (pts (xy 149.86 81.28) (xy 149.86 104.14)) + (stroke (width 2.54) (type default)) + (uuid 878bf795-7cad-4364-af2e-a18334d68908) + ) + (polyline (pts (xy 149.86 81.28) (xy 147.32 86.36)) + (stroke (width 2.54) (type default)) + (uuid 8a771323-2070-406a-adab-97c7e98eee25) + ) + + (wire (pts (xy 113.03 109.22) (xy 154.94 109.22)) + (stroke (width 0) (type default)) + (uuid a1f5c85c-4214-4e6f-b487-11b2c4f85264) + ) + + (text "click these nets,\nlook at statusbar:\nresolved netclass == default\n(graphical netclass directive is ignored)" + (at 157.48 96.52 0) + (effects (font (size 1.27 1.27)) (justify left bottom)) + (uuid 5d9041d3-147d-4025-a3ab-6e2957f5bf39) + ) + + (hierarchical_label "A" (shape input) (at 78.74 76.2 180) (fields_autoplaced) + (effects (font (size 1.27 1.27)) (justify right)) + (uuid 32e55c65-0eb2-443c-b9a8-500117834615) + ) + (hierarchical_label "D" (shape input) (at 154.94 109.22 0) (fields_autoplaced) + (effects (font (size 1.27 1.27)) (justify left)) + (uuid 7e7a88b8-10b3-4b32-8666-130e2e385f0d) + ) + (hierarchical_label "C" (shape input) (at 76.2 109.22 180) (fields_autoplaced) + (effects (font (size 1.27 1.27)) (justify right)) + (uuid c8aff472-a8f0-48ae-b32f-8ad1a91efc2e) + ) + (hierarchical_label "B" (shape input) (at 157.48 76.2 0) (fields_autoplaced) + (effects (font (size 1.27 1.27)) (justify left)) + (uuid f6b59296-9518-44d8-bf44-5ce4a4741e82) + ) + + (netclass_flag "" (length 2.54) (shape round) (at 127 76.2 0) (fields_autoplaced) + (effects (font (size 1.27 1.27)) (justify left bottom)) + (uuid 1bf7253b-b6da-4156-856e-9ef8b5dcc7c0) + (property "Netclass" "net_02" (at 127.6985 73.66 0) + (effects (font (size 1.27 1.27) italic) (justify left)) + ) + ) + (netclass_flag "" (length 2.54) (shape round) (at 124.46 109.22 0) (fields_autoplaced) + (effects (font (size 1.27 1.27)) (justify left bottom)) + (uuid 5d615c22-3590-4433-9f49-f88a15bfe462) + (property "Netclass" "net_02" (at 125.1585 106.68 0) + (effects (font (size 1.27 1.27) italic) (justify left)) + ) + ) + + (symbol (lib_id "Device:R") (at 109.22 109.22 90) (unit 1) + (in_bom yes) (on_board yes) (dnp no) (fields_autoplaced) + (uuid 0663dc95-1d72-4e0a-ad4b-87388dcd2ed9) + (property "Reference" "R3" (at 109.22 104.14 90) + (effects (font (size 1.27 1.27))) + ) + (property "Value" "_R" (at 109.22 106.68 90) + (effects (font (size 1.27 1.27))) + ) + (property "Footprint" "0IBF_RCL:R_1206_3216Metric" (at 109.22 110.998 90) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 109.22 109.22 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Bemerkung" "" (at 109.22 109.22 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "MF" "" (at 109.22 109.22 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "MPN" "" (at 109.22 109.22 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "RS" "" (at 109.22 109.22 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Farnell" "" (at 109.22 109.22 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "mouser" "" (at 109.22 109.22 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "digikey" "" (at 109.22 109.22 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Alternative" "" (at 109.22 109.22 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid 1fb285dc-98bb-4888-a8c3-f3e1d47084d2)) + (pin "2" (uuid c4a50228-601e-4124-aeea-4ce9244a05a1)) + (instances + (project "issue14494" + (path "/9c65c6c4-f8a1-4869-9ee5-38624b40fdf6/6b22bc55-3b0d-4d96-9827-112a2df8c14e" + (reference "R3") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "Device:R") (at 111.76 76.2 90) (unit 1) + (in_bom yes) (on_board yes) (dnp no) (fields_autoplaced) + (uuid 535011c7-ca1e-472f-9595-f078df164b8f) + (property "Reference" "R1" (at 111.76 71.12 90) + (effects (font (size 1.27 1.27))) + ) + (property "Value" "_R" (at 111.76 73.66 90) + (effects (font (size 1.27 1.27))) + ) + (property "Footprint" "Resistor_SMD:R_0201_0603Metric" (at 111.76 77.978 90) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 111.76 76.2 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Bemerkung" "" (at 111.76 76.2 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "MF" "" (at 111.76 76.2 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "MPN" "" (at 111.76 76.2 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "RS" "" (at 111.76 76.2 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Farnell" "" (at 111.76 76.2 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "mouser" "" (at 111.76 76.2 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "digikey" "" (at 111.76 76.2 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Alternative" "" (at 111.76 76.2 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid d52bf23a-738b-46b3-af83-972441fabe0f)) + (pin "2" (uuid d5cd72b1-fddf-4b27-83d2-22bd08d5f3ee)) + (instances + (project "issue14494" + (path "/9c65c6c4-f8a1-4869-9ee5-38624b40fdf6/6b22bc55-3b0d-4d96-9827-112a2df8c14e" + (reference "R1") (unit 1) + ) + ) + ) + ) +) diff --git a/qa/unittests/eeschema/CMakeLists.txt b/qa/unittests/eeschema/CMakeLists.txt index e7678fe369..2fb5b4ee6b 100644 --- a/qa/unittests/eeschema/CMakeLists.txt +++ b/qa/unittests/eeschema/CMakeLists.txt @@ -79,6 +79,7 @@ set( QA_EESCHEMA_SRCS test_netlist_exporter_spice.cpp test_ee_item.cpp test_pin_numbers.cpp + test_sch_netclass.cpp test_sch_pin.cpp test_sch_rtree.cpp test_sch_reference_list.cpp diff --git a/qa/unittests/eeschema/test_sch_netclass.cpp b/qa/unittests/eeschema/test_sch_netclass.cpp new file mode 100644 index 0000000000..8ec41742c3 --- /dev/null +++ b/qa/unittests/eeschema/test_sch_netclass.cpp @@ -0,0 +1,53 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include +#include "eeschema_test_utils.h" + +#include +#include + +class TEST_SCH_NETCLASS_FIXTURE : public KI_TEST::SCHEMATIC_TEST_FIXTURE +{}; + +BOOST_FIXTURE_TEST_SUITE( SchNetclass, TEST_SCH_NETCLASS_FIXTURE ) + + +BOOST_AUTO_TEST_CASE( TestSubsheetNetclass ) +{ + LoadSchematic( "issue14494" ); + + SCH_SHEET_LIST sheets = m_schematic.GetSheets(); + SCH_SHEET_PATH path = sheets.at( 1 ); + SCH_SCREEN *screen = path.GetSheet( 1 )->GetScreen(); + + for( SCH_ITEM* item : screen->Items().OfType( SCH_HIER_LABEL_T ) ) + { + SCH_HIERLABEL* label = static_cast( item ); + + wxString name = label->GetText(); + + if( name == wxT( "B" ) || name == wxT( "D" ) ) + BOOST_CHECK_EQUAL( label->GetEffectiveNetClass( &path )->GetName(), wxT( "net_02" ) ); + else + BOOST_CHECK_EQUAL( label->GetEffectiveNetClass( &path )->GetName(), wxT( "net_01" ) ); + } +} + +BOOST_AUTO_TEST_SUITE_END()