Markup data

The HOOPS Web Viewer provides functionality which allows a developer to measure and annotate the model. This markup data can be exported (and subsequently imported) to allow developers to implement advanced collaborative workflows with HOOPS Communicator. This management of this markup data is the responsibility of the application developer.

"Moto measure"

HOOPS Web Viewer displaying a model with measurement data.

Exporting markup data

Markup data consists of View, Note, and Measurement objects which are interactively created by the user and can be stored and accessed via JSON objects. .

Markup data in the HOOPS Web Viewer can be accessed in two different ways:

  • Callbacks - Callbacks can be registered for View, Note, and Measurement update and deletion. The update callback fires when an object is first created or an existing object has been updated using the interface. A Javascript object containing all the relevant data needed to recreate the markup object is passed to the callback. Each of these objects contains a uniqueId property which uniquely identifies this particular object and can be used as a handle for future operations. The delete callback fires when a markup item is deleted. The callback is passed the unique identifier of the object that was just deleted.

  • API - View, Note, and Measurement objects can be retrieved directly from the web viewer for your own purposes (such as storage in a database). Objects can be deleted using their respective delete methods and passing the uniqueId handle.

Importing markup data

Once the markup data is exported, it can then be added back to the HOOPS Web Viewer in two different ways:

  • Initiating an AJAX request - By calling the <a class=”code” href=”api_ref/functions.html#setMarkupDataUrl”>setMarkupDataUrl( url )</a> method, the viewer will make a synchronous request for markup data before the first update. This is useful if you have an endpoint that can respond directly with JSON data in the correct format. The web viewer will automatically parse and load the result of this call.

  • Passing a JavaScript object - To directly load the markup data, call the <a class=”code” href=”api_ref/typedoc/classes/communicator.markupmanager.html#loadmarkupdata”>loadMarkupData( data )</a> method with an appropriately structured JavaScript object (see below).

When loading markup data into the web viewer, it should parse to or be a JavaScript object in the following format:

{
        views: [View, ...],
        notes: [Note, ...],
        measurements: [Measurement, ...]
}

Markup object definitions

The types of objects (and their JSON fields) that can be imported and exported to the HOOPS Web Viewer:

Camera

Description: A view of the model.

Fields:

Name

Type

Description

Notes

name

String

a label for this object

not currently in use

uniqueId

String

unique handle for this object

position

Point

the world space position of the camera

target

Point

the world space position of the camera target

up

Point

the camera’s up vector

projection

int

the projection mode: 0 for perspective, 1 for orthographic

width

float

width of the viewport

height

float

height of the viewport

CuttingPlane

Description: Plane that controls visible portion of a model.

Orientations:

Value

Description

0

cut with plane: X=1

1

cut with plane: Y=1

2

cut with plane: Z=1

3

cut with arbitrary plane

Fields:

Name

Type

Description

Notes

position

int

indicates the amount of the model that is hidden (0 - 100)

plane

Plane

plane to use for cutting if orientation is not cardinal X, Y, or Z

not currently in use

planeCenter

Point

center point to use for plane if orientation is not cardinal X, Y, or Z

inverted

boolean

true if the plane should hide geometry in front of it, else false

orientation

int

indicates the plane to cut with

LinearMeasurement

Description: Measurement of the distance of a line edge on a model.

Fields:

Name

Type

Description

Notes

uniqueId

String

unique handle for this object

userData

String

user defined data attached to this object

type

String

the measurement type

value

float

the measurement length

precision

int

the number of digits to display in the measurement text

modelEntityId

String

handle of the entity this measurement is associated with

not currently in use

modelSubEntityId

String

handle of the subentity this measurement is associated with

not currently in use

lineStart

Point

world space position of the start point of the measurement line

lineEnd

Point

world space position of the end point of the measurement line

lineShiftedStart

Point

world space position of the start arrow of the measurement handle

lineShiftedEnd

Point

world space position of the end arrow of the measurement handle

text

String

string containing the computed measurement text

textPosition

Point

world space coordinates of the text for this measurement

textSize

float

text size override for this measurement

not currently in use

textColor

Color

text color override for this measurement

not currently in use

lineWeight

float

line weight override for this measurement

not currently in use

lineColor

Color

line color override for this measurement

not currently in use

Note

Description: User text that can be pinned to a location on a model.

Fields:

Name

Type

Description

uniqueId

String

unique handle for this object

userData

String

user defined data attached to this object

headline

String

title of the note

text

String

the contents of the note

color

Color

the RGB value of the note’s pin handle

anchor

Point

world space coordinates of the point where the note attaches to the object

position

Point

world space coordinates of the top left of the note display window

FaceFaceAngleMeasurement

Description: Measurement of the angle between two faces on a model.<br/><br/>

Fields:

Name

Type

Description

Notes

uniqueId

String

unique handle for this object

userData

String

user defined data attached to this object

type

String

the measurement type

value

float

the angle (degrees) between the two faces

precision

int

the number of digits to display in the measurement text

modelEntity1Id

String

handle of the first entity this measurement is associated with

not currently in use

modelSubEntity1Id

String

handle of the first subentity this measurement is associated with

not currently in use

modelEntity2Id

String

handle of the second entity this measurement is associated with

not currently in use

modelSubEntity2Id

String

handle of the second subentity this measurement is associated with

not currently in use

plane1

Plane

first measurement plane

plane2

Plane

second measurement plane

planePoint1

Point

world space position on plane1 where the measurement originates

planePoint2

Point

world space position on plane2 where the measurement originates

arcPoint1

Point

world space position of the beginning of the measurement arc

arcPoint2

Point

world space position of the end of the measurement arc

helperPoint

Point

point used to align the planePoints for planar arc construction

textAnchor

Point

the world space position the origin of the line drawn to the text position

text

String

string containing the computed measurement text

textPosition

Point

world space coordinates of the text for this measurement

textSize

float

text size override for this measurement

not currently in use

textColor

Color

text color override for this measurement

not currently in use

lineWeight

float

line weight override for this measurement

not currently in use

lineColor

Color

line color override for this measurement

not currently in use

FaceFaceDistanceMeasurement

Description: Measurement of the distance between two faces on a model. Note there are currently five different cases that can occur when measuring face distances. These are enumerated below and are reflected in the “subtype” member of the FaceFaceDistanceMeasurementMarkup object.<br/><br/>

Subtypes:

Subtype value

Description

0

2 planar faces with same or inverted orientation

1

2 planar faces with different orientation

2

2 1 planar face and 1 circular / cone face

3

2 circular / cone with same center axis orientation

4

2 circular / cone with different center axis orientation

Fields:

Name

Type

Description

Notes

uniqueId

String

unique handle for this object

userData

String

user defined data attached to this object

type

String

the measurement type

value

float

the distance between the two faces

precision

int

the number of digits to display in the measurement text

modelEntity1Id

String

handle of the first entity this measurement is associated with

not currently in use

modelSubEntity1Id

String

handle of the first subentity this measurement is associated with

not currently in use

modelEntity2Id

String

handle of the second entity this measurement is associated with

not currently in use

modelSubEntity2Id

String

handle of the second subentity this measurement is associated with

not currently in use

subtype

int

indicates the entity types for this measurement

distance

float

the measurement distance

distancePoint1

Point

world space position where the first measurement point originates

distancePoint2

Point

world space position where the second measurement point originates

planePointShifted1

Point

world space position of the start arrow of the measurement handle

planePointShifted2

Point

world space position of the end arrow of the measurement handle

axis1Point1

Point

point used to construct first selection axis

axis1Point2

Point

point used to construct first selection axis

axis2Point1

Point

point used to construct second selection axis

axis2Point2

Point

point used to construct second selection axis

text

String

string containing the computed measurement text

textPosition

Point

world space coordinates of the text for this measurement

textSize

float

text size override for this measurement

not currently in use

textColor

Color

text color override for this measurement

not currently in use

lineWeight

float

line weight override for this measurement

not currently in use

lineColor

Color

line color override for this measurement

not currently in use

RadialMeasurement

Description: Measurement of the radius of a circular edge on a model.

Fields:

Name

Type

Description

Notes

uniqueId

String

unique handle for this object

userData

String

user defined data attached to this object

type

String

the measurement type

value

float

the distance between the two faces

precision

int

the number of digits to display in the measurement text

modelEntityId

String

handle of the first entity this measurement is associated with

not currently in use

modelSubEntityId

String

handle of the first subentity this measurement is associated with

not currently in use

circleCenter

Point

world space position of the center of the circle represented by this measurement

lineVector

Point

directional vector of the line which is drawn between the center and text label

data

Point array

array containing the world space points making up the arc for this measurement

text

String

string containing the computed measurement text

textPosition

Point

world space coordinates of the text for this measurement

textSize

float

text size override for this measurement

not currently in use

textColor

Color

text color override for this measurement

not currently in use

lineWeight

float

line weight override for this measurement

not currently in use

lineColor

Color

line color override for this measurement

not currently in use

RedlineText

Description: Redline element containing text.<br/><br/>

Fields:

Name

Type

Description

uniqueId

String

unique handle for this object

userData

String

user defined data attached to this object

type

String

the redline type

text

String

display text

position

Point

world space position of the top left anchor point for the text box

width

int

pixel width of the text box

height

int

pixel height of the text box

RedlineCircle

Description: Circular redline element.

Fields:

Name

Type

Description

uniqueId

String

unique handle for this object

userData

String

user defined data attached to this object

type

String

the redline type

center

Point

world space position of the center anchor

point2

Point

world space position of a point on this circle

RedlineFreehand

Description: User drawn redline element.

Fields:

Name

Type

Description

uniqueId

String

unique handle for this object

userData

String

user defined data attached to this object

type

String

the redline type

points

Point array

world space positions of point anchors

RedlineRectangle

Description: Rectangular redline element.

Fields:

Name

Type

Description

uniqueId

String

unique handle for this object

userData

String

user defined data attached to this object

type

String

the redline type

point1

Point

world space position of the first anchor point

point2

Point

world space position of the second anchor point

SelectionInfo

Description: information about a selection event.

Fields:

Name

Type

Description

result

String

‘selection’ if there was a selection, or ‘none’ if no selection occurred

resultType

String

‘part’ if the selection mode is set to part or ‘face’ if the mode is set to face selection

FaceId

int

indicates the faceId of that was selected

uniqueId

int

The uniqueId of the part that was selected. Only present if result (above) is selection. The part that contains the face that was selected is present in face selection mode

View

Description: A view including camera, cutting plane, edge and face visibility, and model explosion.

Fields:

Name

Type

Description

name

String

a label for this object

uniqueId

String

unique handle for this object

userData

String

user defined data attached to this object

camera

Camera

the camera

cuttingPlanes

array

the cutting planes for this view

explosionLevel

int

the model explosion level (0 - 100)

edgeVisibility

bool

indicates whether model edges are visible

faceVisibility

bool

indicates whether model faces are visible