[KiCad 7] Added global option to use KiCad to cross components
This commit is contained in:
parent
6801dfc7e2
commit
31cf802b89
|
|
@ -23,6 +23,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
components marked as *Do Not Populate*. This option applies to the case
|
||||
where no filter or variants are in use. Enabled by default. The
|
||||
`kicad_dnp_applied` option also disables it.
|
||||
- `cross_using_kicad` global option to use KiCad to cross DNP components in
|
||||
the schematic. Enabled by default.
|
||||
|
||||
### Fixed
|
||||
- Problems to detect the schematic name when the path to the config contained a
|
||||
|
|
|
|||
|
|
@ -751,7 +751,8 @@ global:
|
|||
- `copper_thickness`: [number|string] Copper thickness in micrometers (1 Oz is 35 micrometers).
|
||||
KiCad 6: you should set this in the Board Setup -> Physical Stackup.
|
||||
- `cross_footprints_for_dnp`: [boolean=true] Draw a cross for excluded components in the `Fab` layer.
|
||||
- `cross_no_body`: [boolean=false] Cross components even when they don't have a body. Only for KiCad 6.
|
||||
- `cross_no_body`: [boolean=false] Cross components even when they don't have a body. Only for KiCad 6 and internal cross.
|
||||
- `cross_using_kicad`: [boolean=true] When using KiCad 7+ let KiCad cross the components.
|
||||
- `csv_accept_no_ref`: [boolean=false] Accept aggregating CSV files without references (Experimental).
|
||||
- `date_format`: [string='%Y-%m-%d'] Format used for the day we started the script.
|
||||
Is also used for the PCB/SCH date formatting when `time_reformat` is enabled (default behavior).
|
||||
|
|
@ -810,6 +811,9 @@ global:
|
|||
- `kiauto_time_out_scale`: [number=0.0] Time-out multiplier for KiAuto operations.
|
||||
- `kiauto_wait_start`: [number=0] Time to wait for KiCad in KiAuto operations.
|
||||
- `kicad_dnp_applied`: [boolean=true] The KiCad v7 PCB flag *Do Not Populate* is applied to our fitted flag before running any filter.
|
||||
- `kicad_dnp_applies_to_3D`: [boolean=true] The KiCad v7 PCB flag *Do Not Populate* is applied to our fitted flag for 3D models,
|
||||
even when no filter/variant is specified. Disabling `kicad_dnp_applied` also disables
|
||||
this flag.
|
||||
- `out_dir`: [string=''] Base output dir, same as command line `--out-dir`.
|
||||
- `output`: [string='%f-%i%I%v.%x'] Default pattern for output file names. Affected by global options.
|
||||
- `pcb_finish`: [string='HAL'] Finishing used to protect pads. Currently used for documentation and to choose default colors.
|
||||
|
|
|
|||
|
|
@ -137,7 +137,9 @@ class Globals(FiltersOptions):
|
|||
self.cross_footprints_for_dnp = True
|
||||
""" Draw a cross for excluded components in the `Fab` layer """
|
||||
self.cross_no_body = False
|
||||
""" Cross components even when they don't have a body. Only for KiCad 6 """
|
||||
""" Cross components even when they don't have a body. Only for KiCad 6 and internal cross """
|
||||
self.cross_using_kicad = True
|
||||
""" When using KiCad 7+ let KiCad cross the components """
|
||||
self.csv_accept_no_ref = False
|
||||
""" Accept aggregating CSV files without references (Experimental) """
|
||||
self.date_format = '%Y-%m-%d'
|
||||
|
|
|
|||
|
|
@ -169,6 +169,7 @@ class GS(object):
|
|||
global_erc_grid = None
|
||||
global_kicad_dnp_applied = None
|
||||
global_kicad_dnp_applies_to_3D = None
|
||||
global_cross_using_kicad = None
|
||||
|
||||
@staticmethod
|
||||
def set_sch(name):
|
||||
|
|
|
|||
|
|
@ -1106,9 +1106,15 @@ class SchematicComponentV6(SchematicComponent):
|
|||
def write(self, cross=False):
|
||||
lib_id = self.lib_id
|
||||
is_crossed = not(self.fitted or not self.included)
|
||||
native_cross = GS.ki7 and GS.global_cross_using_kicad
|
||||
dnp = False if native_cross else self.kicad_dnp
|
||||
if cross and (self.lib or self.local_name) and is_crossed:
|
||||
# Use an alternative name
|
||||
lib_id = CROSSED_LIB+':'+(self.local_name if self.local_name else self.name)
|
||||
if native_cross:
|
||||
# Just inform KiCad we want to make it DNP
|
||||
dnp = True
|
||||
else:
|
||||
# Use an alternative name
|
||||
lib_id = CROSSED_LIB+':'+(self.local_name if self.local_name else self.name)
|
||||
data = [_symbol('lib_id', [lib_id]),
|
||||
_symbol('at', [self.x, self.y, self.ang])]
|
||||
if self.mirror:
|
||||
|
|
@ -1120,8 +1126,8 @@ class SchematicComponentV6(SchematicComponent):
|
|||
data.append(Sep())
|
||||
data.append(_symbol('in_bom', [Symbol(NO_YES[self.in_bom])]))
|
||||
data.append(_symbol('on_board', [Symbol(NO_YES[self.on_board])]))
|
||||
if self.kicad_dnp is not None:
|
||||
data.append(_symbol('dnp', [Symbol(NO_YES[self.kicad_dnp])]))
|
||||
if dnp is not None:
|
||||
data.append(_symbol('dnp', [Symbol(NO_YES[dnp])]))
|
||||
if self.fields_autoplaced:
|
||||
data.append(_symbol('fields_autoplaced'))
|
||||
data.append(Sep())
|
||||
|
|
@ -1704,6 +1710,9 @@ class SchematicV6(Schematic):
|
|||
return [Sep(), Sep(), _symbol('title_block', [Sep()]+data)]
|
||||
|
||||
def write_lib_symbols(self, cross=False):
|
||||
if GS.ki7 and GS.global_cross_using_kicad:
|
||||
# KiCad 7 can cross it by itself
|
||||
cross = False
|
||||
data = [Sep()]
|
||||
for s in self.lib_symbols:
|
||||
data.extend([s.write(), Sep()])
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -7,7 +7,7 @@
|
|||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
version="1.1"
|
||||
width="297.0022mm" height="210.0072mm" viewBox="0.0000 0.0000 297.0022 210.0072">
|
||||
<title>SVG Image created as test_v5.svg date 2023/03/08 07:51:39 </title>
|
||||
<title>SVG Image created as test_v5.svg date 2023/03/08 13:54:19 </title>
|
||||
<desc>Image generated by Eeschema-SVG </desc>
|
||||
<g style="fill:#000000; fill-opacity:1.0000;stroke:#000000; stroke-opacity:1.0000;
|
||||
stroke-linecap:round; stroke-linejoin:round;"
|
||||
|
|
@ -10505,31 +10505,11 @@ stroke:#006464; stroke-width:0.1524; stroke-opacity:1;
|
|||
stroke-linecap:round; stroke-linejoin:round;">
|
||||
<g >
|
||||
</g>
|
||||
<g style="fill:#840000; fill-opacity:0.0;
|
||||
stroke:#840000; stroke-width:0.1524; stroke-opacity:1;
|
||||
<g style="fill:#9B9B98; fill-opacity:0.0;
|
||||
stroke:#9B9B98; stroke-width:0.1524; stroke-opacity:1;
|
||||
stroke-linecap:round; stroke-linejoin:round;">
|
||||
<path d="M39.3700 82.5500 A0.6350 0.6350 0.0 0 0 39.3700 81.2800" />
|
||||
<path d="M39.3700 81.2800 A0.6350 0.6350 0.0 0 0 39.3700 80.0100" />
|
||||
</g>
|
||||
<g style="fill:#840000; fill-opacity:0.0;
|
||||
stroke:#840000; stroke-width:0.6000; stroke-opacity:1;
|
||||
stroke-linecap:round; stroke-linejoin:round;">
|
||||
<path style="fill:#840000; fill-opacity:0.0;
|
||||
stroke:#840000; stroke-width:0.6000; stroke-opacity:1;
|
||||
stroke-linecap:round; stroke-linejoin:round;fill:none"
|
||||
d="M 39.3700,83.8200
|
||||
40.0023,76.2000
|
||||
" />
|
||||
<path style="fill:#840000; fill-opacity:0.0;
|
||||
stroke:#840000; stroke-width:0.6000; stroke-opacity:1;
|
||||
stroke-linecap:round; stroke-linejoin:round;fill:none"
|
||||
d="M 39.3700,76.2000
|
||||
40.0023,83.8200
|
||||
" />
|
||||
</g>
|
||||
<g style="fill:#840000; fill-opacity:0.0;
|
||||
stroke:#840000; stroke-width:0.1524; stroke-opacity:1;
|
||||
stroke-linecap:round; stroke-linejoin:round;">
|
||||
<path d="M39.3700 80.0100 A0.6350 0.6350 0.0 0 0 39.3700 78.7400" />
|
||||
<path d="M39.3700 78.7400 A0.6350 0.6350 0.0 0 0 39.3700 77.4700" />
|
||||
<path d="M39.3700 77.4700
|
||||
|
|
@ -10539,8 +10519,8 @@ L39.3700 76.2000
|
|||
L39.3700 83.8200
|
||||
" />
|
||||
</g>
|
||||
<g style="fill:#006464; fill-opacity:0.0;
|
||||
stroke:#006464; stroke-width:0.1524; stroke-opacity:1;
|
||||
<g style="fill:#939390; fill-opacity:0.0;
|
||||
stroke:#939390; stroke-width:0.1524; stroke-opacity:1;
|
||||
stroke-linecap:round; stroke-linejoin:round;">
|
||||
<text x="41.9065" y="79.4766"
|
||||
textLength="2.3646" font-size="1.6933" lengthAdjust="spacingAndGlyphs"
|
||||
|
|
@ -10578,13 +10558,27 @@ L41.0900 81.7405
|
|||
L41.0900 80.4705
|
||||
" />
|
||||
</g></g>
|
||||
</g>
|
||||
<g style="fill:#006464; fill-opacity:0.0;
|
||||
stroke:#006464; stroke-width:0.1588; stroke-opacity:1;
|
||||
<g style="fill:#E6090D; fill-opacity:0.0;
|
||||
stroke:#E6090D; stroke-width:0.1524; stroke-opacity:1;
|
||||
stroke-linecap:round; stroke-linejoin:round;">
|
||||
</g>
|
||||
<g style="fill:#006464; fill-opacity:0.0;
|
||||
stroke:#006464; stroke-width:0.1524; stroke-opacity:1;
|
||||
<g style="fill:#E6090D; fill-opacity:0.0;
|
||||
stroke:#E6090D; stroke-width:0.4572; stroke-opacity:1;
|
||||
stroke-linecap:round; stroke-linejoin:round;">
|
||||
<path d="M38.7603 76.1999
|
||||
L40.0023 83.8201
|
||||
" />
|
||||
<path d="M40.0023 76.1999
|
||||
L38.7603 83.8201
|
||||
" />
|
||||
</g>
|
||||
</g>
|
||||
<g style="fill:#E6090D; fill-opacity:0.0;
|
||||
stroke:#E6090D; stroke-width:0.1588; stroke-opacity:1;
|
||||
stroke-linecap:round; stroke-linejoin:round;">
|
||||
</g>
|
||||
<g style="fill:#E6090D; fill-opacity:0.0;
|
||||
stroke:#E6090D; stroke-width:0.1524; stroke-opacity:1;
|
||||
stroke-linecap:round; stroke-linejoin:round;">
|
||||
</g>
|
||||
<g style="fill:#725600; fill-opacity:0.0;
|
||||
|
|
@ -17758,8 +17752,8 @@ L41.9100 87.6300
|
|||
L49.5300 87.6300
|
||||
" />
|
||||
</g>
|
||||
<g style="fill:#006464; fill-opacity:0.0;
|
||||
stroke:#006464; stroke-width:0.1524; stroke-opacity:1;
|
||||
<g style="fill:#939390; fill-opacity:0.0;
|
||||
stroke:#939390; stroke-width:0.1524; stroke-opacity:1;
|
||||
stroke-linecap:round; stroke-linejoin:round;">
|
||||
<text x="41.9065" y="79.4766"
|
||||
textLength="2.3646" font-size="1.6933" lengthAdjust="spacingAndGlyphs"
|
||||
|
|
@ -17797,8 +17791,8 @@ L41.0900 81.7405
|
|||
L41.0900 80.4705
|
||||
" />
|
||||
</g></g>
|
||||
<g style="fill:#840000; fill-opacity:0.0;
|
||||
stroke:#840000; stroke-width:0.1524; stroke-opacity:1;
|
||||
<g style="fill:#9B9B98; fill-opacity:0.0;
|
||||
stroke:#9B9B98; stroke-width:0.1524; stroke-opacity:1;
|
||||
stroke-linecap:round; stroke-linejoin:round;">
|
||||
<path d="M39.3700 77.4700
|
||||
L39.3700 76.2000
|
||||
|
|
@ -17807,6 +17801,24 @@ L39.3700 76.2000
|
|||
L39.3700 83.8200
|
||||
" />
|
||||
</g>
|
||||
<g style="fill:#E6090D; fill-opacity:0.0;
|
||||
stroke:#E6090D; stroke-width:0.1524; stroke-opacity:1;
|
||||
stroke-linecap:round; stroke-linejoin:round;">
|
||||
</g>
|
||||
<g style="fill:#E6090D; fill-opacity:0.0;
|
||||
stroke:#E6090D; stroke-width:0.4572; stroke-opacity:1;
|
||||
stroke-linecap:round; stroke-linejoin:round;">
|
||||
<path d="M38.7603 76.1999
|
||||
L40.0023 83.8201
|
||||
" />
|
||||
<path d="M40.0023 76.1999
|
||||
L38.7603 83.8201
|
||||
" />
|
||||
</g>
|
||||
<g style="fill:#E6090D; fill-opacity:0.0;
|
||||
stroke:#E6090D; stroke-width:0.1524; stroke-opacity:1;
|
||||
stroke-linecap:round; stroke-linejoin:round;">
|
||||
</g>
|
||||
<g style="fill:#000084; fill-opacity:0.0;
|
||||
stroke:#000084; stroke-width:0.1524; stroke-opacity:1;
|
||||
stroke-linecap:round; stroke-linejoin:round;">
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 386 KiB After Width: | Height: | Size: 386 KiB |
Binary file not shown.
|
|
@ -119,8 +119,11 @@ def check_l1(ctx):
|
|||
l1 = next(c for c in comps if c.ref == 'L1')
|
||||
assert l1
|
||||
logging.debug('Found L1')
|
||||
lib_name = 'n' if context.ki5() else 'kibot_crossed'
|
||||
assert l1.lib == lib_name
|
||||
if context.ki7():
|
||||
assert l1.kicad_dnp
|
||||
else:
|
||||
lib_name = 'n' if context.ki5() else 'kibot_crossed'
|
||||
assert l1.lib == lib_name
|
||||
logging.debug('L1 is crossed')
|
||||
ctx.clean_up()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue