Namespace: PD

PD

Provides tools and utilities to support building modelling and analysis.

The PD namespace forms the core infrastructure for any interactive application that displays, edits and/or interacts with the BIM classes. It provides global state, actions, events and undo/redo, as well as a wide range of utilities for working with WebGL and front-end frameworks such as Vue, React, Knockpout and Enyo. It also provides a range of fundamental geometry creation, mesh generation, scene visualisation and user interaction management tools.

Author:
  • drajmarsh

Classes

Animation
AxisArray
BRep
Base
CAD
CSG
Calculate
CalculateOnIdle
Capsule
ClipPt2D
Clipboard
Clipper
ConnectionData
Cursor
Cursors
Curve
DateTime
DateTimeIterator
DateTimeRange
DaySchedule
Dimensions
Easing
Enumerator
EnumeratorMap
EquationParser
EventDispatcher
File
Font
GlobalActions
GlobalEvents
GlobalState
GlobalUndo
GlobalView
Grid2D
GridCell
GridLines
GridMesh
HUDController
HUDItem
IndexDB
Indexer
Interaction
InteractionEvent
Interactive
Legend
LineFont
LineMesh
LocalCoordinates
LocalDB
Location
MatrixArray
MeshBuilder
MeshFactory
ModelManager
Mouse
MouseArrow
NURBSSurface
NurbsSurfaceArray
OCC
Occlusion
Octree
OctreeHelper
OctreeNode
ParamGroup
ParamType
Parameter
Path
PathPoint
PerezSky
PlaneArray
Point
PolyMesh
Polygon
Polyhedron
Polyline
PouchDB
QuaternionArray
RandomNumberCache
RectMesh
Registry
Rotator
SVG
ScaledVector
SceneEditor
SceneManager
SceneViewer
Schedule
Selection
SelectionFrustum
SelectionHandler
SelectionManager
SelectionMap
SelectionSet
Shading
ShadowPlane
Shape
Shell
SkyDome
Snapper
SolarPosition
Solid
SphericalOcclusion
SunPath2D
SunPath3D
SunPathManager
Tesselator
Text
ThickLineMesh
ThrottledCallback
TimeZones
Triangle
UndoAction
UndoActions
UndoObject
Units
UserModeHandler
Utils
VectorArray
VectorFont
Vertex
Video
View
ViewAngles
ViewController
ViewData
ViewOrbital
VolumeArray
WeatherData

Members


ALIGN <static, readonly>

Defines a set of positional alignment values.

These values are also bit-wise flags that can be used in bit operations. As a result, this object provides a number of methods to check components of a value for just the horizontal (left, center, right) or vertical (bottom, middle, top) components.

Properties:
Name Type Default Description
NONE number 0

No alignment, use absolute positioning.

LEFT number 1

Horizontally align item to the left.

CENTER number 2

Horizontally align item to center.

RIGHT number 4

Horizontally align item to the right.

BOTTOM number 8

Vertically align item to bottom extent.

MIDDLE number 16

Vertically align item to middle.

TOP number 32

Vertically align item to top extent.

BOT_LEFT number 9

Align item to bottom-left corner.

Contains bit flags for BOTTOM and LEFT.

BOT_CENTER number 10

Align item to bottom-center edge.

Contains bit flags for BOTTOM and CENTER.

BOT_RIGHT number 12

Align item to bottom-right corner.

Contains bit flags for BOTTOM and RIGHT.

MID_LEFT number 17

Align item to middle-left edge.

Contains bit flags for MIDDLE and LEFT.

MID_CENTER number 18

Align item to middle-center point.

Contains bit flags for MIDDLE and CENTER.

MID_RIGHT number 20

Align item to middle-right edge.

Contains bit flags for MIDDLE and RIGHT.

TOP_LEFT number 33

Align item to top-left corner.

Contains bit flags for TOP and LEFT.

TOP_CENTER number 34

Align item to top-center edge.

Contains bit flags for TOP and CENTER.

TOP_RIGHT number 36

Align item to top-right corner.

Contains bit flags for TOP and RIGHT.

isTop function

Determines if the given alignment contains the TOP bit flag.

isMiddle function

Determines if the given alignment contains the MIDDLE bit flag.

isBottom function

Determines if the given alignment contains the BOTTOM bit flag.

isLeft function

Determines if the given alignment contains the LEFT bit flag.

isCenter function

Determines if the given alignment contains the CENTER bit flag.

isRight function

Determines if the given alignment contains the RIGHT bit flag.

computeFromUV function

Compute alignment from relative fractional UV coordinates.

_UPPER number 64

For 3D application, refers to the maximum Z value.

_MIDWAY number 128

For 3D application, refers to the midway between minimum and maximum Z value.

isUpper function

Determines if the Z-Axis alignment is UPPER.

useUpper function

Determines if the given alignment contains the UPPER bit flag.

isMidway function

Determines if the given alignment contains the MIDWAY bit flag.

useMidway function

Determines if the given alignment contains the MIDWAY bit flag.

useLower function

Determines if the given alignment contains the MIDWAY bit flag.

getAsOptionList

Retrieve enumerators as an array of {name, value} objects compatible with a PD.ParamType options list.

getParamType function

Retrieve a selectable enumerator list as a PD.ParamType from global cache.

Author:
  • drajmarsh

ANIMATION <static, readonly>

Enumerates the various states of an animation affecting an elements' geometry.

Properties:
Name Type Default Description
DELETED number -99

Indicates that an animation was present, but was recently deleted.

NONE number -1

Indicates that no animation is present.

PAUSED number 0

Indicates that an animation present but paused.

PLAYING number 1

Indicates that an animation is present and currently playing.

Author:
  • drajmarsh

ATTRIB <static, readonly>

Enumerates some standard public/private attribute keys.

Attribute keys are used by the attribute map on entities and points to locate stored data. The aim of using an attribute map instead of properties on the object is to both allow the end user to add arbitrary data to things in the model, and to allow objects to store dynamic data without affecting the low level shape of the object in the code optimiser.

Any attribute key that starts with a '$' sign indicates private or volatile data that is not included when attributes are saved. All other keys are saved when converted to JSON.

Properties:
Name Type Default Description
REF_POS string $refPos

Stores a reference position for an activity or animation.

This is used by PD.Point to store its original position just prior to an interactive transformation. It is also used by BIM.Level to store the level's original starting position at the beginning of a dynamic animation.

SELECTED string $selected

Stores whether or not a point is in the current selection set.

JUNCTION string $junction

Stores a parent junction that generated a point.

CURVE_ID string $curveId

Stores the ID of the curve that a point belongs to.

NORMAL string normal

Stores a normal direction vector on a point.

TANGENT string tangent

Stores a tangent direction vector on a point.

BINORMAL string binormal

Stores a binormal direction vector on a point.

UV string uv

Stores a UV texture coordinate on a point.

COLOR string color

Stores a a colour value for a point.

ALIGNMENT string alignment

Stores the alignment of junction inner/outer boundaries relative to its path.

FIXED_NORMAL string $fixedNormal

Stores whether or not the normal direction vector of a point is fixed so should not be set when calculating smooth normals.

APERTURE_CURVE_PATH string $apertureCurvePath

Stores a path that defines the shape of an aperture as it follows its host junction's curved path.

APERTURE_PATH_CACHE string $aperturePathCache

Stores a path point cache for regenerating an aperture's own path as it follows its host junction's curved path.

CONNECT_DATA string $connectData

Stores start/end connections between column/post/landing profiles.

VIRTUAL_JUNCTIONS string $vrtJunctions

Stores an array of virtual junctions added to a junction.

LINKED_JUNCTION string $trackJunction

Stores a junction that is being tracked by another junction.

REL_POS string relPos

Stores the relative position of a control node in local junction coordinates.

SMOOTH string smooth

Stores the distance from the first/last junction to a control node.

WEIGHT string weight

Stores the relative weighting of a control node.

Author:
  • drajmarsh

AXIS <static, readonly>

Enumerates the major cartesian axis.

This is different from the component indexes of coordinate arrays as it needs to differentiate between positive and negative directions in each axis.

Properties:
Name Type Default Description
NONE number 0

No axis specified, or use the default.

X_POS number 1

The positive X-axis, or the YZ plane pointing towards +X (East).

X_NEG number -1

The negative X-axis, or the YZ plane pointing towards -X (West).

Y_POS number 2

The positive Y-axis, or the XZ plane pointing towards +Y (North).

Y_NEG number -2

The negative Y-axis, or the XZ plane pointing towards -Y (South).

Z_POS number 3

The positive Z-axis, or the XY plane pointing towards +Z (Up).

Z_NEG number -3

The negative Z-axis, or the XY plane pointing towards -Z (Down).

VECTOR number 99

Indicates that a custom vector is used.

This value is typically only used by custom cursors to indicate that movement is restricted to a non-cartesian axis.

PERSPECTIVE number 100

Indicates a perspective view.

isX function

Whether or not the given axis is either X_POS or X_NEG.

isY function

Whether or not the given axis is either Y_POS or Y_NEG.

isZ function

Whether or not the given axis is either Z_POS or Z_NEG.

isCartesianAxis function

Whether or not the given axis is X, Y or Z.

isOrthoOrPerspective function

Whether or not the given axis is NONE or PERSPECTIVE.

isParallel function

Whether or not the two axis are parallel (+/-).

getAsOptionList function

Retrieve enumerators as an array of {name, value} objects compatible with a PD.ParamType options list.

getParamType function

Retrieve a selectable enumerator list as a PD.ParamType from global cache.

Author:
  • drajmarsh

CAP <static, readonly>

Enumerates the different extrusion end caps.

This value can also be used as bitwise flags to test for TOP and BOTTOM. The static functions hasTop() and hasBottom() can be used for that, where a single value can be used to store none, either or both.

Properties:
Name Type Default Description
NONE number 0

Don't add a cap to the extrusion.

TOP number 1

Add a top cap to the extrusion.

BOTTOM number 2

Add a bottom cap to the extrusion.

BOTH number 3

Add a top and bottom cap to the extrusion.

hasTop function

Determines if the given cap includes the TOP bit flag.

hasBottom function

Determines if the given cap includes the BOTTOM bit flag.

Author:
  • drajmarsh

:boolean

CLOSED <static>

An alias for true to make some polygon/polyline method calls more readable.

Type
  • boolean

CONDUCTIVITY <static, readonly>

Provides tools to convert between different thermal conductivity units.

Properties:
Name Type Default Description
WATTS_PER_METRE_KELVIN number 20

The identifier for watts per metre-Kelvin (W/(m-K)).

BTU_PER_HOUR_FOOT_FAHRENHEIT number 21

The identifier for BTU per hour-foot-Fahrenheit (BTU/(h-ft-F)).

toWattsPerMetreKelvin function

Converts a thermal conductivity value to watts per metre-kelvin (W/(m-K)).

fromWattsPerMetreKelvin function

Converts a thermal conductivity value from watts per metre-kelvin (W/(m-K)).

convertBetween function

Converts a thermal conductivity value between the two given units.

getName function

Retrieves the name of the given specific volume units.

Based on the given units, this method returns one of the following string values: 'Cubic Meters per Kilogram' or 'Cubic Feet per Pound'.

getAbbrev function

Retrieves the abbreviation of the given specific volume units.

Based on the given units, this method returns one of the following string values: 'W/(m-K)' or 'BTU/(h-ft-F)'.

getUnitsFromAbbrev function

Retrieves the specific volume units identifier from the given abbreviation.

Parses the abbreviations 'W/(m-K)' or 'BTU/(h-ft-F)' into the appropriate unit ID,

Author:
  • drajmarsh

CSG_OP <static>

The different types of constructive solid geometry to apply to shapes.

Properties:
Name Type Description
UNION number

Union together all child masses into a single bounded volume.

SUBTRACT number

Subtract the volume of each subsequent child mass from the first child mass.

INTERSECT number

Intersect the volumes of each child mass to find the common volume.

Author:
  • drajmarsh

CURSOR <static, readonly>

Enumerates the different cursor types.

Properties:
Name Type Default Description
POINT number 0

Unrestricted movement in all 3 dimensions. Has a UV manipulator at the centre of the cursor and arrows in each of the +/-U, +/-V and +/-W directions. The plane of movement varies between UV, VW and UW based on the 3D view angle.

PLANE number 1

Movement is restricted to an arbitrary 3D plane. Has a UV manipulator at the centre of the cursor and arrows in each of the +/-U and +/-V directions.

VECTOR number 2

Movement is restricted to an arbitrary 3D vector. Has arrows in only the +/-U directions.

RECT number 3

Used to edit the position, width and height of an arbitrarily oriented 3D rectangle. Movement is restricted to the plane of orientation of the rectangle. Has a UV manipulator at the centre of the cursor and arrows at the rectangle extents in the +/-U and +/-V directions to control width and height.

RECT_CORNERS number 4

Used to edit the position, width and height of an arbitrarily oriented 3D rectangle. Movement is restricted to the plane of orientation of the rectangle. Has a UV manipulator at the centre of the cursor and arrows at the rectangle extents in the +/-U and +/-V directions to control width and height.

BOX number 5

Used to edit the position, width, depth and height of an arbitrarily oriented 3D bounding box. Has a UV manipulator at the centre of the cursor and arrows at the bounding box extents in the +/-U, +/-V and+/- W directions to control width, depth and height. The position has unrestricted movement in all 3 dimensions and the plane of movement varies between UV, VW and UW based on the 3D view angle.

SECTION number 6

Typically used to manipulate section planes. Movement is restricted to the 3D vector normal to the section plane. Has a single manipulator offset from the centre of the cursor, shaped as an architectural section symbol.

CAPTURE_ALL number 100

Typically used to capture and react to input from the entire scene canvas.

Author:
  • drajmarsh

CURSOR_STYLE <static, readonly>

Enumerates the different cursor styles.

Properties:
Name Type Default Description
IMAGE number -1

Use a texture atlas to display cursor manipulators.

LIGHT number 0

A white background with red outlines.

GRAY number 1

A dark gray background with white outlines.

DARK number 2

A black background with light gray outlines.

ORANGE number 3

A bright orange background with deep orange outlines.

DARK_ORANGE number 4

A transparent deep orange background with bright orange outlines.

LIGHT_RED number 5

A transparent light background with red outlines.

DARK_RED number 6

A transparent dark background with red outlines.

RED number 7

A red background with white outlines.

getAsOptionList function

Retrieve cursor styles as a PD.ParamType options list.

Author:
  • drajmarsh

CURVE <static, readonly>

Enumerates the various types of available curve.

Properties:
Name Type Default Description
OFFSET number -1

Defines a curve that is offset from another curve.

Offset curves are typically created when an offset PD.Path is created from a BIM.Path.

NONE number 0

Defines a straight line with no curvature.

ARC number 1

A circular curve that goes through the first control point.

QUADRATIC number 2

A Quadratic Bezier curve that is governed by a single control point.

CUBIC number 3

A Cubic Bezier curve that is governed by two control points.

NURBS number 4

A NURBS curve that passes through the midpoint of a line joining each control point.

Author:
  • drajmarsh

DIMENSION <static, readonly>

Enumerates the different types of length dimension formats.

Properties:
Name Type Default Description
DEFAULT number 0

Show default units.

METRIC_MM number 1

Show dimensions in integer millimeters.

METRIC_SI number 2

Show dimensions in decimal meters.

IMPERIAL number 3

Show dimensions in feet, inches and sixteenths.

_units PD.DIMENSION 1

Stores the preferred format for displaying dimensions.

useImperial boolean false

Whether or not imperial dimensions are currently being used.

mmToMetres

Converts a distance in millimetres to metres.

mm2ToMetres2

Converts an area in square millimetres to square metres.

mm3ToMetres3

Converts a volume in cubic millimetres to cubic metres.

metersToFeet

Converts a distance in metres to decimal feet.

metersToInches

Converts a distance in metres to decimal inches.

metersToMillimeters

Converts a distance in metres to millimetres.

feetToMeters

Converts a distance in decimal feet to metres.

feetToMillimeters

Converts a distance in decimal feet to mm.

feetToInches

Converts a distance in decimal feet to decimal inches.

inchesToMeters

Converts a distance in decimal inches to metres.

inchesToMillimeters

Converts a distance in decimal inches to mm.

inchesToFeet

Converts a distance in decimal inches to decimal feet.

Author:
  • drajmarsh

DISPLAY <static, readonly>

Enumerates the types of model display mode.

Properties:
Name Type Default Description
FLOORPLAN number 0

Displays detailed geometry with wall thickness and openings.

SPATIAL number 1

Displays only the space volumes on the current level.

LEVEL number 2

Display the current level as a 3D model with walls and openings.

BUILDING number 3

Displays the whole building as a full 3D model.

_MAX number 3

The maximum allowed value.

toString function

Converts a display type value to a string identifier.

fromString function

Parses a string into a valid display type value.

Author:
  • drajmarsh

DRAG_ACTION <static>

Enumerates different types of pointer button drag actions.

Each action also has an alternate mode set by holding down the SHIFT and CTRL|ALT|META keys when first clicking the pointer button in the canvas. The alternate mode for rotating and zooming it is adjusting the field of view, and for panning it is zooming in/out.

Once you have set the action or alternate mode, pressing any of the modifier keys will also change its magnitude, with SHIFT resulting in a larger speed/magnitude and CTRL|ALT|META a smaller speed/magnitude.

Properties:
Name Type Description
NONE number

Pointer button drag does not affect the view.

ROTATE number

Rotates a 3D view, pans a 2D drawing (ALT: FieldOfViewAngle(3D)/pan).

ZOOM number

Zooms 2D and 3D views (ALT: FieldOfViewAngle(3D)).

PAN number

Pans 2D and 3D views (ALT: Zoom/FieldOfViewAngle(3D)).

Author:
  • drajmarsh

DRAWING_TYPE <static>

Enumerates the different types of architectural drawing.

For more information on the different types of architectural drawing, see: https://www.archtoolbox.com/construction-document-sheet-numbers/.

Properties:
Name Type Description
GENERAL number

Contains explanatory notes, symbols and legends.

PLAN number

Orthographic views taken from above and looking down, typically sectioned.

ELEVATION number

Orthographic views taken from the side looking horizontally.

SECTION number

Cut-away views where part(s) of the model are hidden, typically orthographic.

BLOW_UP number

Large scale drawings including plans, elevations and sections that are not details.

DETAIL number

CLose-up of a small section of the model, typically showing how component assembly.

SCHEDULE number

Detailed listings of materials, components or costs associated with the model.

USERDEFINED_1 number

Available for (re)definition bu by the user.

USERDEFINED_2 number

Available for (re)definition bu by the user.

DRAWING_3D number

Three dimensional perspective and/or orthographic drawings, renderings or photographs.

NOT_DEFINED number

The type is not defined so derive from view settings.

Author:
  • drajmarsh

EASING <static>

Enumerates the range of available easing methods.

You can access the easing methods directly via the PD.Easing static class, or use the PD.EASING.getEasingMethod method using a name or ordinal index.

See https://easings.net/ for a visual representation of these easing functions.

Properties:
Name Type Description
LINEAR number

No easing or acceleration.

IN_SINE number

Sine function accelerating from zero to one.

OUT_SINE number

Sine function decelerating from one to zero.

IN_OUT_SINE number

Sine function accelerating from zero to one halfway, then decelerating back to zero.

IN_OUT_SINE_POW number

Sine function accelerating until halfway, then decelerating with a power function (Math.pow) applied.

IN_QUAD number

Quadratic function (t^2) accelerating from zero to one.

OUT_QUAD number

Quadratic function (t^2) decelerating from one to zero.

IN_OUT_QUAD number

Quadratic function (t^2) accelerating until halfway, then decelerating.

IN_CUBIC number

Cubic function (t^3) accelerating from zero to one.

OUT_CUBIC number

Cubic function (t^3) decelerating from one to zero.

IN_OUT_CUBIC number

Cubic function (t^3) accelerating until halfway, then decelerating.

IN_QUART number

Quartic function (t^4) accelerating from zero to one.

OUT_QUART number

Quartic function (t^4) decelerating from one to zero.

IN_OUT_QUART number

Quartic function (t^4) accelerating until halfway, then decelerating.

IN_QUINT number

Quintic function (t^5) accelerating from zero to one.

OUT_QUINT number

Quintic function (t^5) decelerating from one to zero.

IN_OUT_QUINT number

Quintic function (t^5) accelerating until halfway, then decelerating.

IN_EXPO number

Exponential function (2^t) accelerating from zero to one.

OUT_EXPO number

Exponential function (2^t) decelerating from one to zero.

IN_OUT_EXPO number

Exponential function (2^t) accelerating until halfway, then decelerating.

IN_CIRC number

Circular function accelerating from zero to one.

OUT_CIRC number

Circular function decelerating from one to zero.

IN_OUT_CIRC number

Circular function accelerating until halfway, then decelerating.

IN_BACK number

Function with a bit of over-run at start.

OUT_BACK number

Function with a bit of over-run at end.

IN_OUT_BACK number

Function with a bit of over-run at start and end.

IN_BOUNCE number

Bounce function accelerating from zero to one.

OUT_BOUNCE number

Bounce function decelerating from one to zero.

IN_OUT_BOUNCE number

Bounce function accelerating until halfway, then decelerating.

IN_WOBBLE number

Function with a bit of an elastic jelly wobble at the start.

OUT_WOBBLE number

Function with a bit of an elastic jelly wobble at the end.

IN_OUT_WOBBLE number

Function with a bit of an elastic jelly wobble at the start and end.

OUT_ELASTIC number

Function with a bit of an elastic bounce at the end.

Author:
  • drajmarsh

ENDCAP <static, readonly>

Enumerates the various ways to terminate a thick line.

Properties:
Name Type Default Description
CLOSED number 0

Join the end of the line back up with the start.

FLAT number 1

Start/end the line flush with the start/end points.

SQUARE number 2

Project the start/end points out by half the width of the line.

TRIANGLE number 3

Add a 45 degree triangle to the end of the line.

ROUND number 4

Add a semi-circle at each end with the same diameter as the line width.

Author:
  • drajmarsh

ENTHALPY <static>

Provides tools to convert between enthalpy units.

The available enthalpy unit types are: PD.ENTHALPY.JOULES_PER_KILOGRAM, PD.ENTHALPY.KILO_JOULES_PER_KILOGRAM and PD.ENTHALPY.BTU_PER_POUND.

Properties:
Name Type Default Description
JOULES_PER_KILOGRAM number 0

The identifier for Joules per kilogram (J/kg).

KILO_JOULES_PER_KILOGRAM number 1

The identifier for kilo-Joules per kilogram (kJ/kg).

BTU_PER_POUND number 2

The identifier for British thermal units per pound (Btu/lb).

toJoulesPerKilogram

Converts an enthalpy value to joules per kilogram (J/kg).

fromJoulesPerKilogram

Converts an enthalpy value from joules per kilogram (J/kg).

convertBetween function

Converts an enthalpy value between the two given units.

getName function

Retrieves the name of the given enthalpy units.

Based on the given units, this method returns one of the following string values: 'Joules per Kilogram', 'kilo-Joules per Kilogram' or 'Btu per Pound'.

getAbbrev

Retrieves the abbreviation of the given enthalpy units.

Based on the given units, this method returns one of the following string values: 'J/kg', 'kJ/kg' or 'Btu/lb'.

getUnitsFromAbbrev

Retrieves the enthalpy units identifier from the given abbreviation.

Interprets the abbreviations 'J/kg', 'kJ/kg' or 'Btu/lb' into the identifiers PD.ENTHALPY.JOULES_PER_KILOGRAM | KILO_JOULES_PER_KILOGRAM | BTU_PER_POUND.


EVENT <static, readonly>

The different types of core events that can occur.

Events provide an arms-length way that the NLB Framework can communicate with custom classes and the user interface of its host application. It prevents framework data from being directly exposed to any bi-directional reactivity that the UI may use, whilst allowing the UI itself to pick and choose which events it will respond to.

It is important to note that this static class defines all of the core events used within the framework. Some of these will be global events that are broadcast by the static PD.GlobalEvents class, whilst some will be specific to a particular scene viewer or editor. The description of each event type should indicate whether it is a global event or not.

Properties:
Name Type Default Description
DARK_MODE string !pd-darkMode

A global event invoked when the applications colour theme changes.

This event is invoked whenever the user changes the app color theme between light and dark. This is typically done using the navigation bar dro-down menu, but it may also be called by a dynamic script.

The event handler is called with a single boolean argument, indicating whether or not the dark mode theme is now active.

DIMENSION_UNITS string !pd-dimUnits

A global event invoked when the preferred dimension units change.

This event occurs whenever the display units are changed between imperial and metric meters of millimeters. It is an opportunity for the UI to update any displayed values with the newly selected units.

The event handler is called with two arguments, the first being the newly selected numeric PD.DIMENSION.units value and the second being a boolean flag indicating that dimensions changed to/from imperial. This flag is useful as surface area and volume calculations don't change between SI and MM, but do when switching between either of those and imperial.

SITE_LOCATION string !pd-siteLoc

A global event invoked when the site location is changed.

This event is invoked whenever the site latitude, longitude, timezone or north angle values change. It is an opportunity for the UI to update any visible location data. This event is always followed by a SUN_POSITION event as the location change will invariable also affect the calculated sun position.

The event handler is called with a single PD.Location argument.

WEATHER_DATA string !pd-weatherData

A global event invoked when new weather data is loaded.

This event is invoked whenever the user loads new weather data. It is an opportunity for the UI to update any visible weather or station ID data. This event may also be followed by a SITE_LOCATION and SUN_POSITION event if the location changes as well.

The event handler is called with a single PD.WeatherData argument.

SUN_POSITION string !pd-sunPos

A global event invoked when the current solar position changes.

This event is invoked whenever any of the date, time or location values change. It is an opportunity for the UI (as well as custom shadow, analysis and element classes) to react to date, time and location changes.

The handler is called with a single PD.SolarPosition argument.

SUNPATH_PROJECTION string !pd-sunPathProj

A global event invoked when the PD.GlobalState.sunPathProjection value changes.

This event exists to allow the model to update any currently displayed Sun-path diagrams.

The event handler is called with a single argument, being the new PD.PROJECTION value to use.

SKY_DISTRIBUTION string !pd-skyDist

A global event invoked when the current sky luminance distributions changes.

This event is invoked whenever the date, time, location, sky type or sky condition values change. It is an opportunity for the UI (as well as custom element classes) to react to changes in the sky distribution.

The handler is called with a single PD.SkyDome argument.

DAYLIGHT_SCALE !pd-dayScale

A global event invoked when the current daylight scale changes.

This event is typically invoked when a daylight calculation has just completed.

TRANSFORM_ORIGIN string !pd-xformOrigin

A global event invoked when the framework or a script wants the host application to change the position the transform origin used by the rotate and scale functions.

This event exists to allow the UI to update its axial coordinate positions or other information dynamically as it is being interactively dragged.

The event handler is called with a single argument, being the PD.Point containing the new position that is currently being dragged by the cursor or set within a script.

SET_PARAMETER string !pd-setParam

Invoked when the framework needs the UI to update a parameter value for the currently selected element, junction, aperture, level or component.

This event allows the framework to support any UI framework and any method of generating editable parameter lists.

The event handler is called with three (3) arguments, being the selection type as a PD.SELECTED value, the name of the parameter as a string, and the new value to set.

CONTEXT_MENU_SHOW string !pd-contextShow

A global event invoked when the framework or a script wants the host application to show or move its context menu.

This event exists to enable users to both show the context menu and/or interactively drag it within the scene in order to prevent it obscuring some part of the model that they may be working on. The UI should respond by positioning and displaying the context menu or, if it is already displayed, repositioning it to the given page coordinates.

The event handler is called with two arguments, being numbers representing these new page coordinates, given in decimal pixels. Unless invoked from a script, these new coordinates will be those of the primary pointer's pageX and pageY properties as it is dragged within the web page.

CONTEXT_MENU_HIDE string !pd-contextHide

A global event invoked when the framework or a script wants the host application to hide the context menu if it is currently displayed.

The event handler is called with no arguments.

CANVAS_SIZE string !pd-canvasSize

Invoked when a scene viewer's drawing canvas changes size.

The event handler is called by the affected PD.SceneViewer with two numeric arguments, being the new horizontal width and vertical height of the canvas in pixels.

VIEW_SIZE string !pd-viewSize

Invoked when the model size changes in a scene viewer.

This event is an opportunity for the UI to react when the user zooms in or fits the view to a new model size. It is typically used to regenerate dynamically sized overlay widgets such as interactive cursors or dimension lines.

The event handler is called by the affected PD.SceneViewer with a single numeric argument, being the new model view size in model units.

VIEW_CHANGED string !pd-viewChanged

Invoked when the view parameters of a scene viewer changes.

This event is an opportunity for the UI to display dynamic view information such as camera angles, field of view, zoom level or camera/target position. It is invoked quite frequently during interactive view manipulations, so you may want to monitor POINTER_DOWN events to moderate your updates.

The event handler is called by the affected PD.SceneViewer with a single PD.ViewOrbital argument.

MODEL_CHANGED string !pd-modelChanged

Invoked whenever the model geometry is regenerated.

This event is an opportunity for the UI and simulation elements to react to changes in the 3D model.

The event handler is called by the affected PD.SceneViewer with a single PD.ModelManager argument.

WALKING_MODE string !pd-walkingMode

Invoked when the navigation mode in a scene viewer changes.

This event is an opportunity for the UI to update its state based on the scene's walk or orbit mode.

The event handler is called by the affected PD.SceneViewer with a single boolean argument, being true when entering walk mode and false when returning to orbit mode.

POINTER_DOWN string !pd-pointerDown

Invoked when a scene editor primary pointer is pressed or released.

This event is an opportunity for the UI to react to primary pointer down and primary pointer release events in the main model canvas, which occur for any mouse, pen and touch pointers. The typical UI response is to hide, show or modify whatever information overlays it has that sit on top of the main canvas, or to trigger the display of more detailed cursor information.

The event handler is called by the affected PD.SceneEditor with a single boolean argument, indicating whether or not to the primary pointer was pressed (true) or released (false).

CURSOR_MOVED string !pd-cursorMoved

Invoked when the displayed 3D cursor position in a scene editor changes.

This event is an opportunity for the UI to dynamically display or react to the changing coordinates of the cursor as it is being dynamically dragged within the model. This method is distinct from the JUNCTION_MOVED event as it is invoked for every action that involves movement of the cursor.

The event handler is called by the affected PD.SceneEditor with a single PD.Cursor argument.

CLIPBOARD string !pd-clipboard

A global event invoked when the contents of the clipboard changes.

The event handler is called with a single argument, being the PD.Clipboard that invoked the event.

CLIPBOARD_COPY string !pd-clip-copy

A global event invoked when the framework copies a non-text item to the clipboard.

This event is an opportunity for the UI to monitor copy requests and either manipulate the copied data or cancel the event.

The event handler is called with one argument, being an object with the following properties:

Property Type Description
type string The type identifier used by the PD.Clipboard.getLocalType method.
source object The object to be copied, typically a subclass of BIM.Entity.
json string The JSON formatted string generated from the object to be sent to the clipboard.
cancel boolean A flag that allows you to cancel the event by setting to true.

If your application does cancel the copy request by setting the cancel property to true , you should provide some reasonable feedback in the UI so the user knows what happened. You can use either the PD.GlobalActions.showGeneralWarning or PD.GlobalActions.showTransientStatusMessage methods to do this, as shown in the example below.

CLIPBOARD_PASTE string !pd-clip-paste

A global event invoked when the framework pastes an entity or other created object from the clipboard.

This event is an opportunity for the UI to monitor and potentially intercept paste events and either manipulate the pasted data or cancel the event entirely.

The event handler is called with one argument, being an object with the following properties:

Property Type Description
source object The object about to be pasted, typically a subclass of BIM.Entity.
cancel boolean A flag that allows you to cancel the event by setting to true.

If your application does cancel the paste request by setting the cancel property to true , you should provide some reasonable feedback in the UI so the user knows what happened. You can use either the PD.GlobalActions.showGeneralWarning or PD.GlobalActions.showTransientStatusMessage methods to do this, as shown in the example below.

SHOW_WARNING string !pd-showWarning

A global event invoked when the model needs to display transitory warning text.

This event occurs when the framework needs to display a warning message to the user. The UI should respond by displaying a transient warning message with the given text. When the state argument is false, it indicates that the issue has been resolved and the corresponding transient warning message should be removed or hidden.

The event handler is called with a single string argument, being the warning message text to be displayed.

SHOW_MESSAGE string !pd-showMessage

A global event invoked when the model needs to display transitory message text.

This event occurs when the framework needs to display some general information to the user. The UI should respond by displaying a transient info message with the given text.

The event handler is called with one, two or three arguments. The first argument is a string containing the message to be displayed. The second argument is the preferred duration to display the message for, which defaults to 5000ms (5 seconds).

The third argument is also optional and indicates whether the message should replace the primary general message or just be added to the general message list. If a process just needs to issue a one-off notification, then it should either not include this argument or set it to false. This is because there may be several other asynchronous processes that are providing similar notifications and the user needs to be able to see them all. However, if a process is likely to generate multiple messages that need to supersede each other, then it should include this argument and set it to true.

CONFIRM string !pd-showConfirm

A global event invoked when the model wants the UI to display a prompt modal dialog.

This event occurs when the framework needs a Yes/No or OK/Cancel answer from the user. The UI should respond by displaying a modal dialog box with the given title and message. If the user selected Yes or OK, the callback method should be called. If the user cancels, the callback is not called.

The event handler is called with three arguments, the first being the action string to display as the title of the prompt, the second being the message string to display in the body of the dialog box, and the third being a callback function to be called if the user selects Yes/OK.

COPY_ELEM_DLG string !pd-copyElemDlg

A global event invoked when the model wants the UI to display the copy element modal dialog.

This event occurs during copy/paste and clone actions.

The event handler is called with a single argument, being an enumeration where a zero (0) value means duplicate the current selection, one (1) means paste from the internal clipboard and two (2) means paste from the system clipboard.

CANCEL_ACTION string !pd-cancelAction

A global event invoked when the user clicks the Cancel button next to the progress bar or pressed ESC key when the PD.GlobalState.progressBarValue is greater than zero.

The event handler is called with no arguments.

APP_IS_BUSY string !pd-appIsBusy

A global event invoked when an operation needs to indicate an application-wide busy state.

The event handler is called with a single boolean argument for setting (true) or clearing (false) the busy state.

LEGEND_DATA_RANGE string !pd-legendUpdate

A global event invoked when a legend needs all its data elements to update its extents.

This event typically occurs just before and just after an area-based calculation. It is used to update the legend from the data range values of all visible elements sharing that legend.

The event handler is called with two arguments, being the legend that needs to be updated and a { min, max } range object.

LEGEND_CHANGED string !pd-legendChanged

A global event invoked when the display properties of a legend have changed.

The event handler is called with a single argument, being the legend whose display properties were changed by the user.

SIDE_PANEL_PIN string !pd-sidePanelPin

A global event invoked when the side panel is pinned or unpinned.

The event handler is called with a single boolean argument, indicating whether the side panel is now pinned (true) or unpinned (false).

Author:
  • drajmarsh

FACET <static, readonly>

Enumerates the various roles that a polygon or facet plays within a shell.

The facetType property of PD.Polygon and PD.BRep.Face objects allows the framework to assign and identify the role different facets play within a shell or surface. For example, when searching for adjacent faces between spaces, this makes it possible to quickly ignore mitred and/or filleted faces at corners and edges as well as those inserted as the surrounds of apertures. It also allows applications to more quickly search for, update and/or replace only facets of a particular type.

Properties:
Name Type Default Description
HIDDEN number -1

Indicates that the facet should not be rendered by the element.

This is used to hide shell surfaces that have been visually replaced with an alternate, textured or other surface.

SURFACE number 0

A standard exposed surface of a shell.

EDGE number 1

Tags a facet as part of a chamfered, mitred or filleted edge.

JAMB number 2

Tags a facet as an extruded side, head or sill of an aperture within another facet.

FRAME number 3

Tags a facet as a window or door frame element.

GLASS number 4

Tags a facet as a window pane or glazing surface.

TOP number 5

Tags a facet as the top of an extrusion.

BOTTOM number 6

Tags a facet as the bottom of an extrusion.

BUMPY number 85

Indicates that a facet has been replaced with a rough and irregular surface texture, typically stone.

FOLIAGE number 90

Tags a facet as part of the leaf area of a plant or canopy area of a tree.

TRUNK number 91

Tags a facet as art of the stem of a plant or the trunk of a tree.

CLIP_EDGE number 100

Tags a vertical facet a generated when clipped to the level boundary.

These facets are created from the clipped edges of terrain and roof surfaces, and are tagged for inclusion in the spatial adjacency calculations.

CUT_FILL_AREA number 101

Tags a horizontal facet used for cut/fill volume determination in terrains.

These facets are created when the angle of repose is applied to internal ground and mass elements, and the level boundary.

Author:
  • drajmarsh

FACET_FLAGS <static, readonly>

Enumerates the various flags used by the PD.BRep.Face class.

NOTE: These are bitwise flags used to pack multiple booleans into a single value.

Properties:
Name Type Default Description
CHANGED number 1

Whether or not any contours have changed since last updated.

NOTE: This flag is not yet used but is reserved for future use.

IS_CURVED number 2

Whether or not the surface is curved with triangles already generated.

NO_OUTLINE number 4

Whether or not the facet should not display its outline(s) when meshed.

This flag may be used

Author:
  • drajmarsh

FILTER <static, readonly>

Enumerates which model features will be checked for interactive selection.

These are bitwise flags that can be combined for filtering interactive selection.

Properties:
Name Type Default Description
NONE number 0

A unique characterisation of an empty selection index.

These are also bit-wise flags that can be used to store multiple options in a single number property.

POINT number 1

Check to select the closest point on a path.

PATH number 2

Check to select the closest linear or curved segment.

FACE number 4

Check to select the closest intersected face.

SHELL number 8

Check to select the closest whole shell.

ALL number 15

Check to select everything.

checkPoints function

Determines whether the filter contain the POINT bit flag.

checkPaths function

Determines whether the filter contain the PATH bit flag.

checkFaces function

Determines whether the filter contain the FACE bit flag.

checkShells function

Determines whether the filter contain the SHELL bit flag.

Author:
  • drajmarsh

FIT <static, readonly>

Enumerates the different object/view fit levels.

This is primarily used by view managers to fit the camera to their contents.

Properties:
Name Type Default Description
CHECK number 0

Indicates a normal check for changed extents.

EXTENTS number 1

Indicates a deeper and more detailed check for changed extents.

VIEW number 2

Indicates a full check and fitting the view to visible objects.

Author:
  • drajmarsh

FORMAT <static, readonly>

Enumerates a range of numeric display formats.

You can use this object to display and parse values in the given format using its static methods.

Properties:
Name Type Default Description
NONE number -1

Value has no format.

DECIMAL number 0

Formatted as a decimal number, such as 25.64.

INTEGER number 1

Formatted as a integer number, such as 465.

ORDINAL number 2

Formatted as an ordinal with suffix, such as 1st, 2nd, 25th, etc.

PERCENTAGE number 3

Formatted as percentage where 0 to 1 equals 0% to 100%.

ANGLE number 4

Formatted as an angle in degrees.

RAD2DEG number 5

Converted and formatted from radians to an angle in degrees.

LENGTH number 6

Formatted as a dimension in the current units, such as 1250, 1.25, 4' 1" 3/16, etc.

LENGTH differs from DISTANCE and DIMENSION in that no units are appended to the displayed value.

DISTANCE number 7

Formatted as a distance in the current units, such as 1250mm, 1.25m, 4' 1" 3/16, etc.

DISTANCE differs from LENGTH in that it appends the current units abbreviation to the output. DISTANCE differs from DIMENSION in that it is always interpreted as an absolute value.

DIMENSION number 8

A special type of distance that parses and formats fractional values differently to absolute units.

DIMENSION differs from DISTANCE in that values between 0 and 1 are treated as fractional values relative to a reference length. For example, a ceiling height can be defined as 2400mm, or as 0.85 times the space height. DIMENSION differs from LENGTH in that it appends the current units abbreviation to the output.

METRES number 9

A special type of distance that is stored in metres rather than millimetres.

AREA number 10

Formats an area in square metres or square feet.

VOLUME number 11

Formats an area in cubic metres or cubic feet.

DURATION number 12

Formatted as a duration, such as 01:50 or -06:42.

TIME_ZONE number 13

Formatted as a time zone relative to UTC, such as +8:00 or -9:30.

TIME number 14

Formatted as a time of day in the range 0 to 24, such as 08:50 or 22:30`.

DATE number 15

Formatted as a day of the year in range 0 to 365/6, such as 01 Jan or 25 Jun.

BOOLEAN number 16

Formatted as a true/false value.

COLOR number 17

Formatted as a CSS colour string in the form '#RRGGBB'.

HEAT_FLUX_DENSITY number 18

Formatted as a value in either W/m2 or BTU/hr/ft2.

MILLISECONDS number 19

Formatted as a time value in milliseconds.

CONDUCTIVITY number 20

Formatted as a value in either W/(m-K) or BTU/(h-ft-F).

DENSITY number 21

Formatted as a value in either kg/m3 or lb/ft3.

SPECIFIC_HEAT number 22

Formatted as a value in either J/(kg-K) or BTU/(lb-F).

SIDES number 23

Formatted as a number of polygon sides, where <3 is 'Any'.

_MAX number 24

Defines the maximum allowable format number.

toString function

Format the given value as a string.

fromString function

Parses a string to a value in the given format, or a format type.

asDecimal function

Format the given value as an decimal number string.

asInteger function

Format the given value as an integer string.

asOrdinal function

Format the given value as an ordinal string, such as 1st, 2nd, 3rd, etc.

asPercentage function

Format the given value as a percentage string.

asAngle function

Format the given value in degrees as an angle string.

asRadiansToDegrees function

Format the given value in radians as an angle string in degrees.

asDimension function

Format the given value as a dimension string without units.

asDistance function

Format the given value as a distance string with units.

asMetres function

Format the given value as a distance string in either metres or feet.

asDuration function

Format the given value as a time duration string.

asTimeZone function

Format the given value as a time-zone offset string.

asTime function

Format the given value as a 24Hr time string.

asDate function

Format the given value as a date string.

asBoolean function

Format the given value as a boolean string.

asColor function

Format the given value as a CSS color string in the form '#RRGGBB'.

asHeatFluxDensity function

Format the given heat flux density value in W/m2 or Btu/hr/ft2.

asMilliseconds function

Format the given value in milliseconds with a 'ms' suffix.

asThermalConductivity function

Format the given thermal conductivity value as W/(m-K) or BTU/(h-ft-F).

asDensity function

Format the given density value as kg/m3 or lb/ft3.

asSpecificHeat function

Format the given specific heat value as J/(kg-K) or BTU/(lb-F).

Author:
  • drajmarsh
Example
PD.FORMAT.toString(PD.FORMAT.TIME, 15.75); // Result: '15:45'
const time_of_day = PD.FORMAT.parseString(PD.FORMAT.DATE, '15:45'); // Result: 15.75
PD.FORMAT.toString(PD.FORMAT.DATE, 91); // Result: '01Apr'
const day_of_year = PD.FORMAT.parseString(PD.FORMAT.DATE, '01Apr'); // Result: 91

const type_str = PD.FORMAT.toString(PD.FORMAT.PERCENTAGE); // Result: 'PERCENTAGE'
const type PD.FORMAT.fromString(type_str); // Result: 3 (PD.FORMAT.PERCENTAGE)

:boolean

FORWARD <static>

An alias for false to make some polygon/polyline method calls more readable.

Type
  • boolean

GRID <static, readonly>

Enumerates the types of grid distribution.

Properties:
Name Type Default Description
REGULAR number 0

Distributes grid points orthogonally over an area.

HEXAGON number 1

Distributes grid points using a hexagonal grid.

Author:
  • drajmarsh

:object

GlobalStateProxy <static>

This is a proxy to the application state properties in PD.GlobalState. By default this is a direct reference to PD.GlobalState, however front-end frameworks can reassign this to create a reactive/observable version.

Type
  • object

:object

GlobalViewProxy <static>

This is a proxy to the application view properties in PD.GlobalView. By default this is a direct reference to PD.GlobalView, however front-end frameworks can reassign this to create a reactive/observable version.

Type
  • object

HUMIDITY_RATIO <static, readonly>

Provides tools to convert between different humidity ratio units.

Properties:
Name Type Default Description
KILOGRAMS_PER_KILOGRAM number 120

The identifier for kilograms of water per kilogram of dry air (kg/kg).

GRAMS_PER_KILOGRAM number 121

The identifier for grams of water per kilogram of dry air (g/kg).

POUNDS_PER_POUND number 122

The identifier for pounds of water per pound of dry air (lb/lb).

GRAINS_PER_POUND number 123

The identifier for grains of water per pound of dry air (gr/lb).

toKilogramsPerKilogram function

Converts a humidity ratio value from the given units to Celsius.

fromKilogramsPerKilogram function

Converts a humidity ratio value in kilograms per kilogram to the given units.

convertBetween function

Converts a humidity ratio value between the two given units.

getName function

Retrieves the name of the given humidity ratio units.

Based on the given units, this method returns one of the following string values: 'Kilograms per Kilogram', 'Grams per Kilogram', 'Pounds per Pound' or 'Grains per Pound'.

getAbbrev function

Retrieves the abbreviation of the given humidity ratio units.

Based on the given units, this method returns one of the following string values: 'kg/kg', 'g/kg', 'lb/lb' or 'gr/lb';

getUnitsFromAbbrev function

Retrieves the humidity ratio units identifier from the given abbreviation.

Parses the abbreviations 'kg/kg', 'g/kg', 'lb/lb' or 'gr/lb' into the appropriate unit ID,

Author:
  • drajmarsh

JOIN <static, readonly>

Enumerates the different types of joints between path segments.

Properties:
Name Type Default Description
INLINE number -1

Defines a colinear join that does not change direction.

This line type does not need or use any control data.

LINEAR number 0

Join to next point with a straight lines.

This line type does not need or use any control data.

CHAMFER number 1

Joins incoming and outgoing lines with a straight chamfer.

The size of the chamfer is controlled by either the join size or offset attribute value. If set, the size value will override an offset value when calculating the chamfer. When updated, these joins will add an inConnect point property to the attrib object storing the start position of the chamfer and an outConnect point property for its end.

Always use the getInPos() and getOutPos() methods to obtain the connection points of a joint, which will automatically use inConnect and outConnectwhenever appropriate.

FILLET number 2

Join incoming and outgoing lines with a circular fillet.

The radius of the fillet is governed by the radius attribute value. When updated, these joins will add 'radius and center point properties to the attrib object, as well as inConnect to indicate the start of the fillet and outConnect for the end.

Always use the getInPos() and getOutPos() methods to obtain the connection points of a joint, which will automatically use inConnect and outConnectwhenever appropriate.

ARC number 3

Join the previous and next points with an arc that passes through this point.

The center and radius of the arc are calculated automatically to pass through this point as well as the in and out connections of the previous and next. When updated, these joins will add 'radius and center point properties to the attrib object, as well as inConnect to indicate the start of the fillet and outConnect for the end.

Always use the getInPos() and getOutPos() methods to obtain the connection points of a joint, which will automatically use inConnect and outConnectwhenever appropriate.

BEZIER number 4

Join the previous and next points with a Bezier curve that passes through this point.

The nature of the resulting curve is governed by the presence or absence of incoming and outgoing control points, as well as the isSmooth and/or isSymmetrical properties of each involved joint.

BSPLINE number 5

Sets this join as a B-Spline curve control point.

_MAX number 5

The maximum allowed value.

toString function

Converts a join type value to a string identifier.

fromString function

Parses a string into a valid join type value.

Author:
  • drajmarsh

KEY <static, readonly>

Enumerates the keyboard keys that control increment/decrement values.

Properties:
Name Type Default Description
NONE number 0

Applies a minor increment to the value, typically 5 * step.

SHIFT number 16

Applies a major increment to the value, typically 50 * step.

CONTROL number 17

Applies the smallest step increment to the value.

Author:
  • drajmarsh

MANIPULATOR <static, readonly>

Enumerates the different cursor manipulator types.

Properties:
Name Type Default Description
BOX number 0

A simple box manipulator.

       +----------+
      /          /|
     +----------+ |
     |          | |
     |          | +
     |          |/
     +----------+
MARKER number 1

A simple diamond marker manipulator.

            _+_
          _/  \\_
        _/     \ \_
      _/        \  \_
     +-----------+---+
      \_        /  _/
        \_     / _/
          \_  /_/
            '+'
SQUARE number 2

A square drag indicator located at the center of the cursor.

      + - - - - - - - - - - - - - +
      :                           :
      :                           :
      :                           :
      :             |             :
      :          ---x---          :
      :             |             :
      :                           :
      :                           :
      :                           :
      + - - - - - - - - - - - - - +
ARROW number 3

A directional arrow drag indicator offset by a vector from the cursor.

               6
               : =
               :    =
       3- - - -2       =
       :      /:          =
       :     / :             =
       :    /  :    |           =
       :   /   ; ---X---           5
       :  /    :    |           =
       : /     :             =
       :/      :          =
       0- - - -1       =
               :    =
               : =
               4
TOUCH number 4

An simple circle drag indicator offset from the cursor for touch-based manipulation.

              , - ~ ' ~ - ,
          , '               ' ,
        ,                       ,
       ,                         ,
      ,             |             ,
      ,          ---x---          ,
      ,             |             ,
       ,                         ,
        ,                       ,
          ,                  , '
            ' - , _ _ _ ,  '
SPIKED number 5

A spiked circle center drag indicator located at the center of a rect/box cursor.

                    +
                   / \
              , - '   ' - ,
          , '               ' ,
        ,         _ = _         ,
       ,      _ '       ' _      ,
   __-'      .      |      .      '-__
 * __       =    ---x---    =       __ *
     ',      '_     |     _'      ,'
       ,       . _     _ .       ,
        ,          '='          ,
          ,                  , '
            ' - , _   _ , - '
                   \ /
                    +
SECTION number 6

An arrow-on-a-circle drag indicator for manipulating section planes/lines, located at the center of the cursor.

                    +
                    : =
                    :    =
              , - ~ : ~ - , =
          , '       :       ' ,
        ,           :           ,=
       ,            :            , =
      ,             |             ,  =
      ,          ---x---          ,     +
      ,             |             ,  =
       ,            :            , =
        ,           :           ,=
          ,         :        , '
            ' - , _ : _ ,  '=
                    :    =
                    : =
                    +
ROTATOR number 7

A large circular rotation indicator oriented on an axis and located at the center of the cursor.

Author:
  • drajmarsh

MODE <static, readonly>

Enumerates the types of interactive user edit modes.

Properties:
Name Type Default Description
NONE number 0

Completely disable interaction.

EDIT number 1

Click-select and edit elements on the model.

ADD number 2

Add path points and junctions to a new element.

MEASURE number 3

Allow user to position and drag a dimension line.

RECT number 4

Allow user to position and drag the background image or a ground grid.

MOVE number 5

Translate the current selection set.

ROTATE number 6

Rotate the current selection set.

SCALE number 7

Scale the current selection set.

ORIGIN number 8

Set the position of an arbitrary point within the model.

SHELL number 9

Select and edit PD.Shell geometry.

DRAG_DROP number 10

Interactively drag elements and components over the top of other elements and components.

WORK_PLANE number 11

Interactively position and orient a temporary working plane.

CAPTURE number 100

Captures all user interaction in the model canvas.

Author:
  • drajmarsh

MOUSE_BTN <static>

Enumerates the different types of mouse/pointer button.

Properties:
Name Type Description
NONE number

No mouse/pointer button pressed.

LEFT number

The left/primary mouse/pointer button pressed.

MIDDLE number

The middle/secondary mouse/pointer button pressed.

RIGHT number

The right/tertiary mouse/pointer button pressed.

Author:
  • drajmarsh

:boolean

OPEN <static>

An alias for false to make some polygon/polyline method calls more readable.

Type
  • boolean

PATH <static, readonly>

Enumerates the different default shapes for interactive path generation.

Properties:
Name Type Default Description
POLYGONAL number 0

The path is generated by linking each point with linear segments.

RECTANGULAR number 1

The path is generated by creating a rectangle between two points.

CIRCULAR number 2

The path is generated by creating a circle between two points.

Author:
  • drajmarsh

POINT_FLAGS <static, readonly>

Enumerates the various flags used by points and curves within a path.

NOTE: These are bitwise flags used to pack multiple booleans into a single value.

As a building model is very likely to contain many thousands of path points being able to store multiple boolean settings in a single integer is at least a small saving. It also helps a little when undoing, redoing and copying.

Properties:
Name Type Default Description
CHANGED number 1

Whether the junction's properties have changed since last update.

CONCAVE number 2

Whether the cross-product is inverted compared to others in the path.

VIRTUAL number 4

Whether the junction was added dynamically rather than manually by the user.

VARIABLE_WIDTH number 8

Whether material changes are gradual or sudden (step).

COLINEAR number 16

Whether or not the junction is colinear with its previous and next path points.

EXTERNAL number 32

Whether or not the junction's segment is adjacent to the outside.

SMOOTH number 128

Whether or not the junction's curve maintains a smooth change in direction.

When set to true, any curve will smoothly transition the path direction using control points that can only move along the tangent between incoming and outgoing vectors. When false, control points can move unrestricted.

SYMMETRIC number 256

Whether or not the magnitude of smooth control points are reflected equally.

FILLET number 512

Whether or not to truncate acute angles using a fillet instead of a mitre.

END_PLANE number 1024

Whether or not the junction starts/end at a specific plane when part of an open path.

When set to true, any path generation will check the in/out vector and use it to generate an end plane to intersect offset profiles with.

Author:
  • drajmarsh

POLY_FLAGS <static, readonly>

Enumerates the various flags used in polylines, polyloops and polygons, as well as their path subclasses.

NOTE: These are bitwise flags used to pack multiple booleans into a single value.

As a building model is very likely to contain thousands of paths, lines and loops, being able to store multiple boolean settings in a single integer is at least a small saving. It also helps a little when undoing and copying.

Properties:
Name Type Default Description
CHANGED number 1

Whether or not any contours have changed since last updated.

CLOSED number 2

Whether or not each contour line loops back to its starting vertex.

POLYGON number 4

Whether or not the contours form a single closed polygon with holes.

RECT number 8

Whether or not the polygon is rectilinear.

PLANAR number 16

Whether or not all vertices lie in the same plane.

CURVED number 32

Whether or not the surface is curved with triangles already generated.

CHANGING number 64

Whether or not the polygon is currently being dynamically edited.

OUTLINE number 128

Whether or not the polygon should include any outline(s) when meshed.

SURFACE number 256

Whether or not the polygon should include any surface(s) when meshed.

VERTICAL number 512

Whether or not to keep the plane normal and up-vector always vertical.

CONCAVE number 1024

Whether or not any part of the polyline is concave.

ATTRIB number 2048

Whether or not the polyline needs its attributes updated.

HAS_CURVES number 4096

Whether or not a path has one or more curved segments.

Author:
  • drajmarsh

PREFIX <static, readonly>

Enumerates the various units prefixes.

Units prefixes are applied to very large or very small values to make them more human-readable. Examples of prefixes are MegaWatts (MW: 1,000,000 Watts), Kilometres (km: 1000 metres), millimetre (mm: 1e-3 metres) and PicoOhm (po: 1e-12 Ohm). This utility class provided an enumeration and some static methods for handling such prefixes.

Properties:
Name Type Default Description
PETA number 7

The identifier for 1e15.

TERA number 6

The identifier for 1e12.

GIGA number 5

The identifier for 1e9.

MEGA number 4

The identifier for 1e6.

KILO number 3

The identifier for 1e3.

HECTO number 2

The identifier for 100.

DECA number 1

The identifier for 10.

NONE number 0

The identifier for no prefix.

DECI number -1

The identifier for 0.1.

CENTI number -2

The identifier for 0.01.

MILLI number -3

The identifier for 1e-3.

MICRO number -4

The identifier for 1e-6.

NANO number -5

The identifier for 1e-9.

PICO number -6

The identifier for 1e-12.

FEMTO number -7

The identifier for 1e-15.

getScaleFactor function

Returns the scale factor for units with the given prefix.

const scale = PD.PREFIX.getScaleFactor(PD.PREFIX.NANO);

The prefix argument is an integer value, as follows:

No. Prefix Name Factor
7 Peta (P) PD.PREFIX.PETA 1e-15
6 Tera (T) PD.PREFIX.TERA 1e-12
5 Giga (G) PD.PREFIX.GIGA 1e-9
4 Mega (M) PD.PREFIX.MEGA 1e-6
3 Kilo (k) PD.PREFIX.KILO 1e-3
2 Hecto (h) PD.PREFIX.HECTO 1e-2
1 Deca (da) PD.PREFIX.DECA 1e-1
0 None PD.PREFIX.NONE 1.0
-1 Deci (d) PD.PREFIX.DECI 1e1
-2 Centi (c) PD.PREFIX.CENTI 1e2
-3 Milli (m) PD.PREFIX.MILLI 1e3
-4 Micro (μ) PD.PREFIX.MICRO 1e6
-5 Nano (n) PD.PREFIX.NANO 1e9
-6 Pico (p) PD.PREFIX.PICO 1e12
-7 Femto (f) PD.PREFIX.FEMTO 1e15
toString function

Returns the prefix string for units with the given prefix.

const units = 'W/h';
const value = 2322319362.6;
const prefix = PD.PREFIX.GIGA;
const scale = PD.PREFIX.getScaleFactor(prefix);
console.log((scale * value).toFixed(3) + ' ' + PD.PREFIX.toString(prefix) + units);
>> "2.322 GW/h"

The prefix argument is an integer value, as follows:

No. Prefix Name Factor
7 Peta (P) PD.PREFIX.PETA 1e-15
6 Tera (T) PD.PREFIX.TERA 1e-12
5 Giga (G) PD.PREFIX.GIGA 1e-9
4 Mega (M) PD.PREFIX.MEGA 1e-6
3 Kilo (k) PD.PREFIX.KILO 1e-3
2 Hecto (h) PD.PREFIX.HECTO 1e-2
1 Deca (da) PD.PREFIX.DECA 1e-1
0 None PD.PREFIX.NONE 1.0
-1 Deci (d) PD.PREFIX.DECI 1e1
-2 Centi (c) PD.PREFIX.CENTI 1e2
-3 Milli (m) PD.PREFIX.MILLI 1e3
-4 Micro (μ) PD.PREFIX.MICRO 1e6
-5 Nano (n) PD.PREFIX.NANO 1e9
-6 Pico (p) PD.PREFIX.PICO 1e12
-7 Femto (f) PD.PREFIX.FEMTO 1e15
Author:
  • drajmarsh

PREFIX <static, readonly>

Enumerates the various units prefixes.

Units prefixes are applied to very large or very small values to make them more human-readable. Examples of prefixes are MegaWatts (MW: 1,000,000 Watts), Kilometres (km: 1000 metres), millimetre (mm: 1e-3 metres) and PicoOhm (po: 1e-12 Ohm). This utility class provided an enumeration and some static methods for handling such prefixes.

Properties:
Name Type Default Description
PETA number 7

The identifier for 1e15.

TERA number 6

The identifier for 1e12.

GIGA number 5

The identifier for 1e9.

MEGA number 4

The identifier for 1e6.

KILO number 3

The identifier for 1e3.

HECTO number 2

The identifier for 100.

DECA number 1

The identifier for 10.

NONE number 0

The identifier for no prefix.

DECI number -1

The identifier for 0.1.

CENTI number -2

The identifier for 0.01.

MILLI number -3

The identifier for 1e-3.

MICRO number -4

The identifier for 1e-6.

NANO number -5

The identifier for 1e-9.

PICO number -6

The identifier for 1e-12.

FEMTO number -7

The identifier for 1e-15.

getScaleFactor function

Returns the scale factor for units with the given prefix.

const scale = PD.PREFIX.getScaleFactor(PD.PREFIX.NANO);

The prefix argument is an integer value, as follows:

No. Prefix Name Factor
7 Peta (P) PD.PREFIX.PETA 1e-15
6 Tera (T) PD.PREFIX.TERA 1e-12
5 Giga (G) PD.PREFIX.GIGA 1e-9
4 Mega (M) PD.PREFIX.MEGA 1e-6
3 Kilo (k) PD.PREFIX.KILO 1e-3
2 Hecto (h) PD.PREFIX.HECTO 1e-2
1 Deca (da) PD.PREFIX.DECA 1e-1
0 None PD.PREFIX.NONE 1.0
-1 Deci (d) PD.PREFIX.DECI 1e1
-2 Centi (c) PD.PREFIX.CENTI 1e2
-3 Milli (m) PD.PREFIX.MILLI 1e3
-4 Micro (μ) PD.PREFIX.MICRO 1e6
-5 Nano (n) PD.PREFIX.NANO 1e9
-6 Pico (p) PD.PREFIX.PICO 1e12
-7 Femto (f) PD.PREFIX.FEMTO 1e15
toString function

Returns the prefix string for units with the given prefix.

const units = 'W/h';
const value = 2322319362.6;
const prefix = PD.PREFIX.GIGA;
const scale = PD.PREFIX.getScaleFactor(prefix);
console.log((scale * value).toFixed(3) + ' ' + PD.PREFIX.toString(prefix) + units);
>> "2.322 GW/h"

The prefix argument is an integer value, as follows:

No. Prefix Name Factor
7 Peta (P) PD.PREFIX.PETA 1e-15
6 Tera (T) PD.PREFIX.TERA 1e-12
5 Giga (G) PD.PREFIX.GIGA 1e-9
4 Mega (M) PD.PREFIX.MEGA 1e-6
3 Kilo (k) PD.PREFIX.KILO 1e-3
2 Hecto (h) PD.PREFIX.HECTO 1e-2
1 Deca (da) PD.PREFIX.DECA 1e-1
0 None PD.PREFIX.NONE 1.0
-1 Deci (d) PD.PREFIX.DECI 1e1
-2 Centi (c) PD.PREFIX.CENTI 1e2
-3 Milli (m) PD.PREFIX.MILLI 1e3
-4 Micro (μ) PD.PREFIX.MICRO 1e6
-5 Nano (n) PD.PREFIX.NANO 1e9
-6 Pico (p) PD.PREFIX.PICO 1e12
-7 Femto (f) PD.PREFIX.FEMTO 1e15
Author:
  • drajmarsh

PRESSURE <static, readonly>

Provides tools to convert between different pressure units.

Properties:
Name Type Default Description
PASCAL number 130

The identifier for Pascal (Pa).

KILOPASCAL number 131

The identifier for kilo-Pascal (Pa).

MILLIMETERS_MERCURY number 132

The identifier for millimeters of mercury (mmHg).

INCHES_MERCURY number 133

The identifier for inches of mercury (inHg).

POUNDS_PER_SQUARE_INCH number 134

The identifier for pounds per square inch (Psi).

ATMOSPHERES number 135

The identifier for Atmospheres (atm).

BAR number 136

The identifier for barometric pressure (bar).

toPascal function

Converts a pressure value from the given units to Pascal (Pa).

fromPascal function

Converts a temperature value in Pascal to the given units.

convertBetween function

Converts a pressure value between the two given units.

getName function

Retrieves the name of the given humidity ratio units.

Based on the given units, this method returns one of the following string values: 'Pascal', 'kilo-Pascal', 'Millimeters Mercury', 'Inches Mercury', 'Pounds Force Per Square Inch', 'Atmospheres' or 'Bar'.

getAbbrev function

Retrieves the abbreviation of the given humidity ratio units.

Based on the given units, this method returns one of the following string values: 'Pa', 'kPa', 'mmHg', 'inHg', 'Psi', 'atm', 'bar'.

getUnitsFromAbbrev function

Retrieves the pressure units identifier from the given abbreviation.

Parses the abbreviations 'Pa', 'kPa', 'mmHg', 'inHg', 'Psi', 'atm', 'bar' into the appropriate unit ID,

Author:
  • drajmarsh

PRIMITIVE <static, readonly>

Enumerates different types of WebGL primitives.

These are used by some mesh builder functions to help create complex geometry by simulating immediate mode that used to be available in legacy OpenGL. The PD.PolyMesh and PD.MeshBuilder classes provide an API that uses these primitive types to interpret vertex data in different ways.

See the PD.PolyMesh begin() method for more details on how to use these values and their vertex ordering requirements.

Properties:
Name Type Default Description
POINTS number 0

Treats each vertex as an independent point in space.

    0               1
    +               +

    +
    3
                +
                2
LINES number 1

Treats each pair of vertices as an independent line segment.

    0               1
    +---------------+

    +__
    3  ''--__
             ''-+
                2
LINE_LOOP number 2

Draws a connected group of line segments from the first vertex to the last, then back to the first.

    0               1
    +---------------+
    |              /
    +__           /
    3  ''--__    /
             ''-+
                2
LINE_STRIP number 3

Draws a connected group of line segments from the first vertex to the last.

    0               1
    +---------------+
                   /
    +__           /
    3  ''--__    /
             ''-+
                2
TRIANGLES number 4

Treats each triplet of vertices as an independent triangle.

    1     3     5
    +     +--<--+         A: 0,1,2
    |\_    \_ B |         B: 3,4,5
    |  \_    \_ |
    | A  \     \|
    +--<--+     +
    0     2     4
TRIANGLE_STRIP number 5

Creates a new triangle from each incremental triplet. When ordering vertices, all the odd vertices run along one edge and even vertices the other.

    1     3     5     7
    +-->--+-->--+---  +   A: 0,1,2
    |\_ B |\_ D |\_       B: 2,1,3
    |  \_ |  \_ |  \      C: 2,3,4
    | A  \| C  \|         D: 4,3,5
    +--<--+--<--+---  +
    0     2     4     6
TRIANGLE_FAN number 6

Creates triangles that fan out from a central point. A new triangle is created linking each each incremental pair to the very first vertex.

    2     3     4
    +-->--+-->--+         A: 0,1,2
    |\_ B | C _/|         B: 0,2,3
    |  \_ | _/  |         C: 0,3,4
    | A  \|/  D |         D: 0,4,5
    +--<--+--<--+
    1     0     5
QUADS number 7

Converts each quadruplet into two connected triangles. Each group of four vertices must run counter clockwise around the perimeter of the quad.

    1     2     5     6
    +-->--+     +-->--+   A: 0,1,2
    | A _/|     | C _/|   B: 2,3,0
    | _/  |     | _/  |   C: 4,5,6
    |/  B |     |/  D |   D: 6,7,4
    +--<--+     +--<--+
    0     3     4     7
QUAD_STRIP number 8

Converts a strip of connected quads into a triangle strip. Vertex ordering is the same as a triangle strip, where odd vertices run along one edge and even vertices the other.

    1     3     5     7
    +-->--+-->--+---  +   A: 0,1,2
    |\_ B |\_ D |\_       B: 2,1,3
    |  \_ |  \_ |  \      C: 2,3,4
    | A  \| C  \|         D: 4,3,5
    +--<--+--<--+---  +
    0     2     4     6
Author:
  • drajmarsh

PROJECTION <static, readonly>

Enumerates different types of 2D sun-path diagram projections.

These refer to some standard equations for converting 3D altitude angles to radius values within a 2D polar chart. The different methods allow the detail at the zenith or the horizon to be emphasised, or all altitudes equally.

Properties:
Name Type Default Description
SPHERICAL number 0

The enumeration for a spherical polar projection.

This projection corresponds to the 'Orthographic' projection described at https://en.wikipedia.org/wiki/Stereographic_projection.

EQUIDISTANT number 1

The enumeration for an equidistant polar projection.

This projection simply divides the polar diagram radius into divisions of equal altitude.

STEREOGRAPHIC number 2

The enumeration for a stereographic polar projection.

This projection corresponds to the 'Stereographic' projection described at https://en.wikipedia.org/wiki/Stereographic_projection.

Author:
  • drajmarsh

RECT_MODE <static, readonly>

Enumerates the types of interactive rectangle edit modes.

Properties:
Name Type Default Description
IMAGE number 0

Edits the extents of the background image.

GRID number 1

Edits the extents of the background grid.

SURFACE number 2

Edits the extents of a selected rectangular surface.

Author:
  • drajmarsh

:boolean

REVERSE <static>

An alias for true to make some polygon/polyline method calls more readable.

Type
  • boolean

SCHEDULE <static>

Stores a range of schedule and profile enumerations.


SELECT <static, readonly>

Enumerates different types of sub-item selection methods.

Properties:
Name Type Default Description
ANY number 0

Select any sub-item, typically the first matching item.

CLOSEST number 1

Select the closest sub-item, typically to the selection ray origin.

FARTHEST number 2

Select the farthest sub-item, typically from the selection ray origin.

ALL number 3

Select all matching sub-items.

Author:
  • drajmarsh

SELECTED <static, readonly>

Enumerates the type of model feature that a selection set contains.

Properties:
Name Type Default Description
NONE number 0

Nothing is selected.

BBOX number 1

The bounding box extents of an element is selected.

SHELL number 2

The PD.Shell of a model element is selected.

SHELL_FACET number 3

A PD.Polygon facet of a PD.Shell is selected.

SHELL_EDGE number 4

An edge between two PD.Polygon facets of a PD.Shell is selected.

VERTEX number 5

One or more PD.Point vertices within a PD.Shell are selected.

BREP number 6

The PD.BRep of a model element is selected.

BREP_FACE number 7

A Face within the PD.BRep of a model element is selected.

BREP_EDGE number 8

An edge within the PD.BRep of a model element is selected.

BREP_VERTEX number 9

A vertex within the PD.BRep of a model element is selected.

ELEMENT number 10

The BIM.Path of a model BIM.Element is selected.

JUNCTION number 11

A BIM.Junction within the BIM.Path of a model BIM.Element is selected.

SEGMENT number 12

A linear or curved segment within the BIM.Path of a model BIM.Element is selected.

APERTURE number 13

A BIM.Aperture within a BIM.Junction or BIM.Surface is selected.

NODE number 14

A curve control node is selected.

LEVEL number 20

A BIM.Level within a BIM.Structure.

STRUCTURE number 21

A BIM.Structure within a BIM.Project.

isTransient function

Determines if the current selection is transient or not.

Transient selections only appear for a short time and fade away so as not to interfere with interactive selections. For example, if you select an element on a different level to the current level, a transient level selection appears while the model transitions the selected level to become the current level, and then disappears to allow you to select things on the new current level.

isJunctionOrSegment function

Determines if the current selection is equal to either PD.SELECTED.JUNCTION or PD.SELECTED.SEGMENT.

toString function

Format the given value as a string.

Author:
  • drajmarsh

SELECTION <static>

Enumerates the different selection types.

This enumerator is typically filled out by PD.SelectionHandler class instances when they are enabled by the host application.

Properties:
Name Type Description
NONE number

No selection.

STRUCTURE number

When a BIM.Structure is selected.

LEVEL number

When a BIM.Level is selected.

ELEMENT number

When a BIM.Element is selected.

Author:
  • drajmarsh

SELECT_ACTION <static, readonly>

Enumerates whether items that are interactively selected will replace, be added to, removed from or toggled within the current selection set.

Properties:
Name Type Default Description
REMOVE number -1

Interactive selection removes from the existing selection set.

REPLACE number 0

Interactive selection replaces the existing selection set.

ADD number 1

Interactive selection is added to the existing selection set.

TOGGLE number 2

The state of items Interactive selection. Interactive selection is added to the existing selection set.

Author:
  • drajmarsh

SIDE <static, readonly>

Enumerates the different sides of a entity.

Properties:
Name Type Default Description
NONE number -99

Stick rigidly to line/plane without projection or offset.

INSIDE number -1

The side opposite to the direction of the surface normal or the inner surface/plane.

MIDDLE number 0

The actual line of the path or face of the center surface/plane.

OUTSIDE number 1

The side in the direction of the surface normal or the outer surface/plane.

getParamType function

Retrieve side types as a PD.ParamType from global cache.

Author:
  • drajmarsh

SKYDOME <static>

Enumerates different methods for subdividing the sky dome into patches.

There are many ways to subdivide the surface of a sphere into a series of discrete areas. The values defined here represent some of the commonly used standards for subdividing a hemispherical sky dome into analysis patches.

Properties:
Name Type Description
EQUAL_ANGLE number

The equal-angle method divides the sky into equal azimuth and altitude angles, which means that segmentation is denser towards the zenith.

EQUAL_AREA number

The equal-area method tries to keep all segments as close as possible to the same solid angle by varying the number within each altitude band.

TREGENZA number

The Reinhart/Tregenza method first generates 145 equal area sky patches and then further subdivides them to obtain the required angle.

GEODESIC number

The Geodesic method progressively subdivides icosahedral triangles into smaller triangles and projects them onto the sky dome.

Author:
  • drajmarsh

SKY_TYPE <static>

Enumerates the different standard general all-weather sky types.

Properties:
Name Type Description
NONE number

NO SKY DISTRIBUTION.

SKY_01 number

Standard Overcast Sky.

SKY_02 number

Overcast, steep grade, some Sun.

SKY_03 number

Overcast, moderate grade, no Sun.

SKY_04 number

Overcast, moderate grade, some Sun.

SKY_05 number

Standard Uniform Sky.

SKY_06 number

Partly cloudy, no grade, some Sun.

SKY_07 number

Partly cloudy, no grade, more Sun.

SKY_08 number

Partly cloudy, no grade, distinct corona.

SKY_09 number

Partly cloudy, obscured Sun.

SKY_10 number

Partly cloudy, circumsolar region.

SKY_11 number

White-blue sky, distinct corona.

SKY_12 number

Standard Clear Sky, low turbidity.

SKY_13 number

Standard Clear Sky, some pollution.

SKY_14 number

Cloudless turbid sky, broad corona.

SKY_15 number

White-blue turbid sky, broad corona.

SKY_16 number

Traditional Overcast Sky.

WEATHER number

FROM WEATHER DATA.

Author:
  • drajmarsh

SNAP <static, readonly>

Enumerates the various object snap options.

Properties:
Name Type Default Description
NONE number 0

Completely disable snapping.

GRID number 1

Snap to the current grid.

POINTS number 2

Snap to other vertices on the currently selected path.

MIDPOINTS number 4

Snap to the mid-point of line segments in the currently selected path.

LINES number 8

Snap to the closest point on line segments in the currently selected path.

DIAGONALS number 16

Snap when at a 45 degree angle to adjacent vertices on the currently selected path.

HOVER number 32

Snap to the closest point beneath the pointer when dragging.

PATH number 64

Snap to nearest 90 degrees increment from previous/next junction in path.

ALL number 127

Snap to vertices, mid-points and 45deg angles.

Author:
  • drajmarsh

SPECIFIC_VOLUME <static, readonly>

Provides tools to convert between different specific volume units.

Properties:
Name Type Default Description
CUBIC_METERS_PER_KILOGRAM number 140

The identifier for cubic meters per kilogram (m3/kg).

CUBIC_FEET_PER_POUND number 141

The identifier for cubic feet per pound (ft3/lb).

toCubicMetersPerKilogram function

Converts a specific volume value to cubic meters per kilogram (m3/kg).

fromCubicMetersPerKilogram function

Converts a specific volume value from cubic meters per kilogram (m3/kg).

convertBetween function

Converts a pressure value between the two given units.

getName function

Retrieves the name of the given specific volume units.

Based on the given units, this method returns one of the following string values: 'Cubic Meters per Kilogram' or 'Cubic Feet per Pound'.

getAbbrev function

Retrieves the abbreviation of the given specific volume units.

Based on the given units, this method returns one of the following string values: 'm3/kg' or 'ft3/lb'.

getUnitsFromAbbrev function

Retrieves the specific volume units identifier from the given abbreviation.

Parses the abbreviations 'm3/kg' or 'ft3/lb' into the appropriate unit ID,

Author:
  • drajmarsh

TEMPERATURE <static, readonly>

Provides tools to convert between different temperature units.

Properties:
Name Type Default Description
CELSIUS number 0

The identifier for degrees Celsius (°C).

FAHRENHEIT number 1

The identifier for degrees Fahrenheit (°F).

RANKINE number 2

The identifier for degrees Rankine (°R).

KELVIN number 3

The identifier for degrees Kelvin (K).

toCelsius function

Converts a temperature value from the given units to Celsius.

fromCelsius function

Converts a temperature value in Celsius to the given units.

convertBetween function

Converts a temperature value between the two given units.

getName function

Retrieves the name of the given temperature units.

Based on the given units, this method returns one of the following string values: 'Celsius', 'Fahrenheit', 'Rankine' or 'Kelvin'.

getAbbrev function

Retrieves the abbreviation of the given temperature units.

Based on the given units, this method returns one of the following string values: '°C', '°F', '°R' or 'K'.

getUnitsFromAbbrev function

Retrieves the temperature units identifier from the given abbreviation.

Interprets the abbreviations '°C'/'degC', '°F''degF', '°R'/'degR' or 'K' into the identifiers CELSIUS | FAHRENHEIT | RANKINE | KELVIN.

Author:
  • drajmarsh
Example
const kelvin = PD.TEMPERATURE.convertBetween(83.48, PD.TEMPERATURE.FAHRENHEIT, PD.TEMPERATURE.KELVIN);
console.log(kelvin); // = 301.75

/// Convert values to degrees Celsius.
const c1 = PD.TEMPERATURE.toCelsius(61.7, PD.TEMPERATURE.FAHRENHEIT);
const c2 = PD.TEMPERATURE.toCelsius(95.0, PD.TEMPERATURE.FAHRENHEIT);
console.log(c1, c2); // = 16.5, 35.0

/// Assign a new value from degrees Celsius.
const f1 = new PD.TEMPERATURE.fromCelsius(0.0, PD.TEMPERATURE.FAHRENHEIT);
const units_abbrev = PD.TEMPERATURE.getAbbrev(PD.TEMPERATURE.FAHRENHEIT);
console.log(f1.toFixed(1) + units_abbrev; // '32.0°F'.

:URLSearchParams

URLParams <static, readonly>

Allows access to any parameters appended to the page URL.

This uses URLSearchParams which is supported by all the evergreen browsers, other than Internet Explorer.

Type
  • URLSearchParams
Author:
  • drajmarsh

VELOCITY <static>

Provides tools to convert between velocity units.

The available velocity unit types are: PD.VELOCITY.METERS_PER_SECOND, PD.VELOCITY.KILOMETERS_PER_HOUR, PD.VELOCITY.FEET_PER_SECOND, PD.VELOCITY.FEET_PER_MINUTE, PD.VELOCITY.MILES_PER_HOUR and PD.VELOCITY.KNOTS.

Properties:
Name Type Default Description
METERS_PER_SECOND number 0

The identifier for meters per second (m/s).

KILOMETERS_PER_HOUR number 1

The identifier for kilometres per hour (km/h).

FEET_PER_SECOND number 2

The identifier for feet per second (ft/s).

FEET_PER_MINUTE number 3

The identifier for feet per second (ft/s).

MILES_PER_HOUR number 4

The identifier for miles per hour (mph).

KNOTS number 5

The identifier for knots (kn).

toMetersPerSecond

Converts a velocity value to meters per second (m/s).

fromMetersPerSecond

Converts a velocity value from meters per second (m/s).

convertBetween

Converts a velocity value between the two given units.

getName function

Retrieves the name of the given enthalpy units.

Based on the given units, this method returns one of the following string values: 'Joules per Kilogram', 'kilo-Joules per Kilogram' or 'Btu per Pound'.

getAbbrev

Retrieves the abbreviation of the given enthalpy units.

Based on the given units, this method returns one of the following string values: 'J/kg', 'kJ/kg' or 'Btu/lb'.

getUnitsFromAbbrev

Retrieves the enthalpy units identifier from the given abbreviation.

Interprets the abbreviations 'J/kg', 'kJ/kg' or 'Btu/lb' into the identifiers PD.ENTHALPY.JOULES_PER_KILOGRAM | KILO_JOULES_PER_KILOGRAM | BTU_PER_POUND.


WEATHERDATA <static, readonly>

Weather data indexes for the PD.WeatherData#getMetric method.

Properties:
Name Type Default Description
DRY_BULB number 0

Dry Bulb Temperature (°C).

DEW_POINT number 1

Dew Point Temperature (°C).

REL_HUMIDITY number 2

Relative Humidity (%).

ATM_PRESSURE number 3

Atmospheric Pressure (Pa).

ET_SOLAR_HORIZONTAL number 4

Extraterrestrial Horizontal Radiation (Wh/m2).

ET_SOLAR_DIRECT number 5

Extraterrestrial Direct Normal Radiation (Wh/m2).

INFRA_RED_HORIZONTAL number 6

Horizontal Infrared Radiation from Sky (Wh/m2).

SOLAR_GLOBAL_HORIZONTAL number 7

Global Horizontal Radiation (Wh/m2).

SOLAR_DIRECT_NORMAL number 8

Direct Normal Radiation (Wh/m2).

SOLAR_DIFFUSE_HORIZONTAL number 9

Diffuse Horizontal Radiation (Wh/m2).

ILLUM_GLOBAL_HORIZONTAL number 10

Global Horizontal Illuminance (Lux).

ILLUM_DIRECT_NORMAL number 11

Direct Normal Illuminance (Lux).

ILLUM_DIFFUSE_HORIZONTAL number 12

Diffuse Horizontal Illuminance (Lux).

ILLUM_ZENITH number 13

Zenith Luminance (cd/m2).

WIND_DIRECTION number 14

Wind Direction (deg).

WIND_SPEED number 15

Wind Speed (m/s).

CLOUD_COVER_TOTAL number 16

Total Cloud Cover (%).

CLOUD_COVER_OPAQUE number 17

Opaque Sky Cover (%).

VISIBILITY number 18

Visibility (km).

CEILING_HEIGHT number 19

Ceiling Height (m).

PRECIPITABLE_WATER number 20

Precipitable Water (mm).

AEROSOL_DEPTH number 21

Aerosol Optical Depth (thou).

SNOW_DEPTH number 22

Snow Depth (cm).

SNOW_DAYS_SINCE_LAST_FALL number 23

Days Since Last Snowfall (days).

ALBEDO number 24

Albedo (0-1).

RAINFALL number 25

Precipitation Depth (mm).

Author:
  • drajmarsh

:string

appID <static>

An identifier for your particular app, defaults to 'PD'.

This value is used as a key prefix for all application-based local storage access within the framework. Whilst not always necessary, this does allow for differentiation if there is more than one app served from the same web address or server folder, or you are working on multiple apps using a local web server or via the File URI scheme.

You can change its value for your particular app by either creating the window.pdAppIdentifier variable prior to including the src/pd/core/pd.js script file, or later by including another customisation script that runs some time after pd.js but before the src/pd/app/pd-global-state.js script file.

Type
  • string

:number

pageScale <static>

The current scale required to fit the page on a small screen.

This is used by some SVG charts to deal with UI scaling issues, particularly in some versions of FireFox.

Type
  • number

Methods


Debounce(callback [, delay]) <static>

Creates a function that accumulates multiple invocations onto just one.

This returns a function that does not execute immediately when invoked, but waits for a pause in a stream of invocations that is greater than the given delay period before executing. Each new invocation restarts an internal timer.

This method is different to throttling in that debouncing guarantees no execution until there is a pause in invocations at least as long as the delay time, rather than periodic execution at regular intervals.

Parameters:
Name Type Argument Description
callback function

A function to call after the delay period.

delay number <optional>

The delay before calling in milliseconds (1 to 30,000), defaults to 50ms.

Throws:

Throws an error if the given callback is not a function.

Type
TypeError
Returns:

Returns a function that waits delay ms before executing.

Type
function

DynamicDebounce(callback [, shortDelay] [, longDelay] [, runLen]) <static>

Creates a function that accumulates multiple invocations onto just one, and uses a running average of calculation times to dynamically adjust the event accumulation period.

This returns a function that does not execute immediately when invoked, but waits for a pause in a stream of invocations that is greater than the given delay period before executing. Each new invocation restarts an internal timer.

Parameters:
Name Type Argument Description
callback function

A function to call after the delay period.

shortDelay number <optional>

The accumulation period in milliseconds when the calculation is short (1 to 30,000), defaults to 50ms.

longDelay number <optional>

The accumulation period in milliseconds when the calculation is long (1 to 30,000), defaults to 250ms.

runLen number <optional>

Length of the running average queue (1 to 64), defaults to 5.

Throws:

Throws an error if the given callback is not a function.

Type
TypeError
Returns:

Returns a function that accumulated calls before executing.

Type
function

PolyLabelPos(polygon [, result]) <static>

Calculates a good point within a complex polygon to place a label.

This uses polylabel (https://github.com/mapbox/polylabel), a fast algorithm for finding polygon 'pole of inaccessibility', the most distant internal point from the polygon outline (not to be confused with centroid). This is useful for the optimal placement of a text label that is actually within the polygon area, even if it has holes.

It is used in this framework for positioning labels on the floor plans of spaces as well as when inserting apertures and holes in selected surfaces.

The polygon must be given as an array of outer and inner boundary coordinates arrays. For polygons with multiple contours, the first must be the outer boundary ring and any others must be inner rings representing openings or holes.

Parameters:
Name Type Argument Description
polygon PD.Polygon

The polygon to calculate the best label position for.

result THREE.Vector3 <optional>

An optional 3D vector object to receive the label position.

Returns:

Returns the result value, or a new 3D vector.

Type
THREE.Vector3

Throttle(callback [, delay]) <static>

Creates a function that throttles invocations to once per delay period.

This returns a function that does not execute immediately when invoked, but waits for the given delay period before executing. Any subsequent calls within delay period are ignored.

This method is different from debouncing in that it guarantees execution at regular intervals, rather than waiting for a pause in invocations.

Parameters:
Name Type Argument Description
callback function

A function to call after the delay period.

delay number <optional>

The delay before calling in milliseconds (1 to 30,000), defaults to 50ms.

Throws:

Throws an error if the given callback is not a function.

Type
TypeError
Returns:

Returns a function that waits delay ms before executing.

Type
function

WrappedCallback(obj, callback) <static>

Creates a function that invokes a callback method with the given object as this.

The aim of wrapping a callback function or method is to ensure that it is always invoked with the given object as this, regardless of how the wrapper function is called.

This is also useful when you want to add an auto-generated listener to an event that can then removed at some later time. Simply store the wrapped callback in a persistent variable, and use it in removeEventListener() exactly the same way as addEventListener().

Parameters:
Name Type Description
obj object

The object to use as this in the callback.

callback function

A method on the given object to invoke.

Throws:

Throws an error if callback is not a function or object is not valid.

Type
TypeError
Returns:

Returns a function that invokes the callback.

Type
function

getDefaultValue(key) <static>

Retrieves the value associated with a prefixed key in local storage.

This method modifies the given key by prefixing it with the current value of PD.appID followed by a full colon, in order to make the data specific for this app. Thus, if a key value of colorScheme is given, and the value of PD.appID is PD:SP3D, then the actual key looked up in local storage will be PD:SP3D:colorScheme.

You are strongly encouraged to use the methods provided by PD.GlobalActions for accessing local storage instead of this one. These include PD.GlobalActions.getDefaultValue, PD.GlobalActions.setDefaultValue and PD.GlobalActions.removeDefaultValue. This method exists for use internally by the framework when reading application state before PD.GlobalActions has been created.

Parameters:
Name Type Description
key string

The unprefixed name of the item.

Returns:

Returns the value, or null.

Type
any | null

Namespace: PD

PD

Provides tools and utilities to support building modelling and analysis.

The PD namespace forms the core infrastructure for any interactive application that displays, edits and/or interacts with the BIM classes. It provides global state, actions, events and undo/redo, as well as a wide range of utilities for working with WebGL and front-end frameworks such as Vue, React, Knockpout and Enyo. It also provides a range of fundamental geometry creation, mesh generation, scene visualisation and user interaction management tools.

Author:
  • drajmarsh

Classes

Animation
AxisArray
BRep
Base
CAD
CSG
Calculate
CalculateOnIdle
Capsule
ClipPt2D
Clipboard
Clipper
ConnectionData
Cursor
Cursors
Curve
DateTime
DateTimeIterator
DateTimeRange
DaySchedule
Dimensions
Easing
Enumerator
EnumeratorMap
EquationParser
EventDispatcher
File
Font
GlobalActions
GlobalEvents
GlobalState
GlobalUndo
GlobalView
Grid2D
GridCell
GridLines
GridMesh
HUDController
HUDItem
IndexDB
Indexer
Interaction
InteractionEvent
Interactive
Legend
LineFont
LineMesh
LocalCoordinates
LocalDB
Location
MatrixArray
MeshBuilder
MeshFactory
ModelManager
Mouse
MouseArrow
NURBSSurface
NurbsSurfaceArray
OCC
Occlusion
Octree
OctreeHelper
OctreeNode
ParamGroup
ParamType
Parameter
Path
PathPoint
PerezSky
PlaneArray
Point
PolyMesh
Polygon
Polyhedron
Polyline
PouchDB
QuaternionArray
RandomNumberCache
RectMesh
Registry
Rotator
SVG
ScaledVector
SceneEditor
SceneManager
SceneViewer
Schedule
Selection
SelectionFrustum
SelectionHandler
SelectionManager
SelectionMap
SelectionSet
Shading
ShadowPlane
Shape
Shell
SkyDome
Snapper
SolarPosition
Solid
SphericalOcclusion
SunPath2D
SunPath3D
SunPathManager
Tesselator
Text
ThickLineMesh
ThrottledCallback
TimeZones
Triangle
UndoAction
UndoActions
UndoObject
Units
UserModeHandler
Utils
VectorArray
VectorFont
Vertex
Video
View
ViewAngles
ViewController
ViewData
ViewOrbital
VolumeArray
WeatherData

Members


ALIGN <static, readonly>

Defines a set of positional alignment values.

These values are also bit-wise flags that can be used in bit operations. As a result, this object provides a number of methods to check components of a value for just the horizontal (left, center, right) or vertical (bottom, middle, top) components.

Properties:
Name Type Default Description
NONE number 0

No alignment, use absolute positioning.

LEFT number 1

Horizontally align item to the left.

CENTER number 2

Horizontally align item to center.

RIGHT number 4

Horizontally align item to the right.

BOTTOM number 8

Vertically align item to bottom extent.

MIDDLE number 16

Vertically align item to middle.

TOP number 32

Vertically align item to top extent.

BOT_LEFT number 9

Align item to bottom-left corner.

Contains bit flags for BOTTOM and LEFT.

BOT_CENTER number 10

Align item to bottom-center edge.

Contains bit flags for BOTTOM and CENTER.

BOT_RIGHT number 12

Align item to bottom-right corner.

Contains bit flags for BOTTOM and RIGHT.

MID_LEFT number 17

Align item to middle-left edge.

Contains bit flags for MIDDLE and LEFT.

MID_CENTER number 18

Align item to middle-center point.

Contains bit flags for MIDDLE and CENTER.

MID_RIGHT number 20

Align item to middle-right edge.

Contains bit flags for MIDDLE and RIGHT.

TOP_LEFT number 33

Align item to top-left corner.

Contains bit flags for TOP and LEFT.

TOP_CENTER number 34

Align item to top-center edge.

Contains bit flags for TOP and CENTER.

TOP_RIGHT number 36

Align item to top-right corner.

Contains bit flags for TOP and RIGHT.

isTop function

Determines if the given alignment contains the TOP bit flag.

isMiddle function

Determines if the given alignment contains the MIDDLE bit flag.

isBottom function

Determines if the given alignment contains the BOTTOM bit flag.

isLeft function

Determines if the given alignment contains the LEFT bit flag.

isCenter function

Determines if the given alignment contains the CENTER bit flag.

isRight function

Determines if the given alignment contains the RIGHT bit flag.

computeFromUV function

Compute alignment from relative fractional UV coordinates.

_UPPER number 64

For 3D application, refers to the maximum Z value.

_MIDWAY number 128

For 3D application, refers to the midway between minimum and maximum Z value.

isUpper function

Determines if the Z-Axis alignment is UPPER.

useUpper function

Determines if the given alignment contains the UPPER bit flag.

isMidway function

Determines if the given alignment contains the MIDWAY bit flag.

useMidway function

Determines if the given alignment contains the MIDWAY bit flag.

useLower function

Determines if the given alignment contains the MIDWAY bit flag.

getAsOptionList

Retrieve enumerators as an array of {name, value} objects compatible with a PD.ParamType options list.

getParamType function

Retrieve a selectable enumerator list as a PD.ParamType from global cache.

Author:
  • drajmarsh

ANIMATION <static, readonly>

Enumerates the various states of an animation affecting an elements' geometry.

Properties:
Name Type Default Description
DELETED number -99

Indicates that an animation was present, but was recently deleted.

NONE number -1

Indicates that no animation is present.

PAUSED number 0

Indicates that an animation present but paused.

PLAYING number 1

Indicates that an animation is present and currently playing.

Author:
  • drajmarsh

ATTRIB <static, readonly>

Enumerates some standard public/private attribute keys.

Attribute keys are used by the attribute map on entities and points to locate stored data. The aim of using an attribute map instead of properties on the object is to both allow the end user to add arbitrary data to things in the model, and to allow objects to store dynamic data without affecting the low level shape of the object in the code optimiser.

Any attribute key that starts with a '$' sign indicates private or volatile data that is not included when attributes are saved. All other keys are saved when converted to JSON.

Properties:
Name Type Default Description
REF_POS string $refPos

Stores a reference position for an activity or animation.

This is used by PD.Point to store its original position just prior to an interactive transformation. It is also used by BIM.Level to store the level's original starting position at the beginning of a dynamic animation.

SELECTED string $selected

Stores whether or not a point is in the current selection set.

JUNCTION string $junction

Stores a parent junction that generated a point.

CURVE_ID string $curveId

Stores the ID of the curve that a point belongs to.

NORMAL string normal

Stores a normal direction vector on a point.

TANGENT string tangent

Stores a tangent direction vector on a point.

BINORMAL string binormal

Stores a binormal direction vector on a point.

UV string uv

Stores a UV texture coordinate on a point.

COLOR string color

Stores a a colour value for a point.

ALIGNMENT string alignment

Stores the alignment of junction inner/outer boundaries relative to its path.

FIXED_NORMAL string $fixedNormal

Stores whether or not the normal direction vector of a point is fixed so should not be set when calculating smooth normals.

APERTURE_CURVE_PATH string $apertureCurvePath

Stores a path that defines the shape of an aperture as it follows its host junction's curved path.

APERTURE_PATH_CACHE string $aperturePathCache

Stores a path point cache for regenerating an aperture's own path as it follows its host junction's curved path.

CONNECT_DATA string $connectData

Stores start/end connections between column/post/landing profiles.

VIRTUAL_JUNCTIONS string $vrtJunctions

Stores an array of virtual junctions added to a junction.

LINKED_JUNCTION string $trackJunction

Stores a junction that is being tracked by another junction.

REL_POS string relPos

Stores the relative position of a control node in local junction coordinates.

SMOOTH string smooth

Stores the distance from the first/last junction to a control node.

WEIGHT string weight

Stores the relative weighting of a control node.

Author:
  • drajmarsh

AXIS <static, readonly>

Enumerates the major cartesian axis.

This is different from the component indexes of coordinate arrays as it needs to differentiate between positive and negative directions in each axis.

Properties:
Name Type Default Description
NONE number 0

No axis specified, or use the default.

X_POS number 1

The positive X-axis, or the YZ plane pointing towards +X (East).

X_NEG number -1

The negative X-axis, or the YZ plane pointing towards -X (West).

Y_POS number 2

The positive Y-axis, or the XZ plane pointing towards +Y (North).

Y_NEG number -2

The negative Y-axis, or the XZ plane pointing towards -Y (South).

Z_POS number 3

The positive Z-axis, or the XY plane pointing towards +Z (Up).

Z_NEG number -3

The negative Z-axis, or the XY plane pointing towards -Z (Down).

VECTOR number 99

Indicates that a custom vector is used.

This value is typically only used by custom cursors to indicate that movement is restricted to a non-cartesian axis.

PERSPECTIVE number 100

Indicates a perspective view.

isX function

Whether or not the given axis is either X_POS or X_NEG.

isY function

Whether or not the given axis is either Y_POS or Y_NEG.

isZ function

Whether or not the given axis is either Z_POS or Z_NEG.

isCartesianAxis function

Whether or not the given axis is X, Y or Z.

isOrthoOrPerspective function

Whether or not the given axis is NONE or PERSPECTIVE.

isParallel function

Whether or not the two axis are parallel (+/-).

getAsOptionList function

Retrieve enumerators as an array of {name, value} objects compatible with a PD.ParamType options list.

getParamType function

Retrieve a selectable enumerator list as a PD.ParamType from global cache.

Author:
  • drajmarsh

CAP <static, readonly>

Enumerates the different extrusion end caps.

This value can also be used as bitwise flags to test for TOP and BOTTOM. The static functions hasTop() and hasBottom() can be used for that, where a single value can be used to store none, either or both.

Properties:
Name Type Default Description
NONE number 0

Don't add a cap to the extrusion.

TOP number 1

Add a top cap to the extrusion.

BOTTOM number 2

Add a bottom cap to the extrusion.

BOTH number 3

Add a top and bottom cap to the extrusion.

hasTop function

Determines if the given cap includes the TOP bit flag.

hasBottom function

Determines if the given cap includes the BOTTOM bit flag.

Author:
  • drajmarsh

:boolean

CLOSED <static>

An alias for true to make some polygon/polyline method calls more readable.

Type
  • boolean

CONDUCTIVITY <static, readonly>

Provides tools to convert between different thermal conductivity units.

Properties:
Name Type Default Description
WATTS_PER_METRE_KELVIN number 20

The identifier for watts per metre-Kelvin (W/(m-K)).

BTU_PER_HOUR_FOOT_FAHRENHEIT number 21

The identifier for BTU per hour-foot-Fahrenheit (BTU/(h-ft-F)).

toWattsPerMetreKelvin function

Converts a thermal conductivity value to watts per metre-kelvin (W/(m-K)).

fromWattsPerMetreKelvin function

Converts a thermal conductivity value from watts per metre-kelvin (W/(m-K)).

convertBetween function

Converts a thermal conductivity value between the two given units.

getName function

Retrieves the name of the given specific volume units.

Based on the given units, this method returns one of the following string values: 'Cubic Meters per Kilogram' or 'Cubic Feet per Pound'.

getAbbrev function

Retrieves the abbreviation of the given specific volume units.

Based on the given units, this method returns one of the following string values: 'W/(m-K)' or 'BTU/(h-ft-F)'.

getUnitsFromAbbrev function

Retrieves the specific volume units identifier from the given abbreviation.

Parses the abbreviations 'W/(m-K)' or 'BTU/(h-ft-F)' into the appropriate unit ID,

Author:
  • drajmarsh

CSG_OP <static>

The different types of constructive solid geometry to apply to shapes.

Properties:
Name Type Description
UNION number

Union together all child masses into a single bounded volume.

SUBTRACT number

Subtract the volume of each subsequent child mass from the first child mass.

INTERSECT number

Intersect the volumes of each child mass to find the common volume.

Author:
  • drajmarsh

CURSOR <static, readonly>

Enumerates the different cursor types.

Properties:
Name Type Default Description
POINT number 0

Unrestricted movement in all 3 dimensions. Has a UV manipulator at the centre of the cursor and arrows in each of the +/-U, +/-V and +/-W directions. The plane of movement varies between UV, VW and UW based on the 3D view angle.

PLANE number 1

Movement is restricted to an arbitrary 3D plane. Has a UV manipulator at the centre of the cursor and arrows in each of the +/-U and +/-V directions.

VECTOR number 2

Movement is restricted to an arbitrary 3D vector. Has arrows in only the +/-U directions.

RECT number 3

Used to edit the position, width and height of an arbitrarily oriented 3D rectangle. Movement is restricted to the plane of orientation of the rectangle. Has a UV manipulator at the centre of the cursor and arrows at the rectangle extents in the +/-U and +/-V directions to control width and height.

RECT_CORNERS number 4

Used to edit the position, width and height of an arbitrarily oriented 3D rectangle. Movement is restricted to the plane of orientation of the rectangle. Has a UV manipulator at the centre of the cursor and arrows at the rectangle extents in the +/-U and +/-V directions to control width and height.

BOX number 5

Used to edit the position, width, depth and height of an arbitrarily oriented 3D bounding box. Has a UV manipulator at the centre of the cursor and arrows at the bounding box extents in the +/-U, +/-V and+/- W directions to control width, depth and height. The position has unrestricted movement in all 3 dimensions and the plane of movement varies between UV, VW and UW based on the 3D view angle.

SECTION number 6

Typically used to manipulate section planes. Movement is restricted to the 3D vector normal to the section plane. Has a single manipulator offset from the centre of the cursor, shaped as an architectural section symbol.

CAPTURE_ALL number 100

Typically used to capture and react to input from the entire scene canvas.

Author:
  • drajmarsh

CURSOR_STYLE <static, readonly>

Enumerates the different cursor styles.

Properties:
Name Type Default Description
IMAGE number -1

Use a texture atlas to display cursor manipulators.

LIGHT number 0

A white background with red outlines.

GRAY number 1

A dark gray background with white outlines.

DARK number 2

A black background with light gray outlines.

ORANGE number 3

A bright orange background with deep orange outlines.

DARK_ORANGE number 4

A transparent deep orange background with bright orange outlines.

LIGHT_RED number 5

A transparent light background with red outlines.

DARK_RED number 6

A transparent dark background with red outlines.

RED number 7

A red background with white outlines.

getAsOptionList function

Retrieve cursor styles as a PD.ParamType options list.

Author:
  • drajmarsh

CURVE <static, readonly>

Enumerates the various types of available curve.

Properties:
Name Type Default Description
OFFSET number -1

Defines a curve that is offset from another curve.

Offset curves are typically created when an offset PD.Path is created from a BIM.Path.

NONE number 0

Defines a straight line with no curvature.

ARC number 1

A circular curve that goes through the first control point.

QUADRATIC number 2

A Quadratic Bezier curve that is governed by a single control point.

CUBIC number 3

A Cubic Bezier curve that is governed by two control points.

NURBS number 4

A NURBS curve that passes through the midpoint of a line joining each control point.

Author:
  • drajmarsh

DIMENSION <static, readonly>

Enumerates the different types of length dimension formats.

Properties:
Name Type Default Description
DEFAULT number 0

Show default units.

METRIC_MM number 1

Show dimensions in integer millimeters.

METRIC_SI number 2

Show dimensions in decimal meters.

IMPERIAL number 3

Show dimensions in feet, inches and sixteenths.

_units PD.DIMENSION 1

Stores the preferred format for displaying dimensions.

useImperial boolean false

Whether or not imperial dimensions are currently being used.

mmToMetres

Converts a distance in millimetres to metres.

mm2ToMetres2

Converts an area in square millimetres to square metres.

mm3ToMetres3

Converts a volume in cubic millimetres to cubic metres.

metersToFeet

Converts a distance in metres to decimal feet.

metersToInches

Converts a distance in metres to decimal inches.

metersToMillimeters

Converts a distance in metres to millimetres.

feetToMeters

Converts a distance in decimal feet to metres.

feetToMillimeters

Converts a distance in decimal feet to mm.

feetToInches

Converts a distance in decimal feet to decimal inches.

inchesToMeters

Converts a distance in decimal inches to metres.

inchesToMillimeters

Converts a distance in decimal inches to mm.

inchesToFeet

Converts a distance in decimal inches to decimal feet.

Author:
  • drajmarsh

DISPLAY <static, readonly>

Enumerates the types of model display mode.

Properties:
Name Type Default Description
FLOORPLAN number 0

Displays detailed geometry with wall thickness and openings.

SPATIAL number 1

Displays only the space volumes on the current level.

LEVEL number 2

Display the current level as a 3D model with walls and openings.

BUILDING number 3

Displays the whole building as a full 3D model.

_MAX number 3

The maximum allowed value.

toString function

Converts a display type value to a string identifier.

fromString function

Parses a string into a valid display type value.

Author:
  • drajmarsh

DRAG_ACTION <static>

Enumerates different types of pointer button drag actions.

Each action also has an alternate mode set by holding down the SHIFT and CTRL|ALT|META keys when first clicking the pointer button in the canvas. The alternate mode for rotating and zooming it is adjusting the field of view, and for panning it is zooming in/out.

Once you have set the action or alternate mode, pressing any of the modifier keys will also change its magnitude, with SHIFT resulting in a larger speed/magnitude and CTRL|ALT|META a smaller speed/magnitude.

Properties:
Name Type Description
NONE number

Pointer button drag does not affect the view.

ROTATE number

Rotates a 3D view, pans a 2D drawing (ALT: FieldOfViewAngle(3D)/pan).

ZOOM number

Zooms 2D and 3D views (ALT: FieldOfViewAngle(3D)).

PAN number

Pans 2D and 3D views (ALT: Zoom/FieldOfViewAngle(3D)).

Author:
  • drajmarsh

DRAWING_TYPE <static>

Enumerates the different types of architectural drawing.

For more information on the different types of architectural drawing, see: https://www.archtoolbox.com/construction-document-sheet-numbers/.

Properties:
Name Type Description
GENERAL number

Contains explanatory notes, symbols and legends.

PLAN number

Orthographic views taken from above and looking down, typically sectioned.

ELEVATION number

Orthographic views taken from the side looking horizontally.

SECTION number

Cut-away views where part(s) of the model are hidden, typically orthographic.

BLOW_UP number

Large scale drawings including plans, elevations and sections that are not details.

DETAIL number

CLose-up of a small section of the model, typically showing how component assembly.

SCHEDULE number

Detailed listings of materials, components or costs associated with the model.

USERDEFINED_1 number

Available for (re)definition bu by the user.

USERDEFINED_2 number

Available for (re)definition bu by the user.

DRAWING_3D number

Three dimensional perspective and/or orthographic drawings, renderings or photographs.

NOT_DEFINED number

The type is not defined so derive from view settings.

Author:
  • drajmarsh

EASING <static>

Enumerates the range of available easing methods.

You can access the easing methods directly via the PD.Easing static class, or use the PD.EASING.getEasingMethod method using a name or ordinal index.

See https://easings.net/ for a visual representation of these easing functions.

Properties:
Name Type Description
LINEAR number

No easing or acceleration.

IN_SINE number

Sine function accelerating from zero to one.

OUT_SINE number

Sine function decelerating from one to zero.

IN_OUT_SINE number

Sine function accelerating from zero to one halfway, then decelerating back to zero.

IN_OUT_SINE_POW number

Sine function accelerating until halfway, then decelerating with a power function (Math.pow) applied.

IN_QUAD number

Quadratic function (t^2) accelerating from zero to one.

OUT_QUAD number

Quadratic function (t^2) decelerating from one to zero.

IN_OUT_QUAD number

Quadratic function (t^2) accelerating until halfway, then decelerating.

IN_CUBIC number

Cubic function (t^3) accelerating from zero to one.

OUT_CUBIC number

Cubic function (t^3) decelerating from one to zero.

IN_OUT_CUBIC number

Cubic function (t^3) accelerating until halfway, then decelerating.

IN_QUART number

Quartic function (t^4) accelerating from zero to one.

OUT_QUART number

Quartic function (t^4) decelerating from one to zero.

IN_OUT_QUART number

Quartic function (t^4) accelerating until halfway, then decelerating.

IN_QUINT number

Quintic function (t^5) accelerating from zero to one.

OUT_QUINT number

Quintic function (t^5) decelerating from one to zero.

IN_OUT_QUINT number

Quintic function (t^5) accelerating until halfway, then decelerating.

IN_EXPO number

Exponential function (2^t) accelerating from zero to one.

OUT_EXPO number

Exponential function (2^t) decelerating from one to zero.

IN_OUT_EXPO number

Exponential function (2^t) accelerating until halfway, then decelerating.

IN_CIRC number

Circular function accelerating from zero to one.

OUT_CIRC number

Circular function decelerating from one to zero.

IN_OUT_CIRC number

Circular function accelerating until halfway, then decelerating.

IN_BACK number

Function with a bit of over-run at start.

OUT_BACK number

Function with a bit of over-run at end.

IN_OUT_BACK number

Function with a bit of over-run at start and end.

IN_BOUNCE number

Bounce function accelerating from zero to one.

OUT_BOUNCE number

Bounce function decelerating from one to zero.

IN_OUT_BOUNCE number

Bounce function accelerating until halfway, then decelerating.

IN_WOBBLE number

Function with a bit of an elastic jelly wobble at the start.

OUT_WOBBLE number

Function with a bit of an elastic jelly wobble at the end.

IN_OUT_WOBBLE number

Function with a bit of an elastic jelly wobble at the start and end.

OUT_ELASTIC number

Function with a bit of an elastic bounce at the end.

Author:
  • drajmarsh

ENDCAP <static, readonly>

Enumerates the various ways to terminate a thick line.

Properties:
Name Type Default Description
CLOSED number 0

Join the end of the line back up with the start.

FLAT number 1

Start/end the line flush with the start/end points.

SQUARE number 2

Project the start/end points out by half the width of the line.

TRIANGLE number 3

Add a 45 degree triangle to the end of the line.

ROUND number 4

Add a semi-circle at each end with the same diameter as the line width.

Author:
  • drajmarsh

ENTHALPY <static>

Provides tools to convert between enthalpy units.

The available enthalpy unit types are: PD.ENTHALPY.JOULES_PER_KILOGRAM, PD.ENTHALPY.KILO_JOULES_PER_KILOGRAM and PD.ENTHALPY.BTU_PER_POUND.

Properties:
Name Type Default Description
JOULES_PER_KILOGRAM number 0

The identifier for Joules per kilogram (J/kg).

KILO_JOULES_PER_KILOGRAM number 1

The identifier for kilo-Joules per kilogram (kJ/kg).

BTU_PER_POUND number 2

The identifier for British thermal units per pound (Btu/lb).

toJoulesPerKilogram

Converts an enthalpy value to joules per kilogram (J/kg).

fromJoulesPerKilogram

Converts an enthalpy value from joules per kilogram (J/kg).

convertBetween function

Converts an enthalpy value between the two given units.

getName function

Retrieves the name of the given enthalpy units.

Based on the given units, this method returns one of the following string values: 'Joules per Kilogram', 'kilo-Joules per Kilogram' or 'Btu per Pound'.

getAbbrev

Retrieves the abbreviation of the given enthalpy units.

Based on the given units, this method returns one of the following string values: 'J/kg', 'kJ/kg' or 'Btu/lb'.

getUnitsFromAbbrev

Retrieves the enthalpy units identifier from the given abbreviation.

Interprets the abbreviations 'J/kg', 'kJ/kg' or 'Btu/lb' into the identifiers PD.ENTHALPY.JOULES_PER_KILOGRAM | KILO_JOULES_PER_KILOGRAM | BTU_PER_POUND.


EVENT <static, readonly>

The different types of core events that can occur.

Events provide an arms-length way that the NLB Framework can communicate with custom classes and the user interface of its host application. It prevents framework data from being directly exposed to any bi-directional reactivity that the UI may use, whilst allowing the UI itself to pick and choose which events it will respond to.

It is important to note that this static class defines all of the core events used within the framework. Some of these will be global events that are broadcast by the static PD.GlobalEvents class, whilst some will be specific to a particular scene viewer or editor. The description of each event type should indicate whether it is a global event or not.

Properties:
Name Type Default Description
DARK_MODE string !pd-darkMode

A global event invoked when the applications colour theme changes.

This event is invoked whenever the user changes the app color theme between light and dark. This is typically done using the navigation bar dro-down menu, but it may also be called by a dynamic script.

The event handler is called with a single boolean argument, indicating whether or not the dark mode theme is now active.

DIMENSION_UNITS string !pd-dimUnits

A global event invoked when the preferred dimension units change.

This event occurs whenever the display units are changed between imperial and metric meters of millimeters. It is an opportunity for the UI to update any displayed values with the newly selected units.

The event handler is called with two arguments, the first being the newly selected numeric PD.DIMENSION.units value and the second being a boolean flag indicating that dimensions changed to/from imperial. This flag is useful as surface area and volume calculations don't change between SI and MM, but do when switching between either of those and imperial.

SITE_LOCATION string !pd-siteLoc

A global event invoked when the site location is changed.

This event is invoked whenever the site latitude, longitude, timezone or north angle values change. It is an opportunity for the UI to update any visible location data. This event is always followed by a SUN_POSITION event as the location change will invariable also affect the calculated sun position.

The event handler is called with a single PD.Location argument.

WEATHER_DATA string !pd-weatherData

A global event invoked when new weather data is loaded.

This event is invoked whenever the user loads new weather data. It is an opportunity for the UI to update any visible weather or station ID data. This event may also be followed by a SITE_LOCATION and SUN_POSITION event if the location changes as well.

The event handler is called with a single PD.WeatherData argument.

SUN_POSITION string !pd-sunPos

A global event invoked when the current solar position changes.

This event is invoked whenever any of the date, time or location values change. It is an opportunity for the UI (as well as custom shadow, analysis and element classes) to react to date, time and location changes.

The handler is called with a single PD.SolarPosition argument.

SUNPATH_PROJECTION string !pd-sunPathProj

A global event invoked when the PD.GlobalState.sunPathProjection value changes.

This event exists to allow the model to update any currently displayed Sun-path diagrams.

The event handler is called with a single argument, being the new PD.PROJECTION value to use.

SKY_DISTRIBUTION string !pd-skyDist

A global event invoked when the current sky luminance distributions changes.

This event is invoked whenever the date, time, location, sky type or sky condition values change. It is an opportunity for the UI (as well as custom element classes) to react to changes in the sky distribution.

The handler is called with a single PD.SkyDome argument.

DAYLIGHT_SCALE !pd-dayScale

A global event invoked when the current daylight scale changes.

This event is typically invoked when a daylight calculation has just completed.

TRANSFORM_ORIGIN string !pd-xformOrigin

A global event invoked when the framework or a script wants the host application to change the position the transform origin used by the rotate and scale functions.

This event exists to allow the UI to update its axial coordinate positions or other information dynamically as it is being interactively dragged.

The event handler is called with a single argument, being the PD.Point containing the new position that is currently being dragged by the cursor or set within a script.

SET_PARAMETER string !pd-setParam

Invoked when the framework needs the UI to update a parameter value for the currently selected element, junction, aperture, level or component.

This event allows the framework to support any UI framework and any method of generating editable parameter lists.

The event handler is called with three (3) arguments, being the selection type as a PD.SELECTED value, the name of the parameter as a string, and the new value to set.

CONTEXT_MENU_SHOW string !pd-contextShow

A global event invoked when the framework or a script wants the host application to show or move its context menu.

This event exists to enable users to both show the context menu and/or interactively drag it within the scene in order to prevent it obscuring some part of the model that they may be working on. The UI should respond by positioning and displaying the context menu or, if it is already displayed, repositioning it to the given page coordinates.

The event handler is called with two arguments, being numbers representing these new page coordinates, given in decimal pixels. Unless invoked from a script, these new coordinates will be those of the primary pointer's pageX and pageY properties as it is dragged within the web page.

CONTEXT_MENU_HIDE string !pd-contextHide

A global event invoked when the framework or a script wants the host application to hide the context menu if it is currently displayed.

The event handler is called with no arguments.

CANVAS_SIZE string !pd-canvasSize

Invoked when a scene viewer's drawing canvas changes size.

The event handler is called by the affected PD.SceneViewer with two numeric arguments, being the new horizontal width and vertical height of the canvas in pixels.

VIEW_SIZE string !pd-viewSize

Invoked when the model size changes in a scene viewer.

This event is an opportunity for the UI to react when the user zooms in or fits the view to a new model size. It is typically used to regenerate dynamically sized overlay widgets such as interactive cursors or dimension lines.

The event handler is called by the affected PD.SceneViewer with a single numeric argument, being the new model view size in model units.

VIEW_CHANGED string !pd-viewChanged

Invoked when the view parameters of a scene viewer changes.

This event is an opportunity for the UI to display dynamic view information such as camera angles, field of view, zoom level or camera/target position. It is invoked quite frequently during interactive view manipulations, so you may want to monitor POINTER_DOWN events to moderate your updates.

The event handler is called by the affected PD.SceneViewer with a single PD.ViewOrbital argument.

MODEL_CHANGED string !pd-modelChanged

Invoked whenever the model geometry is regenerated.

This event is an opportunity for the UI and simulation elements to react to changes in the 3D model.

The event handler is called by the affected PD.SceneViewer with a single PD.ModelManager argument.

WALKING_MODE string !pd-walkingMode

Invoked when the navigation mode in a scene viewer changes.

This event is an opportunity for the UI to update its state based on the scene's walk or orbit mode.

The event handler is called by the affected PD.SceneViewer with a single boolean argument, being true when entering walk mode and false when returning to orbit mode.

POINTER_DOWN string !pd-pointerDown

Invoked when a scene editor primary pointer is pressed or released.

This event is an opportunity for the UI to react to primary pointer down and primary pointer release events in the main model canvas, which occur for any mouse, pen and touch pointers. The typical UI response is to hide, show or modify whatever information overlays it has that sit on top of the main canvas, or to trigger the display of more detailed cursor information.

The event handler is called by the affected PD.SceneEditor with a single boolean argument, indicating whether or not to the primary pointer was pressed (true) or released (false).

CURSOR_MOVED string !pd-cursorMoved

Invoked when the displayed 3D cursor position in a scene editor changes.

This event is an opportunity for the UI to dynamically display or react to the changing coordinates of the cursor as it is being dynamically dragged within the model. This method is distinct from the JUNCTION_MOVED event as it is invoked for every action that involves movement of the cursor.

The event handler is called by the affected PD.SceneEditor with a single PD.Cursor argument.

CLIPBOARD string !pd-clipboard

A global event invoked when the contents of the clipboard changes.

The event handler is called with a single argument, being the PD.Clipboard that invoked the event.

CLIPBOARD_COPY string !pd-clip-copy

A global event invoked when the framework copies a non-text item to the clipboard.

This event is an opportunity for the UI to monitor copy requests and either manipulate the copied data or cancel the event.

The event handler is called with one argument, being an object with the following properties:

Property Type Description
type string The type identifier used by the PD.Clipboard.getLocalType method.
source object The object to be copied, typically a subclass of BIM.Entity.
json string The JSON formatted string generated from the object to be sent to the clipboard.
cancel boolean A flag that allows you to cancel the event by setting to true.

If your application does cancel the copy request by setting the cancel property to true , you should provide some reasonable feedback in the UI so the user knows what happened. You can use either the PD.GlobalActions.showGeneralWarning or PD.GlobalActions.showTransientStatusMessage methods to do this, as shown in the example below.

CLIPBOARD_PASTE string !pd-clip-paste

A global event invoked when the framework pastes an entity or other created object from the clipboard.

This event is an opportunity for the UI to monitor and potentially intercept paste events and either manipulate the pasted data or cancel the event entirely.

The event handler is called with one argument, being an object with the following properties:

Property Type Description
source object The object about to be pasted, typically a subclass of BIM.Entity.
cancel boolean A flag that allows you to cancel the event by setting to true.

If your application does cancel the paste request by setting the cancel property to true , you should provide some reasonable feedback in the UI so the user knows what happened. You can use either the PD.GlobalActions.showGeneralWarning or PD.GlobalActions.showTransientStatusMessage methods to do this, as shown in the example below.

SHOW_WARNING string !pd-showWarning

A global event invoked when the model needs to display transitory warning text.

This event occurs when the framework needs to display a warning message to the user. The UI should respond by displaying a transient warning message with the given text. When the state argument is false, it indicates that the issue has been resolved and the corresponding transient warning message should be removed or hidden.

The event handler is called with a single string argument, being the warning message text to be displayed.

SHOW_MESSAGE string !pd-showMessage

A global event invoked when the model needs to display transitory message text.

This event occurs when the framework needs to display some general information to the user. The UI should respond by displaying a transient info message with the given text.

The event handler is called with one, two or three arguments. The first argument is a string containing the message to be displayed. The second argument is the preferred duration to display the message for, which defaults to 5000ms (5 seconds).

The third argument is also optional and indicates whether the message should replace the primary general message or just be added to the general message list. If a process just needs to issue a one-off notification, then it should either not include this argument or set it to false. This is because there may be several other asynchronous processes that are providing similar notifications and the user needs to be able to see them all. However, if a process is likely to generate multiple messages that need to supersede each other, then it should include this argument and set it to true.

CONFIRM string !pd-showConfirm

A global event invoked when the model wants the UI to display a prompt modal dialog.

This event occurs when the framework needs a Yes/No or OK/Cancel answer from the user. The UI should respond by displaying a modal dialog box with the given title and message. If the user selected Yes or OK, the callback method should be called. If the user cancels, the callback is not called.

The event handler is called with three arguments, the first being the action string to display as the title of the prompt, the second being the message string to display in the body of the dialog box, and the third being a callback function to be called if the user selects Yes/OK.

COPY_ELEM_DLG string !pd-copyElemDlg

A global event invoked when the model wants the UI to display the copy element modal dialog.

This event occurs during copy/paste and clone actions.

The event handler is called with a single argument, being an enumeration where a zero (0) value means duplicate the current selection, one (1) means paste from the internal clipboard and two (2) means paste from the system clipboard.

CANCEL_ACTION string !pd-cancelAction

A global event invoked when the user clicks the Cancel button next to the progress bar or pressed ESC key when the PD.GlobalState.progressBarValue is greater than zero.

The event handler is called with no arguments.

APP_IS_BUSY string !pd-appIsBusy

A global event invoked when an operation needs to indicate an application-wide busy state.

The event handler is called with a single boolean argument for setting (true) or clearing (false) the busy state.

LEGEND_DATA_RANGE string !pd-legendUpdate

A global event invoked when a legend needs all its data elements to update its extents.

This event typically occurs just before and just after an area-based calculation. It is used to update the legend from the data range values of all visible elements sharing that legend.

The event handler is called with two arguments, being the legend that needs to be updated and a { min, max } range object.

LEGEND_CHANGED string !pd-legendChanged

A global event invoked when the display properties of a legend have changed.

The event handler is called with a single argument, being the legend whose display properties were changed by the user.

SIDE_PANEL_PIN string !pd-sidePanelPin

A global event invoked when the side panel is pinned or unpinned.

The event handler is called with a single boolean argument, indicating whether the side panel is now pinned (true) or unpinned (false).

Author:
  • drajmarsh

FACET <static, readonly>

Enumerates the various roles that a polygon or facet plays within a shell.

The facetType property of PD.Polygon and PD.BRep.Face objects allows the framework to assign and identify the role different facets play within a shell or surface. For example, when searching for adjacent faces between spaces, this makes it possible to quickly ignore mitred and/or filleted faces at corners and edges as well as those inserted as the surrounds of apertures. It also allows applications to more quickly search for, update and/or replace only facets of a particular type.

Properties:
Name Type Default Description
HIDDEN number -1

Indicates that the facet should not be rendered by the element.

This is used to hide shell surfaces that have been visually replaced with an alternate, textured or other surface.

SURFACE number 0

A standard exposed surface of a shell.

EDGE number 1

Tags a facet as part of a chamfered, mitred or filleted edge.

JAMB number 2

Tags a facet as an extruded side, head or sill of an aperture within another facet.

FRAME number 3

Tags a facet as a window or door frame element.

GLASS number 4

Tags a facet as a window pane or glazing surface.

TOP number 5

Tags a facet as the top of an extrusion.

BOTTOM number 6

Tags a facet as the bottom of an extrusion.

BUMPY number 85

Indicates that a facet has been replaced with a rough and irregular surface texture, typically stone.

FOLIAGE number 90

Tags a facet as part of the leaf area of a plant or canopy area of a tree.

TRUNK number 91

Tags a facet as art of the stem of a plant or the trunk of a tree.

CLIP_EDGE number 100

Tags a vertical facet a generated when clipped to the level boundary.

These facets are created from the clipped edges of terrain and roof surfaces, and are tagged for inclusion in the spatial adjacency calculations.

CUT_FILL_AREA number 101

Tags a horizontal facet used for cut/fill volume determination in terrains.

These facets are created when the angle of repose is applied to internal ground and mass elements, and the level boundary.

Author:
  • drajmarsh

FACET_FLAGS <static, readonly>

Enumerates the various flags used by the PD.BRep.Face class.

NOTE: These are bitwise flags used to pack multiple booleans into a single value.

Properties:
Name Type Default Description
CHANGED number 1

Whether or not any contours have changed since last updated.

NOTE: This flag is not yet used but is reserved for future use.

IS_CURVED number 2

Whether or not the surface is curved with triangles already generated.

NO_OUTLINE number 4

Whether or not the facet should not display its outline(s) when meshed.

This flag may be used

Author:
  • drajmarsh

FILTER <static, readonly>

Enumerates which model features will be checked for interactive selection.

These are bitwise flags that can be combined for filtering interactive selection.

Properties:
Name Type Default Description
NONE number 0

A unique characterisation of an empty selection index.

These are also bit-wise flags that can be used to store multiple options in a single number property.

POINT number 1

Check to select the closest point on a path.

PATH number 2

Check to select the closest linear or curved segment.

FACE number 4

Check to select the closest intersected face.

SHELL number 8

Check to select the closest whole shell.

ALL number 15

Check to select everything.

checkPoints function

Determines whether the filter contain the POINT bit flag.

checkPaths function

Determines whether the filter contain the PATH bit flag.

checkFaces function

Determines whether the filter contain the FACE bit flag.

checkShells function

Determines whether the filter contain the SHELL bit flag.

Author:
  • drajmarsh

FIT <static, readonly>

Enumerates the different object/view fit levels.

This is primarily used by view managers to fit the camera to their contents.

Properties:
Name Type Default Description
CHECK number 0

Indicates a normal check for changed extents.

EXTENTS number 1

Indicates a deeper and more detailed check for changed extents.

VIEW number 2

Indicates a full check and fitting the view to visible objects.

Author:
  • drajmarsh

FORMAT <static, readonly>

Enumerates a range of numeric display formats.

You can use this object to display and parse values in the given format using its static methods.

Properties:
Name Type Default Description
NONE number -1

Value has no format.

DECIMAL number 0

Formatted as a decimal number, such as 25.64.

INTEGER number 1

Formatted as a integer number, such as 465.

ORDINAL number 2

Formatted as an ordinal with suffix, such as 1st, 2nd, 25th, etc.

PERCENTAGE number 3

Formatted as percentage where 0 to 1 equals 0% to 100%.

ANGLE number 4

Formatted as an angle in degrees.

RAD2DEG number 5

Converted and formatted from radians to an angle in degrees.

LENGTH number 6

Formatted as a dimension in the current units, such as 1250, 1.25, 4' 1" 3/16, etc.

LENGTH differs from DISTANCE and DIMENSION in that no units are appended to the displayed value.

DISTANCE number 7

Formatted as a distance in the current units, such as 1250mm, 1.25m, 4' 1" 3/16, etc.

DISTANCE differs from LENGTH in that it appends the current units abbreviation to the output. DISTANCE differs from DIMENSION in that it is always interpreted as an absolute value.

DIMENSION number 8

A special type of distance that parses and formats fractional values differently to absolute units.

DIMENSION differs from DISTANCE in that values between 0 and 1 are treated as fractional values relative to a reference length. For example, a ceiling height can be defined as 2400mm, or as 0.85 times the space height. DIMENSION differs from LENGTH in that it appends the current units abbreviation to the output.

METRES number 9

A special type of distance that is stored in metres rather than millimetres.

AREA number 10

Formats an area in square metres or square feet.

VOLUME number 11

Formats an area in cubic metres or cubic feet.

DURATION number 12

Formatted as a duration, such as 01:50 or -06:42.

TIME_ZONE number 13

Formatted as a time zone relative to UTC, such as +8:00 or -9:30.

TIME number 14

Formatted as a time of day in the range 0 to 24, such as 08:50 or 22:30`.

DATE number 15

Formatted as a day of the year in range 0 to 365/6, such as 01 Jan or 25 Jun.

BOOLEAN number 16

Formatted as a true/false value.

COLOR number 17

Formatted as a CSS colour string in the form '#RRGGBB'.

HEAT_FLUX_DENSITY number 18

Formatted as a value in either W/m2 or BTU/hr/ft2.

MILLISECONDS number 19

Formatted as a time value in milliseconds.

CONDUCTIVITY number 20

Formatted as a value in either W/(m-K) or BTU/(h-ft-F).

DENSITY number 21

Formatted as a value in either kg/m3 or lb/ft3.

SPECIFIC_HEAT number 22

Formatted as a value in either J/(kg-K) or BTU/(lb-F).

SIDES number 23

Formatted as a number of polygon sides, where <3 is 'Any'.

_MAX number 24

Defines the maximum allowable format number.

toString function

Format the given value as a string.

fromString function

Parses a string to a value in the given format, or a format type.

asDecimal function

Format the given value as an decimal number string.

asInteger function

Format the given value as an integer string.

asOrdinal function

Format the given value as an ordinal string, such as 1st, 2nd, 3rd, etc.

asPercentage function

Format the given value as a percentage string.

asAngle function

Format the given value in degrees as an angle string.

asRadiansToDegrees function

Format the given value in radians as an angle string in degrees.

asDimension function

Format the given value as a dimension string without units.

asDistance function

Format the given value as a distance string with units.

asMetres function

Format the given value as a distance string in either metres or feet.

asDuration function

Format the given value as a time duration string.

asTimeZone function

Format the given value as a time-zone offset string.

asTime function

Format the given value as a 24Hr time string.

asDate function

Format the given value as a date string.

asBoolean function

Format the given value as a boolean string.

asColor function

Format the given value as a CSS color string in the form '#RRGGBB'.

asHeatFluxDensity function

Format the given heat flux density value in W/m2 or Btu/hr/ft2.

asMilliseconds function

Format the given value in milliseconds with a 'ms' suffix.

asThermalConductivity function

Format the given thermal conductivity value as W/(m-K) or BTU/(h-ft-F).

asDensity function

Format the given density value as kg/m3 or lb/ft3.

asSpecificHeat function

Format the given specific heat value as J/(kg-K) or BTU/(lb-F).

Author:
  • drajmarsh
Example
PD.FORMAT.toString(PD.FORMAT.TIME, 15.75); // Result: '15:45'
const time_of_day = PD.FORMAT.parseString(PD.FORMAT.DATE, '15:45'); // Result: 15.75
PD.FORMAT.toString(PD.FORMAT.DATE, 91); // Result: '01Apr'
const day_of_year = PD.FORMAT.parseString(PD.FORMAT.DATE, '01Apr'); // Result: 91

const type_str = PD.FORMAT.toString(PD.FORMAT.PERCENTAGE); // Result: 'PERCENTAGE'
const type PD.FORMAT.fromString(type_str); // Result: 3 (PD.FORMAT.PERCENTAGE)

:boolean

FORWARD <static>

An alias for false to make some polygon/polyline method calls more readable.

Type
  • boolean

GRID <static, readonly>

Enumerates the types of grid distribution.

Properties:
Name Type Default Description
REGULAR number 0

Distributes grid points orthogonally over an area.

HEXAGON number 1

Distributes grid points using a hexagonal grid.

Author:
  • drajmarsh

:object

GlobalStateProxy <static>

This is a proxy to the application state properties in PD.GlobalState. By default this is a direct reference to PD.GlobalState, however front-end frameworks can reassign this to create a reactive/observable version.

Type
  • object

:object

GlobalViewProxy <static>

This is a proxy to the application view properties in PD.GlobalView. By default this is a direct reference to PD.GlobalView, however front-end frameworks can reassign this to create a reactive/observable version.

Type
  • object

HUMIDITY_RATIO <static, readonly>

Provides tools to convert between different humidity ratio units.

Properties:
Name Type Default Description
KILOGRAMS_PER_KILOGRAM number 120

The identifier for kilograms of water per kilogram of dry air (kg/kg).

GRAMS_PER_KILOGRAM number 121

The identifier for grams of water per kilogram of dry air (g/kg).

POUNDS_PER_POUND number 122

The identifier for pounds of water per pound of dry air (lb/lb).

GRAINS_PER_POUND number 123

The identifier for grains of water per pound of dry air (gr/lb).

toKilogramsPerKilogram function

Converts a humidity ratio value from the given units to Celsius.

fromKilogramsPerKilogram function

Converts a humidity ratio value in kilograms per kilogram to the given units.

convertBetween function

Converts a humidity ratio value between the two given units.

getName function

Retrieves the name of the given humidity ratio units.

Based on the given units, this method returns one of the following string values: 'Kilograms per Kilogram', 'Grams per Kilogram', 'Pounds per Pound' or 'Grains per Pound'.

getAbbrev function

Retrieves the abbreviation of the given humidity ratio units.

Based on the given units, this method returns one of the following string values: 'kg/kg', 'g/kg', 'lb/lb' or 'gr/lb';

getUnitsFromAbbrev function

Retrieves the humidity ratio units identifier from the given abbreviation.

Parses the abbreviations 'kg/kg', 'g/kg', 'lb/lb' or 'gr/lb' into the appropriate unit ID,

Author:
  • drajmarsh

JOIN <static, readonly>

Enumerates the different types of joints between path segments.

Properties:
Name Type Default Description
INLINE number -1

Defines a colinear join that does not change direction.

This line type does not need or use any control data.

LINEAR number 0

Join to next point with a straight lines.

This line type does not need or use any control data.

CHAMFER number 1

Joins incoming and outgoing lines with a straight chamfer.

The size of the chamfer is controlled by either the join size or offset attribute value. If set, the size value will override an offset value when calculating the chamfer. When updated, these joins will add an inConnect point property to the attrib object storing the start position of the chamfer and an outConnect point property for its end.

Always use the getInPos() and getOutPos() methods to obtain the connection points of a joint, which will automatically use inConnect and outConnectwhenever appropriate.

FILLET number 2

Join incoming and outgoing lines with a circular fillet.

The radius of the fillet is governed by the radius attribute value. When updated, these joins will add 'radius and center point properties to the attrib object, as well as inConnect to indicate the start of the fillet and outConnect for the end.

Always use the getInPos() and getOutPos() methods to obtain the connection points of a joint, which will automatically use inConnect and outConnectwhenever appropriate.

ARC number 3

Join the previous and next points with an arc that passes through this point.

The center and radius of the arc are calculated automatically to pass through this point as well as the in and out connections of the previous and next. When updated, these joins will add 'radius and center point properties to the attrib object, as well as inConnect to indicate the start of the fillet and outConnect for the end.

Always use the getInPos() and getOutPos() methods to obtain the connection points of a joint, which will automatically use inConnect and outConnectwhenever appropriate.

BEZIER number 4

Join the previous and next points with a Bezier curve that passes through this point.

The nature of the resulting curve is governed by the presence or absence of incoming and outgoing control points, as well as the isSmooth and/or isSymmetrical properties of each involved joint.

BSPLINE number 5

Sets this join as a B-Spline curve control point.

_MAX number 5

The maximum allowed value.

toString function

Converts a join type value to a string identifier.

fromString function

Parses a string into a valid join type value.

Author:
  • drajmarsh

KEY <static, readonly>

Enumerates the keyboard keys that control increment/decrement values.

Properties:
Name Type Default Description
NONE number 0

Applies a minor increment to the value, typically 5 * step.

SHIFT number 16

Applies a major increment to the value, typically 50 * step.

CONTROL number 17

Applies the smallest step increment to the value.

Author:
  • drajmarsh

MANIPULATOR <static, readonly>

Enumerates the different cursor manipulator types.

Properties:
Name Type Default Description
BOX number 0

A simple box manipulator.

       +----------+
      /          /|
     +----------+ |
     |          | |
     |          | +
     |          |/
     +----------+
MARKER number 1

A simple diamond marker manipulator.

            _+_
          _/  \\_
        _/     \ \_
      _/        \  \_
     +-----------+---+
      \_        /  _/
        \_     / _/
          \_  /_/
            '+'
SQUARE number 2

A square drag indicator located at the center of the cursor.

      + - - - - - - - - - - - - - +
      :                           :
      :                           :
      :                           :
      :             |             :
      :          ---x---          :
      :             |             :
      :                           :
      :                           :
      :                           :
      + - - - - - - - - - - - - - +
ARROW number 3

A directional arrow drag indicator offset by a vector from the cursor.

               6
               : =
               :    =
       3- - - -2       =
       :      /:          =
       :     / :             =
       :    /  :    |           =
       :   /   ; ---X---           5
       :  /    :    |           =
       : /     :             =
       :/      :          =
       0- - - -1       =
               :    =
               : =
               4
TOUCH number 4

An simple circle drag indicator offset from the cursor for touch-based manipulation.

              , - ~ ' ~ - ,
          , '               ' ,
        ,                       ,
       ,                         ,
      ,             |             ,
      ,          ---x---          ,
      ,             |             ,
       ,                         ,
        ,                       ,
          ,                  , '
            ' - , _ _ _ ,  '
SPIKED number 5

A spiked circle center drag indicator located at the center of a rect/box cursor.

                    +
                   / \
              , - '   ' - ,
          , '               ' ,
        ,         _ = _         ,
       ,      _ '       ' _      ,
   __-'      .      |      .      '-__
 * __       =    ---x---    =       __ *
     ',      '_     |     _'      ,'
       ,       . _     _ .       ,
        ,          '='          ,
          ,                  , '
            ' - , _   _ , - '
                   \ /
                    +
SECTION number 6

An arrow-on-a-circle drag indicator for manipulating section planes/lines, located at the center of the cursor.

                    +
                    : =
                    :    =
              , - ~ : ~ - , =
          , '       :       ' ,
        ,           :           ,=
       ,            :            , =
      ,             |             ,  =
      ,          ---x---          ,     +
      ,             |             ,  =
       ,            :            , =
        ,           :           ,=
          ,         :        , '
            ' - , _ : _ ,  '=
                    :    =
                    : =
                    +
ROTATOR number 7

A large circular rotation indicator oriented on an axis and located at the center of the cursor.

Author:
  • drajmarsh

MODE <static, readonly>

Enumerates the types of interactive user edit modes.

Properties:
Name Type Default Description
NONE number 0

Completely disable interaction.

EDIT number 1

Click-select and edit elements on the model.

ADD number 2

Add path points and junctions to a new element.

MEASURE number 3

Allow user to position and drag a dimension line.

RECT number 4

Allow user to position and drag the background image or a ground grid.

MOVE number 5

Translate the current selection set.

ROTATE number 6

Rotate the current selection set.

SCALE number 7

Scale the current selection set.

ORIGIN number 8

Set the position of an arbitrary point within the model.

SHELL number 9

Select and edit PD.Shell geometry.

DRAG_DROP number 10

Interactively drag elements and components over the top of other elements and components.

WORK_PLANE number 11

Interactively position and orient a temporary working plane.

CAPTURE number 100

Captures all user interaction in the model canvas.

Author:
  • drajmarsh

MOUSE_BTN <static>

Enumerates the different types of mouse/pointer button.

Properties:
Name Type Description
NONE number

No mouse/pointer button pressed.

LEFT number

The left/primary mouse/pointer button pressed.

MIDDLE number

The middle/secondary mouse/pointer button pressed.

RIGHT number

The right/tertiary mouse/pointer button pressed.

Author:
  • drajmarsh

:boolean

OPEN <static>

An alias for false to make some polygon/polyline method calls more readable.

Type
  • boolean

PATH <static, readonly>

Enumerates the different default shapes for interactive path generation.

Properties:
Name Type Default Description
POLYGONAL number 0

The path is generated by linking each point with linear segments.

RECTANGULAR number 1

The path is generated by creating a rectangle between two points.

CIRCULAR number 2

The path is generated by creating a circle between two points.

Author:
  • drajmarsh

POINT_FLAGS <static, readonly>

Enumerates the various flags used by points and curves within a path.

NOTE: These are bitwise flags used to pack multiple booleans into a single value.

As a building model is very likely to contain many thousands of path points being able to store multiple boolean settings in a single integer is at least a small saving. It also helps a little when undoing, redoing and copying.

Properties:
Name Type Default Description
CHANGED number 1

Whether the junction's properties have changed since last update.

CONCAVE number 2

Whether the cross-product is inverted compared to others in the path.

VIRTUAL number 4

Whether the junction was added dynamically rather than manually by the user.

VARIABLE_WIDTH number 8

Whether material changes are gradual or sudden (step).

COLINEAR number 16

Whether or not the junction is colinear with its previous and next path points.

EXTERNAL number 32

Whether or not the junction's segment is adjacent to the outside.

SMOOTH number 128

Whether or not the junction's curve maintains a smooth change in direction.

When set to true, any curve will smoothly transition the path direction using control points that can only move along the tangent between incoming and outgoing vectors. When false, control points can move unrestricted.

SYMMETRIC number 256

Whether or not the magnitude of smooth control points are reflected equally.

FILLET number 512

Whether or not to truncate acute angles using a fillet instead of a mitre.

END_PLANE number 1024

Whether or not the junction starts/end at a specific plane when part of an open path.

When set to true, any path generation will check the in/out vector and use it to generate an end plane to intersect offset profiles with.

Author:
  • drajmarsh

POLY_FLAGS <static, readonly>

Enumerates the various flags used in polylines, polyloops and polygons, as well as their path subclasses.

NOTE: These are bitwise flags used to pack multiple booleans into a single value.

As a building model is very likely to contain thousands of paths, lines and loops, being able to store multiple boolean settings in a single integer is at least a small saving. It also helps a little when undoing and copying.

Properties:
Name Type Default Description
CHANGED number 1

Whether or not any contours have changed since last updated.

CLOSED number 2

Whether or not each contour line loops back to its starting vertex.

POLYGON number 4

Whether or not the contours form a single closed polygon with holes.

RECT number 8

Whether or not the polygon is rectilinear.

PLANAR number 16

Whether or not all vertices lie in the same plane.

CURVED number 32

Whether or not the surface is curved with triangles already generated.

CHANGING number 64

Whether or not the polygon is currently being dynamically edited.

OUTLINE number 128

Whether or not the polygon should include any outline(s) when meshed.

SURFACE number 256

Whether or not the polygon should include any surface(s) when meshed.

VERTICAL number 512

Whether or not to keep the plane normal and up-vector always vertical.

CONCAVE number 1024

Whether or not any part of the polyline is concave.

ATTRIB number 2048

Whether or not the polyline needs its attributes updated.

HAS_CURVES number 4096

Whether or not a path has one or more curved segments.

Author:
  • drajmarsh

PREFIX <static, readonly>

Enumerates the various units prefixes.

Units prefixes are applied to very large or very small values to make them more human-readable. Examples of prefixes are MegaWatts (MW: 1,000,000 Watts), Kilometres (km: 1000 metres), millimetre (mm: 1e-3 metres) and PicoOhm (po: 1e-12 Ohm). This utility class provided an enumeration and some static methods for handling such prefixes.

Properties:
Name Type Default Description
PETA number 7

The identifier for 1e15.

TERA number 6

The identifier for 1e12.

GIGA number 5

The identifier for 1e9.

MEGA number 4

The identifier for 1e6.

KILO number 3

The identifier for 1e3.

HECTO number 2

The identifier for 100.

DECA number 1

The identifier for 10.

NONE number 0

The identifier for no prefix.

DECI number -1

The identifier for 0.1.

CENTI number -2

The identifier for 0.01.

MILLI number -3

The identifier for 1e-3.

MICRO number -4

The identifier for 1e-6.

NANO number -5

The identifier for 1e-9.

PICO number -6

The identifier for 1e-12.

FEMTO number -7

The identifier for 1e-15.

getScaleFactor function

Returns the scale factor for units with the given prefix.

const scale = PD.PREFIX.getScaleFactor(PD.PREFIX.NANO);

The prefix argument is an integer value, as follows:

No. Prefix Name Factor
7 Peta (P) PD.PREFIX.PETA 1e-15
6 Tera (T) PD.PREFIX.TERA 1e-12
5 Giga (G) PD.PREFIX.GIGA 1e-9
4 Mega (M) PD.PREFIX.MEGA 1e-6
3 Kilo (k) PD.PREFIX.KILO 1e-3
2 Hecto (h) PD.PREFIX.HECTO 1e-2
1 Deca (da) PD.PREFIX.DECA 1e-1
0 None PD.PREFIX.NONE 1.0
-1 Deci (d) PD.PREFIX.DECI 1e1
-2 Centi (c) PD.PREFIX.CENTI 1e2
-3 Milli (m) PD.PREFIX.MILLI 1e3
-4 Micro (μ) PD.PREFIX.MICRO 1e6
-5 Nano (n) PD.PREFIX.NANO 1e9
-6 Pico (p) PD.PREFIX.PICO 1e12
-7 Femto (f) PD.PREFIX.FEMTO 1e15
toString function

Returns the prefix string for units with the given prefix.

const units = 'W/h';
const value = 2322319362.6;
const prefix = PD.PREFIX.GIGA;
const scale = PD.PREFIX.getScaleFactor(prefix);
console.log((scale * value).toFixed(3) + ' ' + PD.PREFIX.toString(prefix) + units);
>> "2.322 GW/h"

The prefix argument is an integer value, as follows:

No. Prefix Name Factor
7 Peta (P) PD.PREFIX.PETA 1e-15
6 Tera (T) PD.PREFIX.TERA 1e-12
5 Giga (G) PD.PREFIX.GIGA 1e-9
4 Mega (M) PD.PREFIX.MEGA 1e-6
3 Kilo (k) PD.PREFIX.KILO 1e-3
2 Hecto (h) PD.PREFIX.HECTO 1e-2
1 Deca (da) PD.PREFIX.DECA 1e-1
0 None PD.PREFIX.NONE 1.0
-1 Deci (d) PD.PREFIX.DECI 1e1
-2 Centi (c) PD.PREFIX.CENTI 1e2
-3 Milli (m) PD.PREFIX.MILLI 1e3
-4 Micro (μ) PD.PREFIX.MICRO 1e6
-5 Nano (n) PD.PREFIX.NANO 1e9
-6 Pico (p) PD.PREFIX.PICO 1e12
-7 Femto (f) PD.PREFIX.FEMTO 1e15
Author:
  • drajmarsh

PREFIX <static, readonly>

Enumerates the various units prefixes.

Units prefixes are applied to very large or very small values to make them more human-readable. Examples of prefixes are MegaWatts (MW: 1,000,000 Watts), Kilometres (km: 1000 metres), millimetre (mm: 1e-3 metres) and PicoOhm (po: 1e-12 Ohm). This utility class provided an enumeration and some static methods for handling such prefixes.

Properties:
Name Type Default Description
PETA number 7

The identifier for 1e15.

TERA number 6

The identifier for 1e12.

GIGA number 5

The identifier for 1e9.

MEGA number 4

The identifier for 1e6.

KILO number 3

The identifier for 1e3.

HECTO number 2

The identifier for 100.

DECA number 1

The identifier for 10.

NONE number 0

The identifier for no prefix.

DECI number -1

The identifier for 0.1.

CENTI number -2

The identifier for 0.01.

MILLI number -3

The identifier for 1e-3.

MICRO number -4

The identifier for 1e-6.

NANO number -5

The identifier for 1e-9.

PICO number -6

The identifier for 1e-12.

FEMTO number -7

The identifier for 1e-15.

getScaleFactor function

Returns the scale factor for units with the given prefix.

const scale = PD.PREFIX.getScaleFactor(PD.PREFIX.NANO);

The prefix argument is an integer value, as follows:

No. Prefix Name Factor
7 Peta (P) PD.PREFIX.PETA 1e-15
6 Tera (T) PD.PREFIX.TERA 1e-12
5 Giga (G) PD.PREFIX.GIGA 1e-9
4 Mega (M) PD.PREFIX.MEGA 1e-6
3 Kilo (k) PD.PREFIX.KILO 1e-3
2 Hecto (h) PD.PREFIX.HECTO 1e-2
1 Deca (da) PD.PREFIX.DECA 1e-1
0 None PD.PREFIX.NONE 1.0
-1 Deci (d) PD.PREFIX.DECI 1e1
-2 Centi (c) PD.PREFIX.CENTI 1e2
-3 Milli (m) PD.PREFIX.MILLI 1e3
-4 Micro (μ) PD.PREFIX.MICRO 1e6
-5 Nano (n) PD.PREFIX.NANO 1e9
-6 Pico (p) PD.PREFIX.PICO 1e12
-7 Femto (f) PD.PREFIX.FEMTO 1e15
toString function

Returns the prefix string for units with the given prefix.

const units = 'W/h';
const value = 2322319362.6;
const prefix = PD.PREFIX.GIGA;
const scale = PD.PREFIX.getScaleFactor(prefix);
console.log((scale * value).toFixed(3) + ' ' + PD.PREFIX.toString(prefix) + units);
>> "2.322 GW/h"

The prefix argument is an integer value, as follows:

No. Prefix Name Factor
7 Peta (P) PD.PREFIX.PETA 1e-15
6 Tera (T) PD.PREFIX.TERA 1e-12
5 Giga (G) PD.PREFIX.GIGA 1e-9
4 Mega (M) PD.PREFIX.MEGA 1e-6
3 Kilo (k) PD.PREFIX.KILO 1e-3
2 Hecto (h) PD.PREFIX.HECTO 1e-2
1 Deca (da) PD.PREFIX.DECA 1e-1
0 None PD.PREFIX.NONE 1.0
-1 Deci (d) PD.PREFIX.DECI 1e1
-2 Centi (c) PD.PREFIX.CENTI 1e2
-3 Milli (m) PD.PREFIX.MILLI 1e3
-4 Micro (μ) PD.PREFIX.MICRO 1e6
-5 Nano (n) PD.PREFIX.NANO 1e9
-6 Pico (p) PD.PREFIX.PICO 1e12
-7 Femto (f) PD.PREFIX.FEMTO 1e15
Author:
  • drajmarsh

PRESSURE <static, readonly>

Provides tools to convert between different pressure units.

Properties:
Name Type Default Description
PASCAL number 130

The identifier for Pascal (Pa).

KILOPASCAL number 131

The identifier for kilo-Pascal (Pa).

MILLIMETERS_MERCURY number 132

The identifier for millimeters of mercury (mmHg).

INCHES_MERCURY number 133

The identifier for inches of mercury (inHg).

POUNDS_PER_SQUARE_INCH number 134

The identifier for pounds per square inch (Psi).

ATMOSPHERES number 135

The identifier for Atmospheres (atm).

BAR number 136

The identifier for barometric pressure (bar).

toPascal function

Converts a pressure value from the given units to Pascal (Pa).

fromPascal function

Converts a temperature value in Pascal to the given units.

convertBetween function

Converts a pressure value between the two given units.

getName function

Retrieves the name of the given humidity ratio units.

Based on the given units, this method returns one of the following string values: 'Pascal', 'kilo-Pascal', 'Millimeters Mercury', 'Inches Mercury', 'Pounds Force Per Square Inch', 'Atmospheres' or 'Bar'.

getAbbrev function

Retrieves the abbreviation of the given humidity ratio units.

Based on the given units, this method returns one of the following string values: 'Pa', 'kPa', 'mmHg', 'inHg', 'Psi', 'atm', 'bar'.

getUnitsFromAbbrev function

Retrieves the pressure units identifier from the given abbreviation.

Parses the abbreviations 'Pa', 'kPa', 'mmHg', 'inHg', 'Psi', 'atm', 'bar' into the appropriate unit ID,

Author:
  • drajmarsh

PRIMITIVE <static, readonly>

Enumerates different types of WebGL primitives.

These are used by some mesh builder functions to help create complex geometry by simulating immediate mode that used to be available in legacy OpenGL. The PD.PolyMesh and PD.MeshBuilder classes provide an API that uses these primitive types to interpret vertex data in different ways.

See the PD.PolyMesh begin() method for more details on how to use these values and their vertex ordering requirements.

Properties:
Name Type Default Description
POINTS number 0

Treats each vertex as an independent point in space.

    0               1
    +               +

    +
    3
                +
                2
LINES number 1

Treats each pair of vertices as an independent line segment.

    0               1
    +---------------+

    +__
    3  ''--__
             ''-+
                2
LINE_LOOP number 2

Draws a connected group of line segments from the first vertex to the last, then back to the first.

    0               1
    +---------------+
    |              /
    +__           /
    3  ''--__    /
             ''-+
                2
LINE_STRIP number 3

Draws a connected group of line segments from the first vertex to the last.

    0               1
    +---------------+
                   /
    +__           /
    3  ''--__    /
             ''-+
                2
TRIANGLES number 4

Treats each triplet of vertices as an independent triangle.

    1     3     5
    +     +--<--+         A: 0,1,2
    |\_    \_ B |         B: 3,4,5
    |  \_    \_ |
    | A  \     \|
    +--<--+     +
    0     2     4
TRIANGLE_STRIP number 5

Creates a new triangle from each incremental triplet. When ordering vertices, all the odd vertices run along one edge and even vertices the other.

    1     3     5     7
    +-->--+-->--+---  +   A: 0,1,2
    |\_ B |\_ D |\_       B: 2,1,3
    |  \_ |  \_ |  \      C: 2,3,4
    | A  \| C  \|         D: 4,3,5
    +--<--+--<--+---  +
    0     2     4     6
TRIANGLE_FAN number 6

Creates triangles that fan out from a central point. A new triangle is created linking each each incremental pair to the very first vertex.

    2     3     4
    +-->--+-->--+         A: 0,1,2
    |\_ B | C _/|         B: 0,2,3
    |  \_ | _/  |         C: 0,3,4
    | A  \|/  D |         D: 0,4,5
    +--<--+--<--+
    1     0     5
QUADS number 7

Converts each quadruplet into two connected triangles. Each group of four vertices must run counter clockwise around the perimeter of the quad.

    1     2     5     6
    +-->--+     +-->--+   A: 0,1,2
    | A _/|     | C _/|   B: 2,3,0
    | _/  |     | _/  |   C: 4,5,6
    |/  B |     |/  D |   D: 6,7,4
    +--<--+     +--<--+
    0     3     4     7
QUAD_STRIP number 8

Converts a strip of connected quads into a triangle strip. Vertex ordering is the same as a triangle strip, where odd vertices run along one edge and even vertices the other.

    1     3     5     7
    +-->--+-->--+---  +   A: 0,1,2
    |\_ B |\_ D |\_       B: 2,1,3
    |  \_ |  \_ |  \      C: 2,3,4
    | A  \| C  \|         D: 4,3,5
    +--<--+--<--+---  +
    0     2     4     6
Author:
  • drajmarsh

PROJECTION <static, readonly>

Enumerates different types of 2D sun-path diagram projections.

These refer to some standard equations for converting 3D altitude angles to radius values within a 2D polar chart. The different methods allow the detail at the zenith or the horizon to be emphasised, or all altitudes equally.

Properties:
Name Type Default Description
SPHERICAL number 0

The enumeration for a spherical polar projection.

This projection corresponds to the 'Orthographic' projection described at https://en.wikipedia.org/wiki/Stereographic_projection.

EQUIDISTANT number 1

The enumeration for an equidistant polar projection.

This projection simply divides the polar diagram radius into divisions of equal altitude.

STEREOGRAPHIC number 2

The enumeration for a stereographic polar projection.

This projection corresponds to the 'Stereographic' projection described at https://en.wikipedia.org/wiki/Stereographic_projection.

Author:
  • drajmarsh

RECT_MODE <static, readonly>

Enumerates the types of interactive rectangle edit modes.

Properties:
Name Type Default Description
IMAGE number 0

Edits the extents of the background image.

GRID number 1

Edits the extents of the background grid.

SURFACE number 2

Edits the extents of a selected rectangular surface.

Author:
  • drajmarsh

:boolean

REVERSE <static>

An alias for true to make some polygon/polyline method calls more readable.

Type
  • boolean

SCHEDULE <static>

Stores a range of schedule and profile enumerations.


SELECT <static, readonly>

Enumerates different types of sub-item selection methods.

Properties:
Name Type Default Description
ANY number 0

Select any sub-item, typically the first matching item.

CLOSEST number 1

Select the closest sub-item, typically to the selection ray origin.

FARTHEST number 2

Select the farthest sub-item, typically from the selection ray origin.

ALL number 3

Select all matching sub-items.

Author:
  • drajmarsh

SELECTED <static, readonly>

Enumerates the type of model feature that a selection set contains.

Properties:
Name Type Default Description
NONE number 0

Nothing is selected.

BBOX number 1

The bounding box extents of an element is selected.

SHELL number 2

The PD.Shell of a model element is selected.

SHELL_FACET number 3

A PD.Polygon facet of a PD.Shell is selected.

SHELL_EDGE number 4

An edge between two PD.Polygon facets of a PD.Shell is selected.

VERTEX number 5

One or more PD.Point vertices within a PD.Shell are selected.

BREP number 6

The PD.BRep of a model element is selected.

BREP_FACE number 7

A Face within the PD.BRep of a model element is selected.

BREP_EDGE number 8

An edge within the PD.BRep of a model element is selected.

BREP_VERTEX number 9

A vertex within the PD.BRep of a model element is selected.

ELEMENT number 10

The BIM.Path of a model BIM.Element is selected.

JUNCTION number 11

A BIM.Junction within the BIM.Path of a model BIM.Element is selected.

SEGMENT number 12

A linear or curved segment within the BIM.Path of a model BIM.Element is selected.

APERTURE number 13

A BIM.Aperture within a BIM.Junction or BIM.Surface is selected.

NODE number 14

A curve control node is selected.

LEVEL number 20

A BIM.Level within a BIM.Structure.

STRUCTURE number 21

A BIM.Structure within a BIM.Project.

isTransient function

Determines if the current selection is transient or not.

Transient selections only appear for a short time and fade away so as not to interfere with interactive selections. For example, if you select an element on a different level to the current level, a transient level selection appears while the model transitions the selected level to become the current level, and then disappears to allow you to select things on the new current level.

isJunctionOrSegment function

Determines if the current selection is equal to either PD.SELECTED.JUNCTION or PD.SELECTED.SEGMENT.

toString function

Format the given value as a string.

Author:
  • drajmarsh

SELECTION <static>

Enumerates the different selection types.

This enumerator is typically filled out by PD.SelectionHandler class instances when they are enabled by the host application.

Properties:
Name Type Description
NONE number

No selection.

STRUCTURE number

When a BIM.Structure is selected.

LEVEL number

When a BIM.Level is selected.

ELEMENT number

When a BIM.Element is selected.

Author:
  • drajmarsh

SELECT_ACTION <static, readonly>

Enumerates whether items that are interactively selected will replace, be added to, removed from or toggled within the current selection set.

Properties:
Name Type Default Description
REMOVE number -1

Interactive selection removes from the existing selection set.

REPLACE number 0

Interactive selection replaces the existing selection set.

ADD number 1

Interactive selection is added to the existing selection set.

TOGGLE number 2

The state of items Interactive selection. Interactive selection is added to the existing selection set.

Author:
  • drajmarsh

SIDE <static, readonly>

Enumerates the different sides of a entity.

Properties:
Name Type Default Description
NONE number -99

Stick rigidly to line/plane without projection or offset.

INSIDE number -1

The side opposite to the direction of the surface normal or the inner surface/plane.

MIDDLE number 0

The actual line of the path or face of the center surface/plane.

OUTSIDE number 1

The side in the direction of the surface normal or the outer surface/plane.

getParamType function

Retrieve side types as a PD.ParamType from global cache.

Author:
  • drajmarsh

SKYDOME <static>

Enumerates different methods for subdividing the sky dome into patches.

There are many ways to subdivide the surface of a sphere into a series of discrete areas. The values defined here represent some of the commonly used standards for subdividing a hemispherical sky dome into analysis patches.

Properties:
Name Type Description
EQUAL_ANGLE number

The equal-angle method divides the sky into equal azimuth and altitude angles, which means that segmentation is denser towards the zenith.

EQUAL_AREA number

The equal-area method tries to keep all segments as close as possible to the same solid angle by varying the number within each altitude band.

TREGENZA number

The Reinhart/Tregenza method first generates 145 equal area sky patches and then further subdivides them to obtain the required angle.

GEODESIC number

The Geodesic method progressively subdivides icosahedral triangles into smaller triangles and projects them onto the sky dome.

Author:
  • drajmarsh

SKY_TYPE <static>

Enumerates the different standard general all-weather sky types.

Properties:
Name Type Description
NONE number

NO SKY DISTRIBUTION.

SKY_01 number

Standard Overcast Sky.

SKY_02 number

Overcast, steep grade, some Sun.

SKY_03 number

Overcast, moderate grade, no Sun.

SKY_04 number

Overcast, moderate grade, some Sun.

SKY_05 number

Standard Uniform Sky.

SKY_06 number

Partly cloudy, no grade, some Sun.

SKY_07 number

Partly cloudy, no grade, more Sun.

SKY_08 number

Partly cloudy, no grade, distinct corona.

SKY_09 number

Partly cloudy, obscured Sun.

SKY_10 number

Partly cloudy, circumsolar region.

SKY_11 number

White-blue sky, distinct corona.

SKY_12 number

Standard Clear Sky, low turbidity.

SKY_13 number

Standard Clear Sky, some pollution.

SKY_14 number

Cloudless turbid sky, broad corona.

SKY_15 number

White-blue turbid sky, broad corona.

SKY_16 number

Traditional Overcast Sky.

WEATHER number

FROM WEATHER DATA.

Author:
  • drajmarsh

SNAP <static, readonly>

Enumerates the various object snap options.

Properties:
Name Type Default Description
NONE number 0

Completely disable snapping.

GRID number 1

Snap to the current grid.

POINTS number 2

Snap to other vertices on the currently selected path.

MIDPOINTS number 4

Snap to the mid-point of line segments in the currently selected path.

LINES number 8

Snap to the closest point on line segments in the currently selected path.

DIAGONALS number 16

Snap when at a 45 degree angle to adjacent vertices on the currently selected path.

HOVER number 32

Snap to the closest point beneath the pointer when dragging.

PATH number 64

Snap to nearest 90 degrees increment from previous/next junction in path.

ALL number 127

Snap to vertices, mid-points and 45deg angles.

Author:
  • drajmarsh

SPECIFIC_VOLUME <static, readonly>

Provides tools to convert between different specific volume units.

Properties:
Name Type Default Description
CUBIC_METERS_PER_KILOGRAM number 140

The identifier for cubic meters per kilogram (m3/kg).

CUBIC_FEET_PER_POUND number 141

The identifier for cubic feet per pound (ft3/lb).

toCubicMetersPerKilogram function

Converts a specific volume value to cubic meters per kilogram (m3/kg).

fromCubicMetersPerKilogram function

Converts a specific volume value from cubic meters per kilogram (m3/kg).

convertBetween function

Converts a pressure value between the two given units.

getName function

Retrieves the name of the given specific volume units.

Based on the given units, this method returns one of the following string values: 'Cubic Meters per Kilogram' or 'Cubic Feet per Pound'.

getAbbrev function

Retrieves the abbreviation of the given specific volume units.

Based on the given units, this method returns one of the following string values: 'm3/kg' or 'ft3/lb'.

getUnitsFromAbbrev function

Retrieves the specific volume units identifier from the given abbreviation.

Parses the abbreviations 'm3/kg' or 'ft3/lb' into the appropriate unit ID,

Author:
  • drajmarsh

TEMPERATURE <static, readonly>

Provides tools to convert between different temperature units.

Properties:
Name Type Default Description
CELSIUS number 0

The identifier for degrees Celsius (°C).

FAHRENHEIT number 1

The identifier for degrees Fahrenheit (°F).

RANKINE number 2

The identifier for degrees Rankine (°R).

KELVIN number 3

The identifier for degrees Kelvin (K).

toCelsius function

Converts a temperature value from the given units to Celsius.

fromCelsius function

Converts a temperature value in Celsius to the given units.

convertBetween function

Converts a temperature value between the two given units.

getName function

Retrieves the name of the given temperature units.

Based on the given units, this method returns one of the following string values: 'Celsius', 'Fahrenheit', 'Rankine' or 'Kelvin'.

getAbbrev function

Retrieves the abbreviation of the given temperature units.

Based on the given units, this method returns one of the following string values: '°C', '°F', '°R' or 'K'.

getUnitsFromAbbrev function

Retrieves the temperature units identifier from the given abbreviation.

Interprets the abbreviations '°C'/'degC', '°F''degF', '°R'/'degR' or 'K' into the identifiers CELSIUS | FAHRENHEIT | RANKINE | KELVIN.

Author:
  • drajmarsh
Example
const kelvin = PD.TEMPERATURE.convertBetween(83.48, PD.TEMPERATURE.FAHRENHEIT, PD.TEMPERATURE.KELVIN);
console.log(kelvin); // = 301.75

/// Convert values to degrees Celsius.
const c1 = PD.TEMPERATURE.toCelsius(61.7, PD.TEMPERATURE.FAHRENHEIT);
const c2 = PD.TEMPERATURE.toCelsius(95.0, PD.TEMPERATURE.FAHRENHEIT);
console.log(c1, c2); // = 16.5, 35.0

/// Assign a new value from degrees Celsius.
const f1 = new PD.TEMPERATURE.fromCelsius(0.0, PD.TEMPERATURE.FAHRENHEIT);
const units_abbrev = PD.TEMPERATURE.getAbbrev(PD.TEMPERATURE.FAHRENHEIT);
console.log(f1.toFixed(1) + units_abbrev; // '32.0°F'.

:URLSearchParams

URLParams <static, readonly>

Allows access to any parameters appended to the page URL.

This uses URLSearchParams which is supported by all the evergreen browsers, other than Internet Explorer.

Type
  • URLSearchParams
Author:
  • drajmarsh

VELOCITY <static>

Provides tools to convert between velocity units.

The available velocity unit types are: PD.VELOCITY.METERS_PER_SECOND, PD.VELOCITY.KILOMETERS_PER_HOUR, PD.VELOCITY.FEET_PER_SECOND, PD.VELOCITY.FEET_PER_MINUTE, PD.VELOCITY.MILES_PER_HOUR and PD.VELOCITY.KNOTS.

Properties:
Name Type Default Description
METERS_PER_SECOND number 0

The identifier for meters per second (m/s).

KILOMETERS_PER_HOUR number 1

The identifier for kilometres per hour (km/h).

FEET_PER_SECOND number 2

The identifier for feet per second (ft/s).

FEET_PER_MINUTE number 3

The identifier for feet per second (ft/s).

MILES_PER_HOUR number 4

The identifier for miles per hour (mph).

KNOTS number 5

The identifier for knots (kn).

toMetersPerSecond

Converts a velocity value to meters per second (m/s).

fromMetersPerSecond

Converts a velocity value from meters per second (m/s).

convertBetween

Converts a velocity value between the two given units.

getName function

Retrieves the name of the given enthalpy units.

Based on the given units, this method returns one of the following string values: 'Joules per Kilogram', 'kilo-Joules per Kilogram' or 'Btu per Pound'.

getAbbrev

Retrieves the abbreviation of the given enthalpy units.

Based on the given units, this method returns one of the following string values: 'J/kg', 'kJ/kg' or 'Btu/lb'.

getUnitsFromAbbrev

Retrieves the enthalpy units identifier from the given abbreviation.

Interprets the abbreviations 'J/kg', 'kJ/kg' or 'Btu/lb' into the identifiers PD.ENTHALPY.JOULES_PER_KILOGRAM | KILO_JOULES_PER_KILOGRAM | BTU_PER_POUND.


WEATHERDATA <static, readonly>

Weather data indexes for the PD.WeatherData#getMetric method.

Properties:
Name Type Default Description
DRY_BULB number 0

Dry Bulb Temperature (°C).

DEW_POINT number 1

Dew Point Temperature (°C).

REL_HUMIDITY number 2

Relative Humidity (%).

ATM_PRESSURE number 3

Atmospheric Pressure (Pa).

ET_SOLAR_HORIZONTAL number 4

Extraterrestrial Horizontal Radiation (Wh/m2).

ET_SOLAR_DIRECT number 5

Extraterrestrial Direct Normal Radiation (Wh/m2).

INFRA_RED_HORIZONTAL number 6

Horizontal Infrared Radiation from Sky (Wh/m2).

SOLAR_GLOBAL_HORIZONTAL number 7

Global Horizontal Radiation (Wh/m2).

SOLAR_DIRECT_NORMAL number 8

Direct Normal Radiation (Wh/m2).

SOLAR_DIFFUSE_HORIZONTAL number 9

Diffuse Horizontal Radiation (Wh/m2).

ILLUM_GLOBAL_HORIZONTAL number 10

Global Horizontal Illuminance (Lux).

ILLUM_DIRECT_NORMAL number 11

Direct Normal Illuminance (Lux).

ILLUM_DIFFUSE_HORIZONTAL number 12

Diffuse Horizontal Illuminance (Lux).

ILLUM_ZENITH number 13

Zenith Luminance (cd/m2).

WIND_DIRECTION number 14

Wind Direction (deg).

WIND_SPEED number 15

Wind Speed (m/s).

CLOUD_COVER_TOTAL number 16

Total Cloud Cover (%).

CLOUD_COVER_OPAQUE number 17

Opaque Sky Cover (%).

VISIBILITY number 18

Visibility (km).

CEILING_HEIGHT number 19

Ceiling Height (m).

PRECIPITABLE_WATER number 20

Precipitable Water (mm).

AEROSOL_DEPTH number 21

Aerosol Optical Depth (thou).

SNOW_DEPTH number 22

Snow Depth (cm).

SNOW_DAYS_SINCE_LAST_FALL number 23

Days Since Last Snowfall (days).

ALBEDO number 24

Albedo (0-1).

RAINFALL number 25

Precipitation Depth (mm).

Author:
  • drajmarsh

:string

appID <static>

An identifier for your particular app, defaults to 'PD'.

This value is used as a key prefix for all application-based local storage access within the framework. Whilst not always necessary, this does allow for differentiation if there is more than one app served from the same web address or server folder, or you are working on multiple apps using a local web server or via the File URI scheme.

You can change its value for your particular app by either creating the window.pdAppIdentifier variable prior to including the src/pd/core/pd.js script file, or later by including another customisation script that runs some time after pd.js but before the src/pd/app/pd-global-state.js script file.

Type
  • string

:number

pageScale <static>

The current scale required to fit the page on a small screen.

This is used by some SVG charts to deal with UI scaling issues, particularly in some versions of FireFox.

Type
  • number

Methods


Debounce(callback [, delay]) <static>

Creates a function that accumulates multiple invocations onto just one.

This returns a function that does not execute immediately when invoked, but waits for a pause in a stream of invocations that is greater than the given delay period before executing. Each new invocation restarts an internal timer.

This method is different to throttling in that debouncing guarantees no execution until there is a pause in invocations at least as long as the delay time, rather than periodic execution at regular intervals.

Parameters:
Name Type Argument Description
callback function

A function to call after the delay period.

delay number <optional>

The delay before calling in milliseconds (1 to 30,000), defaults to 50ms.

Throws:

Throws an error if the given callback is not a function.

Type
TypeError
Returns:

Returns a function that waits delay ms before executing.

Type
function

DynamicDebounce(callback [, shortDelay] [, longDelay] [, runLen]) <static>

Creates a function that accumulates multiple invocations onto just one, and uses a running average of calculation times to dynamically adjust the event accumulation period.

This returns a function that does not execute immediately when invoked, but waits for a pause in a stream of invocations that is greater than the given delay period before executing. Each new invocation restarts an internal timer.

Parameters:
Name Type Argument Description
callback function

A function to call after the delay period.

shortDelay number <optional>

The accumulation period in milliseconds when the calculation is short (1 to 30,000), defaults to 50ms.

longDelay number <optional>

The accumulation period in milliseconds when the calculation is long (1 to 30,000), defaults to 250ms.

runLen number <optional>

Length of the running average queue (1 to 64), defaults to 5.

Throws:

Throws an error if the given callback is not a function.

Type
TypeError
Returns:

Returns a function that accumulated calls before executing.

Type
function

PolyLabelPos(polygon [, result]) <static>

Calculates a good point within a complex polygon to place a label.

This uses polylabel (https://github.com/mapbox/polylabel), a fast algorithm for finding polygon 'pole of inaccessibility', the most distant internal point from the polygon outline (not to be confused with centroid). This is useful for the optimal placement of a text label that is actually within the polygon area, even if it has holes.

It is used in this framework for positioning labels on the floor plans of spaces as well as when inserting apertures and holes in selected surfaces.

The polygon must be given as an array of outer and inner boundary coordinates arrays. For polygons with multiple contours, the first must be the outer boundary ring and any others must be inner rings representing openings or holes.

Parameters:
Name Type Argument Description
polygon PD.Polygon

The polygon to calculate the best label position for.

result THREE.Vector3 <optional>

An optional 3D vector object to receive the label position.

Returns:

Returns the result value, or a new 3D vector.

Type
THREE.Vector3

Throttle(callback [, delay]) <static>

Creates a function that throttles invocations to once per delay period.

This returns a function that does not execute immediately when invoked, but waits for the given delay period before executing. Any subsequent calls within delay period are ignored.

This method is different from debouncing in that it guarantees execution at regular intervals, rather than waiting for a pause in invocations.

Parameters:
Name Type Argument Description
callback function

A function to call after the delay period.

delay number <optional>

The delay before calling in milliseconds (1 to 30,000), defaults to 50ms.

Throws:

Throws an error if the given callback is not a function.

Type
TypeError
Returns:

Returns a function that waits delay ms before executing.

Type
function

WrappedCallback(obj, callback) <static>

Creates a function that invokes a callback method with the given object as this.

The aim of wrapping a callback function or method is to ensure that it is always invoked with the given object as this, regardless of how the wrapper function is called.

This is also useful when you want to add an auto-generated listener to an event that can then removed at some later time. Simply store the wrapped callback in a persistent variable, and use it in removeEventListener() exactly the same way as addEventListener().

Parameters:
Name Type Description
obj object

The object to use as this in the callback.

callback function

A method on the given object to invoke.

Throws:

Throws an error if callback is not a function or object is not valid.

Type
TypeError
Returns:

Returns a function that invokes the callback.

Type
function

getDefaultValue(key) <static>

Retrieves the value associated with a prefixed key in local storage.

This method modifies the given key by prefixing it with the current value of PD.appID followed by a full colon, in order to make the data specific for this app. Thus, if a key value of colorScheme is given, and the value of PD.appID is PD:SP3D, then the actual key looked up in local storage will be PD:SP3D:colorScheme.

You are strongly encouraged to use the methods provided by PD.GlobalActions for accessing local storage instead of this one. These include PD.GlobalActions.getDefaultValue, PD.GlobalActions.setDefaultValue and PD.GlobalActions.removeDefaultValue. This method exists for use internally by the framework when reading application state before PD.GlobalActions has been created.

Parameters:
Name Type Description
key string

The unprefixed name of the item.

Returns:

Returns the value, or null.

Type
any | null