Skip to main content

@twinfinity/core

Index

Classes

Enumerations

Functions

Interfaces

Type Aliases

Variables

Type Aliases

AABB

AABB: BoundingInfo

AttachOption

AttachOption: Pick<PickOptionFlags, isGeometryIntersectionEnabled> & { applyColor?: boolean }

Options for attach operation.

BimApiClient

BimApiClient: TwinfinityApiClient
@deprecated

BimApiLoadOptions

Options which can be used when loading IFC’s. For example when calling setContainer.

BimApiOptions

BimApiOptions: (({ isPSAuthenticationRedirectEnabled?: false; session?: { getAuthorizationHeader: () => Promise<string> } } | { isPSAuthenticationRedirectEnabled: true }) & { applicationName?: string })

Creation options for BimApi

BimBackendApi

BimBackendApi: TwinfinityApiClient

Alias for backwards compatibility

@deprecated

BimChange

Discriminant union type (look at type property) representing a Twinfinity change. A change can be a file (IFC, DWG etc), layer or folder. Further types will be added in the future. Common for all changes are that they have a unique id and a version.

BimChangeUploadable

BimChangeUploadable: Exclude<BimChange, BimChangeLayer | BimFolder | BimContainer>

Defines change types that it is possible to upload files/content for using the UploadApiClient api. Currenty it is only supported to upload files that aren’t IFC or DWG’s.

BimIfcChangeLoader

BimIfcChangeLoader: BimIfcLoader

BimIfcLoaderElementCreateFailure

BimIfcLoaderElementCreateFailure: Failure<{ httpStatus: number; reason: string } & { ifc: Pick<BimChangeIfc, id | version | url> }>

Represents the failure result when craeting a BimIfcLoaderElement fails.

BimIfcMeshIntersectionCameraCommonOptions

BimIfcMeshIntersectionCameraCommonOptions: Omit<PickOptionFlags, textureSize | isNearbyRenderedObjectsIntersectionFallbackEnabled | type>

Common BimIfcMesh intersection options

BimIfcMeshIntersectionOptions

BimIfcMesh intersection options

BimObjectAttributeValue

BimObjectAttributeValue: string | number | boolean | string[] | number[] | boolean[]

BimProductAndMeshAndHitInfo

BimProductAndMeshAndHitInfo: PickResult

Alias for PickResult for backwards compatibility.

@deprecated

Use PickResult instead.

BimPropertySetScalarValueType

BimPropertySetScalarValueType: string | number | boolean

BimPropertySetValueType

BimPropertySetWritable

BimPropertySetWritable: Mutable<BimPropertySet> & { isReadonly: boolean }

BimPropertyUnitType

BimPropertyUnitType: BimPropertyUnit[] | BimPropertyUnit

BlobData

BlobData: File | Blob | ArrayBuffer | unknown

Represents generic data type. Intended use is to handle data which can be in a file, blob, arraybuffer or js object, js primitive form etc. For example, to pass data into a method that shall store the data but does not care about how the data is represented. This is useful for storing binary data, primitive types and js objects.

BuildType

BuildType: Dev | Prod

Represents either production or development build type

CameraDirection

CameraDirection: top | bottom | front | back | left | right | default

Consists of different strings explaining a viewing direction for the camera.

CameraMode

CameraMode: fps | pivot | all

CameraMode can have one of three values

  • ‘fps’ = first person camera, mouse control the rotation of the camera pivoting around itself. Move around with keyboard keys W, A, S and D.
  • ‘pivot’ = Left mouse button intersects BIM model for finding a pivot point. This point is then used for rotation calculation camera about pivot.
  • ‘all’ = ‘pivot’ by default, ‘fps’ when holding the right mouse button.

Middle mouse button pans the camera view and scroll wheel controls zoom.

CameraProjection

CameraProjection: perspective | orthographic

CameraProjection can have one of two strings.

  • ‘perspective’ = normal geometry scale by distance.
  • ‘orthographic’ = isometric view projection where distance to camera does not affect object scale.

CanvasPosition

Options to use when referencing a coordinate on the canvas.

ClipPlaneName

ClipPlaneName: keyof Pick<Scene, clipPlane | clipPlane2 | clipPlane3 | clipPlane4 | clipPlane5 | clipPlane6>

ClipPlaneOptions

ClipPlaneOptions: EnableClipPlanePoint | DisableClipPlanePoint

ClipPlanes

ClipPlanes<T>: { [ plane in ClipPlaneName ]?: T }

Type parameters

Container

Container: BimContainer

Alias for backwards compatibility

@deprecated

CoordinateTrackerId

CoordinateTrackerId: unknown

Id of a tracked 3D coordinate.

DragPointPositioningFunction

DragPointPositioningFunction: (points: DynamicPolygonPoint[]) => Vertex3

Type declaration

DragPointPositioningFunctionOrIndex

DragPointPositioningFunctionOrIndex: DragPointPositioningFunction | number

Failure

Failure<T>: { isFailure: true } & T

Represents a failure or error if you will. Use function Fail to create a failure instance.


Type parameters

  • T

FrustumPlanes

FrustumPlanes: [Plane, Plane, Plane, Plane, Plane, Plane]

Represents a frustum.

HttpRequestInit

HttpRequestInit: Omit<RequestInit, method>

Same as RequestInit but without the method. Used with methods on Http

IfcClassType

IfcClassType: keyof typeof predefinedIfcClassType

All possible types an IFC class can be assigned. The type is used to group IFC classes into categories.

ImmutableMergableObjectWithState

ImmutableMergableObjectWithState<P>: Readonly<MergableObjectWithState<P>>

Type parameters

  • P

LayerCompatibleChange

LayerCompatibleChange: Exclude<BimChange, BimChangeLayer>

Discriminant union type (look at type property) representing a Twinfinity change. for those change types (BimChange) where layers can be attached. Use LayerCompatibleChange.availableLayerDefinitions in order to determine if it is possible to attach a layer to a change of type LayerCompatibleChange.

LayerFailure

LayerFailure: Failure<{ httpStatus?: number; reason: string }>

Represents a layer failure.

MailMessageId

MailMessageId: string

Id of the sent message.

MarkupEntityDto

MarkupEntityDto: AreaDto | LineDto | ArrowDto | TextDto | CircleDto

MarkupLayerEvent2D

MarkupLayerEvent2D: MergableObjectEventArgs<MarkupEntityBase> & { eventType: MarkupEventTypes.Added | MarkupEventTypes.Delete | MarkupEventTypes.Update }

Type which represents an event on a 2d MarkupLayer.

MarkupProperty

MarkupProperty: number | boolean | string

MergableObject

MergableObject<T>: MergableObjectProps & MergableObjectOperations<T>

Makes it possible to work with local objects to which there are (possibly) remote counterparts. Will automatically resolve most conflicts except those that occur when both the local and remote object have been modified in some way that will result in a conflict. Example: Local object is modified (which means it must have existed remotely) but the remote no longer exists.


Type parameters

  • T: MergableObjectProps

MergableObjectEventArgs

MergableObjectEventArgs<T>: MergableObjectLocalEventArgs<T> | MergableObjectRemoteEventArgs<T>

Represents event for change in local or remote object. Use the eventSource property to determine if the event is local or remote.


Type parameters

  • T

Mutable

Mutable<T>: { -readonly [ P in keyof T ]: T[P] extends ReadonlyArray<infer U> ? Mutable<U>[] : Mutable<T[P]> }

Type parameters

  • T

MutableShallow

MutableShallow<T>: { -readonly [ P in keyof T ]: T[P] }

Strip readonly from all properties


Type parameters

  • T

PackedIndices

PackedIndices: TypedArray

PackedNormals

PackedNormals: Uint16Array

PackedPositions

PackedPositions: TypedArray

Permission

Permission: PermissionIndex | keyof typeof Access | bigint

Represents a permission. Use together with Permissions. If using the string representation (‘view’, ‘add’ etc) then it represents a single permission. If using the bigint representation then it is assumed to be a bitmask and can represent all permissions.

PermissionIndex

PermissionIndex: keyof typeof permissionMask

string definitions for the predefined permission masks.

PermissionJson

PermissionJson: string

Defines how Permissions is represented in JSON.

PickOption

Options for pick operation.

PickResult

The result of a “pick” operation. For example if user clicks something on screen a pick operation can be issued to determine what the click, if anything, hit. It is a discriminant union. Use the type property or instanceof to determine what kind of result the pick operation gives. It can be

  • Empty.
  • A BabylonJS mesh
  • A Icon. Includes the BabylonJS mesh that the Icon belongs to.
  • A IFC product and the IFC mesh in it. Includes the BabylonJS mesh that the Icon belongs to.

PointerButtonInfo

PointerButtonInfo: { button: number; downAt: number; duration: number; event: down } | { button: number; downAt: number; duration: number; event: up; upAt: number } | { event: none }

Represents pointer button events and timings.

PolyLinePoint

PolyLinePoint: TrackCoordinate3D

A polyline point type

PredefinedIfcClassId

PredefinedIfcClassId: `${typeof IfcClassIdPrefix}${Capitalize<keyof typeof tmpPredefinedIfcClassIdWithoutPrefix>}`

The known predefined IFC class IDs. Can be used with is to determine if a class is a predefined IFC class.

@example
function checkIfWindow(o: BimIfcObject): boolean {
return o.class.is('IfcWindow');
}

PredefinedIfcClassIdWithoutPrefix

PredefinedIfcClassIdWithoutPrefix: `${Uncapitalize<keyof typeof tmpPredefinedIfcClassIdWithoutPrefix>}`

Represents a predefined IFC class ID without the ‘Ifc’ prefix.

PropertyChangeEventData

PropertyChangeEventData<T>: AddTypeDiscriminant<PropertyChangeEventDataBase<T>, set> | AddTypeDiscriminant<PropertyChangeEventDataBase<T>, delete> | AddTypeDiscriminant<Exclude<PropertyChangeEventDataBase<T>, oldVal>, define>

Represents the event data for a property change.


Type parameters

  • T

    The type of the property value.

PropertyChangeObservable

PropertyChangeObservable<T>: T & { onPropertyChanged: Observable<PropertyChangeEventData<T>> }

Represents an object that can observe property changes.


Type parameters

  • T

    The type of the object being observed.

SimpleBoundingBox

SimpleBoundingBox: [number, number, number, number, number, number]

SimpleBoundingInfo

SimpleBoundingInfo: { center: [number, number, number]; corners: [[number, number, number], [number, number, number], [number, number, number], [number, number, number], [number, number, number], [number, number, number], [number, number, number], [number, number, number]]; max: [number, number, number]; min: [number, number, number]; radius: number; sizeXYZ: [number, number, number] }

Type declaration

  • center: [number, number, number]
  • corners: [[number, number, number], [number, number, number], [number, number, number], [number, number, number], [number, number, number], [number, number, number], [number, number, number], [number, number, number]]
  • max: [number, number, number]
  • min: [number, number, number]
  • radius: number
  • sizeXYZ: [number, number, number]

TypedArray

TypedArray: Uint8Array | Uint16Array | Uint32Array | Float32Array | Float64Array

UploadApiClientContentOperation

Defines available operations for the createFileSession method.


Type parameters

UploadApiClientFailure

UploadApiClientFailure: Failure<{ reason: string; status: number }>

Represents the failure type.

Viewer

VisibleSelectable

Represents something that is visible. Such as a BabylonJS mesh, a Icon or a BimProductAndMesh.

Variables

constDEPTH_DIMENSIONS

DEPTH_DIMENSIONS: depthDimensions = 'depthDimensions'

constEXPENSIVE_NORMALS

EXPENSIVE_NORMALS: EXPENSIVE_NORMALS = 'EXPENSIVE_NORMALS'

constINVERTED_PROJECTION_MATRIX

INVERTED_PROJECTION_MATRIX: invertedProjectionMatrix = 'invertedProjectionMatrix'

constNEAR_FAR

NEAR_FAR: nearFar = 'nearFar'

constNORMALS_FROM_DEPTH

NORMALS_FROM_DEPTH: string = ...

constVIEWSPACE_POSITION_FROM_LINEAR_DEPTH

VIEWSPACE_POSITION_FROM_LINEAR_DEPTH: string = ...

constVIEWSPACE_POSITION_FROM_LOGARITHMIC_DEPTH

VIEWSPACE_POSITION_FROM_LOGARITHMIC_DEPTH: string = ...

constboundingClientRectCache

boundingClientRectCache: BoundingClientRectCache = ...

Predefined cache for bounding client rectangles. This is useful when cost of HTMLElement.getBoundingClientRect() becomes a problem (it causes browser reflow which in some situations can be very costly.). By caching the information we get from the DOMRect we can avoid this cost.

constbuildInfo

buildInfo: Readonly<BuildInfo> = ...

constendianess

endianess: little | big | unknown = ...

Stores the platform endianess.

consttelemetry

telemetry: CompoundTelemetryClient = ...

Use for telemetry logging. Use this instead of console.log and similiar. It is used internally by the Twinfinity Client API. By default logs are output to console. If application insights is detected in the page, when telemetry is first accessed, then it will also automatically log to application insights.

Simplest way to forward logs to application insights is to use the “Snippet based setup” from https://docs.microsoft.com/en-us/azure/azure-monitor/app/javascript. Ensure that the snippet comes before all other scripts in the page.

@example
// Log a warning.
telemetry.traceTrace({message: "log message", severityLevel: 2});
@example
// Explicitly register existing application insights instance. See "npm based setup" at
// https://docs.microsoft.com/en-us/azure/azure-monitor/app/javascript for how to get the instance.
telemetry.set('myApplicationInsights', applicationInsightsInstance);
telemetry.traceTrace({message: "log message" }); // Log a debug log. Same output as console.log
@example
// Explicitly register custom telemetryclient
class CustomClient implements TwinfinityTelemetryClient { ... }
telemetry.set('customclient', new CustomClient());
telemetry.isConsoleLoggingEnabled = false; // Disable console logging
// Log a debug log. Will be forwarded to the custom client. If
// application insights was registered in the page then the log will be sent
// there too.
telemetry.traceTrace({message: "log message" });

constunits

units: typeof units = ...