Vertex Viewer SDK
    Preparing search index...

    Class SceneItemOperationsBuilder

    A class that is responsible for building operations on scene items for a specific scene. This executor requires a query, and expects execute() to be invoked in order for the changes to take effect.

    Implements

    Index

    Constructors

    Methods

    • Specifies that the scene items matching the query should have their overridden end item state removed.

      Returns SceneItemOperationsBuilder

      const viewer = document.querySelector('vertex-viewer');
      const scene = await viewer.scene();

      // Clear the overridden end item state of the item with the `item-uuid` ID
      await scene.elements((op) => [
      op.items.where((q) => q.withItemId('item-uuid')).clearEndItem(),
      ]);
    • Specifies that the scene items matching the query should have any overridden material removed.

      Returns SceneItemOperationsBuilder

      const viewer = document.querySelector('vertex-viewer');
      const scene = await viewer.scene();

      // Clear the overridden material on the item with the `item-uuid` ID
      await scene.elements((op) => [
      op.items.where((q) => q.withItemId('item-uuid')).clearMaterialOverrides(),
      ]);
    • Specifies that the scene items matching the query should have their overridden phantom state removed.

      Returns SceneItemOperationsBuilder

      const viewer = document.querySelector('vertex-viewer');
      const scene = await viewer.scene();

      // Clear the overridden phantom state of the item with the `item-uuid` ID
      await scene.elements((op) => [
      op.items.where((q) => q.withItemId('item-uuid')).clearPhantom(),
      ]);
    • Clears the rendition of scene items matching the query, which will revert the scene item back to the rendition used when creating the item.

      Returns SceneItemOperationsBuilder

      const viewer = document.querySelector('vertex-viewer');
      const scene = await viewer.scene();

      // Switch the rendition of the given item.
      await scene.elements((op) => [
      op.items.where((q) => q.withItemId('item-uuid')).clearRendition(),
      ]);
    • Clears the representation for scene items matching the query.

      Returns SceneItemOperationsBuilder

      const viewer = document.querySelector('vertex-viewer');
      const scene = await viewer.scene();

      // Switch the rendition of the given item.
      await scene.elements((op) => [
      op.items.where((q) => q.withItemId('item-uuid')).clearRepresentation(),
      ]);
    • Specifies that the scene items matching the query should have their overridden transformation matrix removed. The cascade flag determines whether children of the scene items matching the query should also have their overridden transformation matrix removed, and defaults to true.

      Parameters

      • cascade: boolean = true

      Returns SceneItemOperationsBuilder

      const viewer = document.querySelector('vertex-viewer');
      const scene = await viewer.scene();

      // Clear the overridden the transformation matrix for the item with the `item-uuid` ID
      // and do not cascade to preserve transformations on children
      await scene.elements((op) => [
      op.items.where((q) => q.withItemId('item-uuid')).clearTransforms(false),
      ]);

      // Clear the overridden the transformation matrix for the item with the `item-uuid` ID
      // and cascade to clear overridden transformations on children
      await scene.elements((op) => [
      op.items.where((q) => q.withItemId('item-uuid')).clearTransforms(true),
      ]);
    • Specifies that the scene items matching the query should be deselected.

      Returns SceneItemOperationsBuilder

      const viewer = document.querySelector('vertex-viewer');
      const scene = await viewer.scene();

      // Deselect the item with the `item-uuid` ID
      await scene.elements((op) => [
      op.items.where((q) => q.withItemId('item-uuid')).deselect(),
      ]).execute();
    • Specifies that the scene items matching the query should be hidden.

      Returns SceneItemOperationsBuilder

      const viewer = document.querySelector('vertex-viewer');
      const scene = await viewer.scene();

      // Hide the item with the `item-uuid` ID
      await scene.elements((op) => [
      op.items.where((q) => q.withItemId('item-uuid')).hide(),
      ]).execute();
    • Returns this is PmiAnnotationOperationsBuilder

    • Specifies that the scene items matching the query should have their default material overridden to match the specified material.

      Parameters

      Returns SceneItemOperationsBuilder

      const viewer = document.querySelector('vertex-viewer');
      const scene = await viewer.scene();

      // Override the material for the item with the `item-uuid` ID to
      // be red with an opacity of 0.5.
      await scene.elements((op) => [
      op
      .items.where((q) => q.withItemId('item-uuid'))
      .materialOverride(ColorMaterial.create(255, 0, 0, 0.5)),
      ]);

      // Override the material for the item with the `item-uuid` ID to
      // be red with an opacity of 1.
      await scene.elements((op) => [
      op.items.where((q) => q.withItemId('item-uuid')).materialOverride('#ff0000'),
      ]).execute();
    • Specifies that the scene items matching the query should be selected.

      Returns SceneItemOperationsBuilder

      const viewer = document.querySelector('vertex-viewer');
      const scene = await viewer.scene();

      // Select the item with the `item-uuid` ID
      await scene.elements((op) => [
      op.items.where((q) => q.withItemId('item-uuid')).select(),
      ]).execute();
    • Specifies that the scene items matching the query should have their end item state overridden to match the specified endItemState flag. If the endItemState flag is not provided, it will default to true.

      Parameters

      • OptionalendItemState: boolean

      Returns SceneItemOperationsBuilder

      const viewer = document.querySelector('vertex-viewer');
      const scene = await viewer.scene();

      // Mark the item with the `item-uuid` ID as an end item
      await scene.elements((op) => [
      op.items.where((q) => q.withItemId('item-uuid')).setEndItem(true),
      ]);

      // Unmark the item with the `item-uuid` ID as an end item
      await scene.elements((op) => [
      op.items.where((q) => q.withItemId('item-uuid')).setEndItem(false),
      ]);

      End item states do not propagate to children similar to other states like other operations. I.e. calling setEndItem(false) on an item will cause it to be unmarked as an end item, but any children where setEndItem(true) was called previously will remain as end items.

    • Specifies that the scene items matching the query should have their phantom state overridden to match the specified phantomState flag. If the phantomState flag is not provided, it will default to true.

      Parameters

      • OptionalphantomState: boolean

      Returns SceneItemOperationsBuilder

      const viewer = document.querySelector('vertex-viewer');
      const scene = await viewer.scene();

      // Mark the item with the `item-uuid` ID as phantom
      await scene.elements((op) => [
      op.items.where((q) => q.withItemId('item-uuid')).setPhantom(true),
      ]);

      // Unmark the item with the `item-uuid` ID as phantom
      await scene.elements((op) => [
      op.items.where((q) => q.withItemId('item-uuid')).setPhantom(false),
      ]);
    • Specifies that the scene items matching the query should have their transformation matrix overridden to match the specified transformation matrix.

      Parameters

      • matrix: number[] | IMatrix4x4f

      Returns SceneItemOperationsBuilder

      const viewer = document.querySelector('vertex-viewer');
      const scene = await viewer.scene();

      // Override the transformation matrix for the item with the `item-uuid` ID to
      // move the element along the x-axis
      await scene.elements((op) => [
      op
      .items.where((q) => q.withItemId('item-uuid'))
      .transform(Matrix4.makeTranslation(Vector3.create(100, 0, 0))),
      ]);
    • Changes the rendition of scene items matching the query back to their revision's default rendition. This operation only applies to scene items that reference a revision.

      Returns SceneItemOperationsBuilder

      const viewer = document.querySelector('vertex-viewer');
      const scene = await viewer.scene();

      // Switch the rendition of the given item.
      await scene.elements((op) => [
      op.items.where((q) => q.withItemId('item-uuid')).viewDefaultRendition(),
      ]);
    • Changes the rendition of a scene item matching the query. This operation only applies to scene items that reference a revision that contains the given rendition.

      Parameters

      • id: string

      Returns SceneItemOperationsBuilder

      const viewer = document.querySelector('vertex-viewer');
      const scene = await viewer.scene();

      // Switch the rendition of the matching item.
      await scene.elements((op) => [
      op.items.where((q) => q.withItemId('item-uuid')).viewRenditionById('rendition-uuid'),
      ]);
    • Changes the rendition of any scene item matching the query that contains a rendition with the given supplied ID. This operation only applies to scene items that reference a revision that contain a rendition with a matching supplied ID.

      Parameters

      • suppliedId: string

      Returns SceneItemOperationsBuilder

      const viewer = document.querySelector('vertex-viewer');
      const scene = await viewer.scene();

      // Switch the rendition of the given item.
      await scene.elements((op) => [
      op.items.where((q) => q.withItemId('item-uuid')).viewRenditionBySuppliedId('rendition-supplied-id'),
      ]);
    • Changes the representation of scene items matching a query. This operation only applies to scene items that reference a rendition with the given representation ID.

      Parameters

      • id: string

      Returns SceneItemOperationsBuilder

      const viewer = document.querySelector('vertex-viewer');
      const scene = await viewer.scene();

      // Switch the rendition of the given item.
      await scene.elements((op) => [
      op.items.where((q) => q.withItemId('item-uuid')).viewRepresentation('rep-id'),
      ]);