Added skip_top and skip_bottom options to the rot_footprint filter.
This commit is contained in:
parent
35d25439c1
commit
a7bf1b080c
|
|
@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
### Added
|
||||
- Options to better control the rotation filter (#60 and #67):
|
||||
- invert_bottom: bottom angles are inverted.
|
||||
- skip_top: top components aren't rotated.
|
||||
- skip_bottom: bottom components aren't rotated.
|
||||
|
||||
## [0.11.0] - 2021-04-25
|
||||
### Added
|
||||
|
|
|
|||
|
|
@ -348,6 +348,8 @@ Currently the only type available is `generic`.
|
|||
- `negative_bottom`: [boolean=true] Rotation for bottom components is computed via subtraction as `(component rot - angle)`.
|
||||
- `rotations`: [list(list(string))] A list of pairs regular expression/rotation.
|
||||
Components matching the regular expression will be rotated the indicated angle.
|
||||
- `skip_bottom`: [boolean=false] Do not rotate components on the bottom.
|
||||
- `skip_top`: [boolean=false] Do not rotate components on the top.
|
||||
- subparts: Subparts
|
||||
This filter implements the KiCost subparts mechanism.
|
||||
* Valid keys:
|
||||
|
|
|
|||
|
|
@ -68,6 +68,10 @@ class Rot_Footprint(BaseFilter): # noqa: F821
|
|||
self.rotations = Optionable
|
||||
""" [list(list(string))] A list of pairs regular expression/rotation.
|
||||
Components matching the regular expression will be rotated the indicated angle """
|
||||
self.skip_bottom = False
|
||||
""" Do not rotate components on the bottom """
|
||||
self.skip_top = False
|
||||
""" Do not rotate components on the top """
|
||||
|
||||
def config(self, parent):
|
||||
super().config(parent)
|
||||
|
|
@ -92,6 +96,9 @@ class Rot_Footprint(BaseFilter): # noqa: F821
|
|||
|
||||
def filter(self, comp):
|
||||
""" Apply the rotation """
|
||||
if (self.skip_top and not comp.bottom) or (self.skip_bottom and comp.bottom):
|
||||
# Component should be excluded
|
||||
return
|
||||
for regex, angle in self._rot:
|
||||
if regex.search(comp.footprint):
|
||||
old_angle = comp.footprint_rot
|
||||
|
|
|
|||
Loading…
Reference in New Issue