[Sub-PCBs] Implementad annotation removal
This commit is contained in:
parent
002dba631d
commit
728bded7ad
|
|
@ -1058,6 +1058,9 @@ Note that the **_kibom_...** filters uses a field named `Config`, but you can cu
|
|||
- `bry`: [number|string] The Y position of the bottom right corner for the rectangle that contains the sub-PCB.
|
||||
- `file_id`: [string=''] Text to use as the replacement for %v expansion.
|
||||
When empty we use the parent `file_id` plus the `name` of the sub-PCB.
|
||||
- `strip_annotation`: [boolean=false] Remove the annotation footprint. Note that KiKit will remove all annotations,
|
||||
but the internal implementation just the one indicated by `ref`.
|
||||
If you need to remove other annotations use an exclude filter.
|
||||
- `tlx`: [number|string] The X position of the top left corner for the rectangle that contains the sub-PCB.
|
||||
- `tly`: [number|string] The Y position of the top left corner for the rectangle that contains the sub-PCB.
|
||||
- `tolerance`: [number|string] Used to enlarge the selected rectangle to include elements outside the board.
|
||||
|
|
@ -1106,6 +1109,9 @@ Note that the **_kibom_...** filters uses a field named `Config`, but you can cu
|
|||
- `bry`: [number|string] The Y position of the bottom right corner for the rectangle that contains the sub-PCB.
|
||||
- `file_id`: [string=''] Text to use as the replacement for %v expansion.
|
||||
When empty we use the parent `file_id` plus the `name` of the sub-PCB.
|
||||
- `strip_annotation`: [boolean=false] Remove the annotation footprint. Note that KiKit will remove all annotations,
|
||||
but the internal implementation just the one indicated by `ref`.
|
||||
If you need to remove other annotations use an exclude filter.
|
||||
- `tlx`: [number|string] The X position of the top left corner for the rectangle that contains the sub-PCB.
|
||||
- `tly`: [number|string] The Y position of the top left corner for the rectangle that contains the sub-PCB.
|
||||
- `tolerance`: [number|string] Used to enlarge the selected rectangle to include elements outside the board.
|
||||
|
|
@ -1156,6 +1162,9 @@ Note that the **_kibom_...** filters uses a field named `Config`, but you can cu
|
|||
- `bry`: [number|string] The Y position of the bottom right corner for the rectangle that contains the sub-PCB.
|
||||
- `file_id`: [string=''] Text to use as the replacement for %v expansion.
|
||||
When empty we use the parent `file_id` plus the `name` of the sub-PCB.
|
||||
- `strip_annotation`: [boolean=false] Remove the annotation footprint. Note that KiKit will remove all annotations,
|
||||
but the internal implementation just the one indicated by `ref`.
|
||||
If you need to remove other annotations use an exclude filter.
|
||||
- `tlx`: [number|string] The X position of the top left corner for the rectangle that contains the sub-PCB.
|
||||
- `tly`: [number|string] The Y position of the top left corner for the rectangle that contains the sub-PCB.
|
||||
- `tolerance`: [number|string] Used to enlarge the selected rectangle to include elements outside the board.
|
||||
|
|
|
|||
|
|
@ -103,6 +103,10 @@ class SubPCBOptions(PanelOptions):
|
|||
""" [internal,kikit] Tool used to extract the sub-PCB. """
|
||||
self.tolerance = 0
|
||||
""" [number|string] Used to enlarge the selected rectangle to include elements outside the board """
|
||||
self.strip_annotation = False
|
||||
""" Remove the annotation footprint. Note that KiKit will remove all annotations,
|
||||
but the internal implementation just the one indicated by `ref`.
|
||||
If you need to remove other annotations use an exclude filter """
|
||||
|
||||
def is_zero(self, val):
|
||||
return isinstance(val, (int, float)) and val == 0
|
||||
|
|
@ -138,7 +142,10 @@ class SubPCBOptions(PanelOptions):
|
|||
# Memorize the used modules
|
||||
old_modules = {m.GetReference() for m in GS.get_modules()}
|
||||
# Now do the separation
|
||||
cmd = [command, 'separate', '-s', self.get_separate_source(), GS.pcb_file, dest]
|
||||
cmd = [command, 'separate', '-s', self.get_separate_source()]
|
||||
if self.strip_annotation:
|
||||
cmd.append('--stripAnnotations')
|
||||
cmd.extend([GS.pcb_file, dest])
|
||||
# Execute the separate
|
||||
run_command(cmd)
|
||||
# Load this board
|
||||
|
|
@ -179,11 +186,12 @@ class SubPCBOptions(PanelOptions):
|
|||
Footprints are added to the list of references to exclude.
|
||||
We also check their position, not their BBox. """
|
||||
for m in iter:
|
||||
if not self.board_rect.Contains(m.GetPosition()):
|
||||
ref = m.GetReference()
|
||||
if not self.board_rect.Contains(m.GetPosition()) or (self.strip_annotation and ref == self.reference):
|
||||
GS.board.Remove(m)
|
||||
self._removed.append(m)
|
||||
if comps_hash:
|
||||
self._excl_by_sub_pcb.add(m.GetReference())
|
||||
self._excl_by_sub_pcb.add(ref)
|
||||
|
||||
def remove_outside(self, comps_hash):
|
||||
""" Remove footprints, drawings, text and zones outside `board_rect` rectangle.
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ variants:
|
|||
sub_pcbs:
|
||||
- name: A
|
||||
ref: B1
|
||||
# tool: kikit
|
||||
# strip_annotation: true
|
||||
- name: B
|
||||
ref: B2
|
||||
- name: C
|
||||
|
|
|
|||
Loading…
Reference in New Issue