Interface FilterRangeItemInterface

The FilterRangeItemInterface interface defines a numeric range between a min and max value.

Each bound (minimum and maximum) can be included or excluded.

Date ranges can also be created, dates must be expressed as number of milliseconds since January 1, 1970, 00:00:00 UTC.

The FilterRangeItemInterface is used by the FilterRangeInterface and FilterDiagonalInterface to define acceptable numeric ranges.
The FilterRangeItemInterface belongs to the FilterRangeInterface, FilterDiagonalInterface that created it. This relationship cannot be altered.

FilterRangeItemInterfaces are created through createFilterRangeItem and createFilterRangeItem functions.

When modified, the FilterRangeInterface, FilterDiagonalInterface this interface belongs to will trigger FilterDataChanged signals.

Upon creation, the FilterRangeItemInterface is created with invalid values, you will have to set some values.

Be MIN the minimum value of the range, MAX the maximum value of the ranges, all combinations of ranges can be created :

  • [MIN,MAX].
  • [MIN,MAX[.
  • ]MIN,MAX].
  • ]MIN,MAX[.
/** 
* Sample to illustrate how to use a FilterDiagonalInterface and the unit conversion system.
*/
import {
FilterSolverInterface,
Unit, FilterRangeItemInterface,
ConfContextInterface, VisibilityContextInterface, FilterSolverInterfaceSignal, tListenerCallback, FilterDiagonalInterface, DataSessionInterface,
} from 'generated/documentation/appinfiniteapi';

// the DataSessionInterface has been created previously and is connected
let lDataSession : DataSessionInterface;

// what to do when result has been computed ?
let onResultReady : tListenerCallback;

/* FILTERING CONTEXT / CONF CONTEXT */
// create the resolution chain :
// create a filtering context "unconfigured"
// first create ConfContextInterface "unconfigured"
const lConfCtx : ConfContextInterface = lDataSession.createConfContext();
// and create the filtering context and bind it to the unconfigured ConfContextInterface
const lConfVisibilityCtx: VisibilityContextInterface = lDataSession.createVisibilityContext();
lConfVisibilityCtx.setConfContext(lConfCtx);

/* SOLVER */
// create the solver to retrieve the result
const lGlobalSolver : FilterSolverInterface = lDataSession.createFilterSolver();
lGlobalSolver.setVisibilityContext(lConfVisibilityCtx);
// we want to retrieve `geometric instance ids` and `part instance ids` on the solver
lGlobalSolver.setRetrievePartInstanceIds(true);
// bind the solver to custom implementation when the result is ready
lGlobalSolver.addEventListener(FilterSolverInterfaceSignal.SolverReady, onResultReady);

/* DIAGONAL FILTER */
// get the DMU build unit
const lDMUUnit : Unit = lDataSession.getDmuBuildUnit();
// we want to get values in DMU units
const lConvertFactor : number = lDataSession.convertUnitFactor(Unit.U_Millimeter, lDMUUnit);

// all leaves whose diagonal is contained within 2 and 3 millimeters
let lMinValue : number = 2 * lConvertFactor;
let lMaxValue : number = 3 * lConvertFactor;

// diagonal SQUARED
lMinValue *= lMinValue;
lMaxValue *= lMaxValue;

// create a diagonal filter
const lDiagonalFilter : FilterDiagonalInterface = lDataSession.createDiagonalFilter();
// useless, FilterOperator.FO_UNION is the default operator when creating a new filter
// lDiagonalFilter.setFilterOperator(FilterOperator.FO_UNION);

// and add a range to test ([2mm, 3mm] included)
const lDiagonalFilterContent : FilterRangeItemInterface = lDiagonalFilter.createFilterRangeItem();
// include lower bound
lDiagonalFilterContent.setIncludedLower(true);
// include upper bound
lDiagonalFilterContent.setIncludedUpper(true);
// set the lower bound as 2 mm in DMU units SQUARED
lDiagonalFilterContent.setLowerBound(lMinValue);
// set the upper bound as 3 mm in DMU units SQUARED
lDiagonalFilterContent.setUpperBound(lMaxValue);

// add the filter to the solver
lGlobalSolver.insertFilter(0, lDiagonalFilter);
// and go => make the DataSessionInterface compute the result
lDataSession.update();

Please refer to Available Filters for a list of other [FilterItemInterfaces](FilterItemInterface.html).
Metadata/Filters

See

Hierarchy

  • FilterRangeItemInterface

Methods

  • Tells if the lower bound value should be included or excluded (loose or strict, >= or >).

    The lower bound is included by default.

    Returns

    true if the lower bound value is included in the range.

    Returns boolean

  • Tells if the upper bound value should be included or excluded (loose or strict, >= or >).

    The upper bound is included by default.

    Returns

    true if the upper bound value is included in the range.

    Returns boolean

  • Gets the lower bound value.

    The lower bound is invalid by default.

    Returns

    The lower bound of the range.

    Returns number

  • Gets the upper bound value.

    The upper bound is invalid by default.

    Returns

    The upper bound of the range.

    Returns number

  • Sets if the lower bound value should be included or excluded (loose or strict, >= or >).

    Does nothing if pIncluded is equal to getIncludedLower.

    The lower bound is included by default.

    The FilterRangeInterface or FilterDiagonalInterface the FilterRangeItemInterface belongs to will trigger a FilterDataChanged.

    Returns

    true if the item is modified.

    Parameters

    • pIncluded: boolean
      in
      If true the lower bound value will be included in the range.

    Returns boolean

  • Sets if the upper bound value should be included or excluded (loose or strict, <= or <).

    Does nothing if pIncluded is equal to getIncludedUpper.

    The upper bound is included by default.

    The FilterRangeInterface or FilterDiagonalInterface the FilterRangeItemInterface belongs to will trigger a FilterDataChanged.

    Returns

    true if the item is modified.

    Parameters

    • pIncluded: boolean
      in
      If true the upper bound value will be included in the range.

    Returns boolean

  • Sets the lower bound value.

    Does nothing if pLowerBound is not a number or if pLowerBound is equal to getLowerBound.

    Depending on the numeric range of the attribute (see getAttributeNumericType, AttributeNumericType), the value will be clamped to the acceptable bounds, e.g. setting -129 for ATTR_NUM_BYTE will effectively set -128. The lower bound is invalid by default.

    The FilterRangeInterface or FilterDiagonalInterface the FilterRangeItemInterface belongs to will trigger a FilterDataChanged.

    Returns

    true if the value is valid and the item is modified.

    Parameters

    • pLowerBound: number
      in
      The new lower bound of the range.

    Returns boolean

  • Sets the upper bound value.

    Does nothing if pUpperBound is not a number or if pUpperBound is equal to getUpperBound.

    Depending on the numeric range of the attribute (see getAttributeNumericType, AttributeNumericType), the value will be clamped to the acceptable bounds, e.g. setting 128 for ATTR_NUM_BYTE will effectively set 127. The upper bound is invalid by default.

    The FilterRangeInterface or FilterDiagonalInterface the FilterRangeItemInterface belongs to will trigger a FilterDataChanged.

    Returns

    true if the value is valid and the item is modified.

    Parameters

    • pUpperBound: number
      in
      The new upper bound of the range.

    Returns boolean