Interface FilterPartInstanceListInterface

The FilterPartInstanceListInterface interface is a FilterItemInterface to elect part instances from their part instance ids.

The part instances are known by their part instance ids (these are NOT their geometric instance ids).

Such a FilterItemInterface may be created by first determining the part instance ids with a FilterSolverInterface, asking to retrieve their part instance ids (setRetrievePartInstanceIds) and then create a FilterPartInstanceListInterface with the given ids.

Warning : using such a FilterItemInterface is very risky since part instance ids are recomputed at each new 3djuump Infinite build process. That means that creating such a FilterItemInterface on a build will be invalidated if a new build is done on your project. It is highly recommended to create your FilterItemInterfaces based on geometric values and metadata rather than their part instance id. Use extreme caution when using this type of FilterItemInterface and be sure you know what you are doing. Moreover, such a FilterItemInterface may consume more memory than a combination of other FilterItemInterfaces if a large number of part instance id is inside the FilterPartInstanceListInterface.

The FilterPartInstanceListInterface interface is created through the createFilterPartInstanceList.

The FilterPartInstanceListInterface has the type FT_PARTINSTANCE (getFilterType).

The FilterPartInstanceListInterface has a depth contribution of 1.

/** 
* Sample to illustrate how to use a FilterPartInstanceListInterface.
*/
import {
ConfContextInterface, VisibilityContextInterface, FilterSolverInterface, DataSessionInterface,
FilterPartInstanceListInterface,
} from 'generated/documentation/appinfiniteapi';

// the DataSessionInterface has been created previously and is connected
let lDataSession : DataSessionInterface;
// the `part instances` list that should be included in the filter
let lPartsInstanceToFilter : number[];
// the build id that is open at the moment
let lBuildId : string;

// 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);

// create a Filter Solver
const lFilterSolver : FilterSolverInterface = lDataSession.createFilterSolver();

// create a `part instance` list filter
const lFilterPartInstanceList : FilterPartInstanceListInterface = lDataSession.createFilterPartInstanceList();
// useless, FilterOperator.FO_UNION is the default operator when creating a new filter
// lFilterPartInstanceList.setFilterOperator(FilterOperator.FO_UNION);
// set the `part instance ids` that we want to use, and the build id (check to avoid using the same FilterPartInstanceListInterface
// on multiple builds)
lFilterPartInstanceList.setPartInstanceList(lPartsInstanceToFilter, lBuildId);

// and add the filters
// push back (-1) the `part instance` list filter
lFilterSolver.insertFilter(-1, lFilterPartInstanceList);

// 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 Available Filters for a list of other [FilterItemInterfaces](FilterItemInterface.html).
Metadata/Filters

See

Hierarchy

Methods

  • Adds a listener to an event type.

    When an event of the type pType fires, the callback pListener will be called. This function returns a unique string id that may be used in removeEventListenerById to allow simple listener removal. It is possible to add an object that will be included in the callback to avoid creating too many closures.

    Returns

    The id of the inserted callback (actually an UUID).

    Parameters

    • pType: string
      in
      The type of the event pListener will be called upon.
    • pListener: tListenerCallback
      in
      The listener function that fires when the given event type occurs.
    • pObject: undefined | Object
      in
      The optional object the callback will be called with when the given event fires.

    Returns string

  • Adds a listener to an event type.

    When an event of the type pType fires, the callback pListener will be called. This function returns a unique string id that may be used in removeEventListenerById to allow simple listener removal.

    Returns

    The id of the inserted callback (actually an UUID).

    Parameters

    • pType: string
      in
      The type of the event pListener will be called upon.
    • pListener: tListenerCallback
      in
      The listener function that fires when the given event type occurs.

    Returns string

  • Gets the depth contribution of the FilterItemInterface.

    This value is usually one.

    Returns

    The depth contribution of the FilterItemInterface.

    Returns number

  • Gets a deep copy of the internal data of the FilterItemInterface.

    Returns

    The internal FilterItemInterface data.

    Returns any

  • Gets the identifier of the FilterItemInterface.

    Returns

    The identifier of the FilterItemInterface.

    Returns string

  • Gets a copy of the list of part instance ids that were set by setPartInstanceList.

    Returns

    The list of part instance ids to elect.

    Returns Uint32Array

  • Tells if the EventDispatcher has such a callback registered for the given event type.

    Returns

    true if such a listener is installed for the given type of event.

    Parameters

    • pType: string
      in
      The type of the event to test.
    • pListener: tListenerCallback
      in
      The listener function that gets tested.

    Returns boolean

  • Tells if this object has been gotten rid off.

    Returns

    true if dispose has been called on this object.

    Returns boolean

  • Tells if the FilterItemInterface is enabled.

    If disabled, this FilterItemInterface is completely ignored during all the computations (the behavior is the same as if it had not been created).

    A FilterItemInterface is enabled by default.

    Returns

    true if the FilterItemInterface is enabled.

    Returns boolean

  • Tells if the FilterItemInterface is "inverted".

    When "inverted", a FilterItemInterface elects all the part instances that were not selected if it was not inverted.

    A FilterItemInterface is not "inverted" by default.

    Returns

    true if such a FilterItemInterface is "inverted".

    Returns boolean

  • Removes a listener from an event type.

    If no such listener is found, then the function returns false and does nothing. You must use the exact parameters that were used in addEventListener to actually remove the listener.

    Returns

    true if the callback was removed else false.

    Parameters

    • pType: string
      in
      The type of the listener that gets removed.
    • pListener: tListenerCallback

      The listener function that gets removed.

    • pObject: undefined | Object

      The listener object that was used when addEventListener was called.

    Returns boolean

  • Removes a listener from an event type.

    If no such listener is found, then the function returns false and does nothing. You must use the exact parameters that were used in addEventListener to actually remove the listener.

    Returns

    true if the callback was removed else false.

    Parameters

    • pType: string
      in
      The type of the listener that gets removed.
    • pListener: tListenerCallback

      The listener function that gets removed.

    Returns boolean

  • Removes a listener by its id.

    If no such listener is found, then the function returns false and does nothing. You must use the return value of addEventListener to actually remove the listener.

    Returns

    true if the callback was removed else false.

    Parameters

    • pId: string
      in
      The id returned by the call to [addEventListener](FilterPartInstanceListInterface.html#addEventListener) that you want to remove.

    Returns boolean

  • Sets the FilterItemInterface enabled/disabled status.

    If disabled, this FilterItemInterface is completely ignored during all the computations (the behavior is the same as if it had not been created). Use addEventListener on the event FilterEnabledChanged to know when the FilterItemInterface has changed its enabled status.

    A FilterItemInterface is enabled by default.

    Parameters

    • pEnabled: boolean
      in
      If true, the given FilterItemInterface is enabled.

    Returns void

  • Sets the content of the FilterItemInterface from a former call to getFilterData.

    Use addEventListener on the event FilterDataChanged to know when the FilterItemInterface internal data changed.

    Returns

    true if the data is set.

    Parameters

    • pFilterData: any
      in
      Internal FilterItemInterface data to set.

    Returns boolean

  • Sets the identifier of the FilterItemInterface. Make sure the id is unique. A unique FilterItemInterface identifier is created if the identifier is not overridden.

    Parameters

    • pFilterId: string
      in
      The new identifier of the FilterItemInterface.

    Returns void

  • Sets the "inverted" status of the FilterItemInterface.

    When "inverted", a FilterItemInterface elects all the part instances that were not selected if it was not inverted. Use addEventListener on the event FilterInvertedChanged to know when the FilterItemInterface has changed its "inverted" status.

    A FilterItemInterface is not "inverted" by default.

    Parameters

    • pInverted: boolean
      in
      If true, such a FilterItemInterface will be "inverted".

    Returns void

  • Sets the list of part instances to elect.

    As a list of part instance ids is local to a build, and is VERY likely to change between two builds of the same project, the buildid of the build to use must be set to avoid filtering on an incorrect build. Using a pBuildId that does not correspond to the current open build leads to a no-op and returns false.

    Use addEventListener on the event FilterDataChanged to know when the FilterPartInstanceListInterface data changed.

    Warning : There is no validation that the input values are correct (i.e. integers strictly superior to 1 and inferior to max part instance id getMaximumPartInstanceId), or that the part instances list is the same as previously. The invalid values will be discarded, and setting the same values as previously will trigger a recompute on the server, and the function will return true.

    Returns

    true if pBuildId is equal to the 3djuump build actually open in the datasession.

    Parameters

    • pPartInstanceList: number[] | Uint32Array
      in
      The list of part instances to elect.
    • pBuildId: string
      in
      Id of the build the FilterPartInstanceListInterface belongs to.

    Returns boolean