Skip to content

Feature CompoundFilter

DeepSOIC edited this page Jan 1, 2016 · 2 revisions

Feature (document object)

CoompoundFilter feature removes (and sometimes adds) children from a compound, based on various criteria. It can extract children by their indexes, test children for collisions with stencil shape, and filter children based on their properties, such as length, area, volume.

If there is only one child in the result, the output is the child. If there is more than one child to output, the output is a new compound.

Properties

Base

Link to the compound to be filtered.

FilterType

'FilterType' property sets the type of filter to apply. Possible values:

  • bypass: no filter. The original compound is output, unchanged.
  • specific items: output children specified by their ordinal numbers (indexes). See property 'items'.
  • collision-pass: output children that touch or intersect with 'Stencil' shape.
  • window-volume (default): output children of volume within value window, defined by properties 'WindowFrom', 'WindowTo', 'OverrideMaxVal'.
  • window-area: output children of total area within value window, defined by properties 'WindowFrom', 'WindowTo', 'OverrideMaxVal'.
  • window-length: output children of total length of edges within value window, defined by properties 'WindowFrom', 'WindowTo', 'OverrideMaxVal'.
  • window-distance: output children whose distance to 'Stencil' shape is within value window, defined by properties 'WindowFrom', 'WindowTo', 'OverrideMaxVal'.

Invert

If true, the action filter action is inverted. That is, the children that satisfy the criterion are rejected.

OverrideMaxVal

Value window range is defined in percentages of maximum value. The maximum value is computed according to the following set of rules:

  • if 'OverrideMaxVal' is nonzero - use it.
  • otherwise, if 'Stencil' link is supplied - calculate the corresponding value of stencil shape (not applicable to window-distance 'FilterType')
  • otherwise, take maximum value from children in compound to be filtered.

Stencil

Link to a stencil shape. For collision-pass and window-distance 'FilterType's, stencil is the object to test collision/distance against. For other `window-***', stencil is used to provide reference value for window percentages (maximum value override). In all other modes, 'Stencil' is ignored.

WindowFrom, WindowTo

These set the value window for the filter. The values of 'WindowFrom', 'WindowTo' are in percentage of maximum value (aka reference value).

If a value of the child being tested satisfies MaxVal*WindowFrom <= value <= MaxVal * WindowTo, the child passes through the filter (unless 'Invert').

MaxVal is calculated by following rules:

  • if 'OverrideMaxVal' is nonzero - use it.
  • otherwise, if 'Stencil' link is supplied - calculate the corresponding value of stencil shape (not applicable to window-distance 'FilterType')
  • otherwise, take maximum value from children in compound to be filtered.

items

Sets, which children to output, if 'FilterType' is specific items.

'items' property is a string value. It is a list of index ranges, specified in Python notation, but without brackets. Ranges can be chained with semicolon. For example:

  • 7:10 == take children of indexes 7, 8 and 9 (indexes are zero-based; range-to index is excluded).
  • 1;2 == take children 1 and 2 (first range is child 1, second range is child 2, ranges joined by semicolon)
  • 0;-1== take first children (index 0) and last one (index -1 means last child, -2 - one but last, and so on)
  • 1: == take all but first child (missing index means "all the way to the end").
  • ::-1 == take all children in reversed order
  • ::2 == take all even-indexed children
  • :;: == repeat the input compound twice

GUI Command (toolbar button)

"Compound Filter" command creates CompoundFilter feature.

Select a compound, and (optional) a shape to serve as stencil. Then invoke the command. CompoundFilter feature is created, with links filled in, and other properties at their defaults. Select the new feature, and edit properties to get what you want.

Hack: CompoundFilter can be used to filter arrays of placements instead of ArrayFilter. In some cases, it provides a bit more flexibility. An array of placements can be extracted after passing through CompoundFilter with ArrayFromShape feature.

Clone this wiki locally