This class allows to control the model with specified id in the Viewer. It represents OccViewer.InteractiveContext + OccViewer.PropertyManager and OccViewer.ModelLoader wrapper. The model can be existing or not and can be loaded from memory, file or URL. The model can consists from one or many graphical objects which have the same id or starts from the provided id. User should specify id explicitly at construction time. Beware to use unique ids - loading multiple objects with the same id will result in logical issues!

Usual lifetime of the object:

Hierarchy (View Summary)

Constructors

Properties

_myObjId: string
_myViewer: OccViewer

Accessors

  • get bndBox(): BndBox
  • Get bounding box.

    Returns BndBox

  • get color(): string
  • Return object's global RGB color defined as OccViewer.ColorString

    Returns string

  • set color(theColor: string): void
  • Set object's global color or empty string to unset.

    Parameters

    • theColor: string

    Returns void

  • get hasCustomMaterial(): boolean
  • Has custom material or not.

    Returns boolean

  • set hasCustomMaterial(theValue: boolean): void
  • Has custom material or not.

    Parameters

    • theValue: boolean

    Returns void

  • get id(): string
  • Get object id as string.

    Returns string

  • get isExist(): boolean
  • Return TRUE if object with specified Id exists.

    Returns boolean

  • get isLoaded(): boolean
  • Return TRUE if object with specified Id has deferred data loaded.

    Returns boolean

  • get metallic(): number
  • Custom material metallic factor 0..1.

    Returns number

  • set metallic(theValue: number): void
  • Custom material metallic factor 0..1.

    Parameters

    • theValue: number

    Returns void

  • get roughness(): number
  • Custom material roughness factor 0..1.

    Returns number

  • set roughness(theValue: number): void
  • Custom material roughness factor 0..1.

    Parameters

    • theValue: number

    Returns void

  • get scale(): number
  • Scale factor.

    Returns number

  • set scale(theValue: number): void
  • Scale factor.

    Parameters

    • theValue: number

    Returns void

  • get selectable(): boolean
  • Return object's selectable status.

    Returns boolean

  • set selectable(theIsSelectable: boolean): void
  • Set object's selectable status.

    Parameters

    • theIsSelectable: boolean

    Returns void

  • get transparency(): number
  • Return object's transparency within [0.0, 1.0] range, or 0.0 if unspecified.

    Returns number

  • set transparency(theTransp: number): void
  • Set object's global transparency within [0.0, 1.0] range, or 0.0 to unset.

    Parameters

    • theTransp: number

    Returns void

  • get visible(): boolean
  • Return object visibility state.

    Returns boolean

  • set visible(theToShow: boolean): void
  • Set object visibility state.

    Parameters

    • theToShow: boolean

    Returns void

  • get visibleInView(): null | Subview
  • Return view in which object is visible or NULL if it is not displayed or displayed in multiple views.

    Returns null | Subview

  • set visibleInView(theView: null | Subview): void
  • Set object to be visible only within specific view or all views (NULL) - view affinity. Note that visible still has to be set independently.

    Parameters

    Returns void

  • get zLayer(): ZLayerId
  • Return z layer of object.

    Returns ZLayerId

  • set zLayer(theLayer: ZLayerId): void
  • Set z layer of object.

    Parameters

    Returns void

Methods

  • Load deferred mesh data from file previously opened by InteractiveMesh.openUrlAsync or by opening new specified URL. This method load data without displaying.

    Parameters

    • OptionaltheFileUrl: string

      the file URL address to read model from if you want to download model before mesh loading

    • OptionaltheToExpand: boolean

      expand model or display as a single part

    Returns Promise<boolean>

    FALSE if object was not found

  • Open object from loaded file OccViewer.ModelLoader.preloadFile and register presentation(s) in erased state.

    Parameters

    • theFilePath: string

      path to the file in emulated filesystem

    • theToExpand: boolean

      expand model or display as a single part

    Returns boolean

    FALSE on reading error

  • Open object from memory and register presentation(s) in erased state.

    Parameters

    • theBuffer: ArrayBuffer

      pointer to data

    • theToExpand: boolean

      expand model or display as a single part

    Returns boolean

    FALSE on reading error

  • Open object from the given URL and register presentation(s) in the hidden (erased) state. If Interactive Object was created with empty id, it will be generated from the given URL.

    The file will be loaded asynchronously.

    Depending on the file format, this method might read only a model structure without geometry - see OccViewer.modelLoader. Warning! Displaying an object with not yet loaded geometry will produce errors!

    Parameters

    • theFileUrl: string

      the file URL address

    • theToExpand: boolean

      expand model or display as a single part

    Returns Promise<boolean>

    FALSE if model cannot be opened

  • Remove custom color an specific group of triangles

    Parameters

    • theToClearAll: boolean = true

    Returns void

  • rotate object around given axis.

    Parameters

    Returns void

  • rotate object around point by provided axis and angle.

    Parameters

    Returns void

  • Set custom color an specific group of triangles

    Parameters

    • theGroupColors: GroupColor[]

      array of group of triangles and color

    • theToReplace: boolean = true

      flag that tell if current colorized triangles should be replaced.

    Returns void