[% patterns] Added %S to get the sub-PCB name
This commit is contained in:
parent
5594fa0b7c
commit
6790ccc547
|
|
@ -2,7 +2,7 @@
|
|||
|
||||

|
||||
|
||||
[](https://github.com/INTI-CMNB/KiBot/actions)
|
||||
[](https://github.com/INTI-CMNB/KiBot/actions)
|
||||
[](https://coveralls.io/github/INTI-CMNB/KiBot?branch=master)
|
||||
[](https://pypi.org/project/kibot/)
|
||||
[](https://www.paypal.com/donate/?hosted_button_id=K2T86GDTTMRPL)
|
||||
|
|
@ -586,13 +586,14 @@ The pattern uses the following expansions:
|
|||
- **%I** an ID defined by the user for this output.
|
||||
- **%p** pcb/sch title from pcb metadata.
|
||||
- **%r** revision from pcb/sch metadata.
|
||||
- **%S** sub-PCB name (related to multiboards).
|
||||
- **%T** time the script was started.
|
||||
- **%x** a suitable extension for the output type.
|
||||
- **%v** the `file_id` of the current variant, or the global variant if outside a variant scope.
|
||||
- **%V** the `name` of the current variant, or the global variant if outside a variant scope.
|
||||
|
||||
They are compatible with the ones used by IBoM.
|
||||
The default value for `global.output` is `%f-%i.%x`.
|
||||
The default value for `global.output` is `%f-%i%I%v.%x`.
|
||||
If you want to include the revision you could add the following definition:
|
||||
|
||||
```yaml
|
||||
|
|
@ -5228,3 +5229,4 @@ This case is [discussed here](docs/1_SCH_2_part_PCBs)
|
|||
- **Most icons for the navigate_results output**: The KiCad project
|
||||
- **PTV09A 3D Model**: Dmitry Levin ([GrabCad](https://grabcad.com/dmitry.levin-6))
|
||||
- **PcbDraw PCB example**: [Arduino Learning Kit Starter](https://github.com/RoboticsBrno/ArduinoLearningKitStarter)
|
||||
- **Battery charger example**: [RB0002-BatteryPack](https://cadlab.io/project/22740/master/files)
|
||||
|
|
|
|||
|
|
@ -390,13 +390,14 @@ The pattern uses the following expansions:
|
|||
- **%I** an ID defined by the user for this output.
|
||||
- **%p** pcb/sch title from pcb metadata.
|
||||
- **%r** revision from pcb/sch metadata.
|
||||
- **%S** sub-PCB name (related to multiboards).
|
||||
- **%T** time the script was started.
|
||||
- **%x** a suitable extension for the output type.
|
||||
- **%v** the `file_id` of the current variant, or the global variant if outside a variant scope.
|
||||
- **%V** the `name` of the current variant, or the global variant if outside a variant scope.
|
||||
|
||||
They are compatible with the ones used by IBoM.
|
||||
The default value for `global.output` is `%f-%i.%x`.
|
||||
The default value for `global.output` is `%f-%i%I%v.%x`.
|
||||
If you want to include the revision you could add the following definition:
|
||||
|
||||
```yaml
|
||||
|
|
@ -1960,3 +1961,4 @@ This case is [discussed here](docs/1_SCH_2_part_PCBs)
|
|||
- **Most icons for the navigate_results output**: The KiCad project
|
||||
- **PTV09A 3D Model**: Dmitry Levin ([GrabCad](https://grabcad.com/dmitry.levin-6))
|
||||
- **PcbDraw PCB example**: [Arduino Learning Kit Starter](https://github.com/RoboticsBrno/ArduinoLearningKitStarter)
|
||||
- **Battery charger example**: [RB0002-BatteryPack](https://cadlab.io/project/22740/master/files)
|
||||
|
|
|
|||
|
|
@ -264,6 +264,20 @@ class Optionable(object):
|
|||
return self.variant.name
|
||||
return Optionable._find_global_variant_name()
|
||||
|
||||
@staticmethod
|
||||
def _find_global_subpcb():
|
||||
if GS.solved_global_variant and GS.solved_global_variant._sub_pcb:
|
||||
return GS.solved_global_variant._sub_pcb.name
|
||||
return ''
|
||||
|
||||
def _find_subpcb(self):
|
||||
""" Returns the name of the sub-PCB.
|
||||
Also try with the globally defined variant.
|
||||
If no variant is defined an empty string is returned. """
|
||||
if hasattr(self, 'variant') and self.variant and self.variant._sub_pcb:
|
||||
return self.variant._sub_pcb.name
|
||||
return Optionable._find_global_variant()
|
||||
|
||||
def expand_filename_common(self, name, parent):
|
||||
""" Expansions common to the PCB and Schematic """
|
||||
# PCB expansions, explicit
|
||||
|
|
@ -295,6 +309,7 @@ class Optionable(object):
|
|||
name = name.replace('%i', self._expand_id)
|
||||
name = name.replace('%v', _cl(self._find_variant()))
|
||||
name = name.replace('%V', _cl(self._find_variant_name()))
|
||||
name = name.replace('%S', _cl(self._find_subpcb()))
|
||||
name = name.replace('%x', self._expand_ext)
|
||||
replace_id = ''
|
||||
if parent and hasattr(parent, 'output_id'):
|
||||
|
|
|
|||
Loading…
Reference in New Issue