Usual set operators are available there, union, intersection and minus operator (exclusion).
Operators between filters are set inside the second filter. The operator on the first filter
is always ignored but a warning os outputted if the filter operator is different that FO_UNION. There are no operator precedence with the given operators, they are computed
from the left to the right. The only way to add parenthesis is to use a FilterSetInterface to group filters together.
Example : creating a solver that computes the intersection of the part instances that have the field "CompletionStatus"
to "done" inside a specific box :
/** * Sample to illustrate the use of an intersection of * FilterAABBInterface and FilterAttributeInterface. */ import { AABB, AttributesDictionaryInterface, AttributeInfoInterface, AttributeType, DataSessionInterface, ConfContextInterface, VisibilityContextInterface, FilterSolverInterface, FilterAABBInterface, FilterAttributeInterface, FilterOperator, } from'generated/documentation/appinfiniteapi';
// the DataSessionInterface has been created previously and is connected letlDataSession : DataSessionInterface;
// MAKE SURE the attributes "CompletionStatus" constlAttributeDictionary : AttributesDictionaryInterface = lDataSession.getAttributesDictionary(); constlAttributeInfo : AttributeInfoInterface | undefined = lAttributeDictionary.getAttributeInfo('CompletionStatus'); // make sure the attribute is a string one console.assert((lAttributeInfo !== undefined) && (lAttributeInfo.getAttributeType() === AttributeType.ATTR_STRING));
// create the resolution chain : // create a filtering context "unconfigured" // first create ConfContextInterface "unconfigured" constlConfCtx : ConfContextInterface = lDataSession.createConfContext(); // and create the filtering context and bind it to the unconfigured ConfContextInterface constlConfVisibilityCtx: VisibilityContextInterface = lDataSession.createVisibilityContext(); lConfVisibilityCtx.setConfContext(lConfCtx);
// the AABB to use constlABB : AABB = newAABB(); lABB.mCenter.x = 3.0; lABB.mCenter.y = 3.0; lABB.mCenter.z = 3.0;
// create a Filter Solver constlFilterSolver : FilterSolverInterface = lDataSession.createFilterSolver();
// create a box filter constlFilterAABB : FilterAABBInterface = lDataSession.createFilterAABB(); // useless, FilterOperator.FO_UNION is the default operator when creating a new filter // lFilterAABB.setFilterOperator(FilterOperator.FO_UNION);
lFilterAABB.setAABB(lABB);
// create an FilterAttributeInterface constlFilterAttributes : FilterAttributeInterface = lDataSession.createFilterAttribute(); // completion status to done lFilterAttributes.setAttributeName('CompletionStatus'); lFilterAttributes.setExactValues(['done']); // no n/a lFilterAttributes.setNaValueChecked(false);
// intersection is the way to go since intersection of box and instances that have the field "CompletionStatus" // to "done" // only change the operator of the filters except the first lFilterAttributes.setFilterOperator(FilterOperator.FO_INTERSECTION);
// and add the filters // push back (-1) the AABB filter lFilterSolver.insertFilter(-1, lFilterAABB); // push back (-1) the FilterAttributeInterface, as it is the second one, its operator is used and therefore // intersection is used lFilterSolver.insertFilter(-1, lFilterAttributes);
// set the conf context to use => unconfigured for this example lFilterSolver.setVisibilityContext(lConfVisibilityCtx); // and tell the DataSessionInterface to update the modified ConfContextInterface, VisibilityContextInterface and FilterSolverInterfaces lDataSession.update();
Please refer to the [FilterItemInterface](../interfaces/FilterItemInterface.html) for more information.
The FilterOperator enumeration tells how theFilterItemInterfaces inside a FilterSolverInterface or a FilterSetInterface are combined.
Usual set operators are available there, union, intersection and minus operator (exclusion).
Operators between filters are set inside the
secondfilter. The operator on the first filter is always ignored but a warning os outputted if the filter operator is different that FO_UNION. There are no operator precedence with the given operators, they are computed from the left to the right. The only way to add parenthesis is to use a FilterSetInterface to group filters together.Example : creating a solver that computes the intersection of the
part instancesthat have the field "CompletionStatus" to "done" inside a specific box :Please refer to the [FilterItemInterface](../interfaces/FilterItemInterface.html) for more information.
See