Interface FilterRangeItemInterface

The FilterRangeItemInterface interface defines a numeric range between a min and max value (one of them may be undefined).

Each bound (minimum and maximum) can be included, excluded or omitted (telling no lower/upper bound are set). If the lower and upper bound are both undefined, then the resulting FilterRangeItemInterface is invalid.

Date ranges can also be created, dates must be expressed as a number : the 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 FilterRangeInterface.createFilterRangeItem and FilterDiagonalInterface.createFilterRangeItem functions.

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

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

/** 
* Sample to illustrate how to use a FilterDiagonalInterface and the unit conversion system.
*/
import {
WorkingSetInterface, WorkingSetDataRetrieval,
Unit, FilterRangeItemInterface,
tListenerCallback, FilterDiagonalInterface, DataSessionInterface, GroupOperator, WorkingSetInterfaceSignal, WorkingSetBehavior,
} from 'generated_files/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;

/* Working Sets */
// create the resolution chain :
// create a Working set "unconfigured"
// first create WorkingSetInterface "unconfigured"
// we want to get geometric instances result
// if nothing is set, this working set should include all parts ('unconfigured')
const lConfCtx : WorkingSetInterface = lDataSession.createWorkingSet(
WorkingSetDataRetrieval.R_OnlyGeometricInstances,
WorkingSetBehavior.B_DiscardConfigurationsIfEmptyBit | WorkingSetBehavior.B_DiscardFiltersIfEmptyBit | WorkingSetBehavior.B_DiscardDependenciesIfEmptyBit
);

// and create the Working set and bind it to the unconfigured WorkingSetInterface
const lConfVisibilityCtx: WorkingSetInterface = lDataSession.createWorkingSet(
WorkingSetDataRetrieval.R_Nothing,
WorkingSetBehavior.B_DiscardConfigurationsIfEmptyBit | WorkingSetBehavior.B_DiscardFiltersIfEmptyBit
);
lConfVisibilityCtx.insertWorkingSetDependency(0, lConfCtx, GroupOperator.GO_INTERSECTION);

/* SOLVER */
// create the solver to retrieve the result
// we want to retrieve `geometric instance ids` and `part instance ids` on the solver
const lGlobalSolver : WorkingSetInterface = lDataSession.createWorkingSet(
WorkingSetDataRetrieval.R_GeometricInstancesAndPartInstances,
WorkingSetBehavior.B_DiscardConfigurationsIfEmptyBit
);

lGlobalSolver.insertWorkingSetDependency(0, lConfVisibilityCtx, GroupOperator.GO_UNION);
// bind the solver to custom implementation when the result is ready
lGlobalSolver.addEventListener(WorkingSetInterfaceSignal.WorkingSetReady, 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.createFilterDiagonal();
// useless, GroupOperator.GO_UNION is the default operator when creating a new filter
// lDiagonalFilter.setFilterOperator(GroupOperator.GO_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.
Metadata/Filters

interface FilterRangeItemInterface {
    getIncludedLower(): boolean;
    getIncludedUpper(): boolean;
    getLowerBound(): number;
    getUpperBound(): number;
    setIncludedLower(pIncluded): boolean;
    setIncludedUpper(pIncluded): boolean;
    setLowerBound(pLowerBound): boolean;
    setUpperBound(pUpperBound): boolean;
}

Methods

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

    The lower bound is included by default.

    Returns boolean

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

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

    The upper bound is included by default.

    Returns boolean

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

  • Gets the lower bound value.

    The lower bound is invalid by default.

    Returns number

    The lower bound of the range.

  • Gets the upper bound value.

    The upper bound is invalid by default.

    Returns number

    The upper bound of the range.