Communicator

Deprecated List


References

BimMask

Re-exports BimMask

Milliseconds

Re-exports Milliseconds

OverlayId

Re-exports OverlayId()

OverlayIndex

Re-exports OverlayIndex

ScModelName

Re-exports ScModelName

ScsBuffer

Re-exports ScsBuffer

ViewKey

Re-exports ViewKey

Type Aliases

BimId

Type for the relationships ID

BodyId

Type used to denote assembly tree body IDs. All BodyIds are NodeIds.

BuiltInOperatorId

Enumerates IDs for built-in operators

CadViewId

Type used to denote assembly tree CAD view IDs. All CadViewIds are NodeIds.

Degrees

Type used to denote the degrees of angles.

ExchangeId

Type used to denote Exchange IDs. Use [[Util.exchangeIdEqual]] function to compare.

ExternalModelName

Type used to denote an XML ExternalModel name.

FilterName

Type used to denote Filter names.

GenericId

Type used to denote generic id

GenericType

Type used to denote generic types

HtmlId

Type used to denote HTML IDs.

ImageId

A pair of numbers identifying an image.

LayerName

Type used to denote Layer names.

LightKey

Type used to denote light keys

LinePattern

Specifies the appearance of a single repetion of a line pattern. The format is an arbitrary-length array of 1``s and ``0``s, where pixels covered by a ``1 in the pattern are visible and pixels covered by a 0 are invisible.

Examples: - [1,0]: a dashed line with equal-length dashes and gaps - [1,1,1,1,1,1,1,1,1,0,0,0,0,1,0,0,0,0]: a dash followed by a gap of

equal length with a dot in the center

MassageModelNameFunc

Callback to massage ExternalModel names within an XML load file to SC model names. Return null to skip the model. Returned value can be synchronous (non-Promise) or asynchronous (Promise).

Matrix12

Matrix16

Matrix9

MeshId

A pair of numbers identifying a mesh.

ModelNameToScsFileFunc

Callback to map ExternalModel names within an XML load file to SCS file URis or SCS file buffers. Return null to skip the model. Returned value can be synchronous (non-Promise) or asynchronous (Promise).

NodeId

Type used to denote assembly tree node IDs.

NodeIdOffset

PartId

Type used to denote assembly tree part IDs. All PartIds are NodeIds.

Pixels

A number typed in pixel units.

PmiId

Type used to denote assembly tree PMI IDs. All PmiIds are NodeIds.

Radians

Type used to denote the radians of angles.

Rgbas

ScsUri

Type used to denote an SCS model’s URI.

SheetId

Type used to denote assembly tree sheet IDs. All SheetIds are NodeIds.

UserDataIndex

This is the User Data Index for a node.

Values of this type are unsigned 64 bit numbers.

A value is of type number when it can be represented precisely as such.

Otherwise a value is of type string, where the string is the hex encoding of the index. The hex representation is in uppercase and does not have a leading 0x.

Uuid

Type used to denote GUIDs.

Uvs

Vector3

Vector3s

Vector4

Vector4s

XRayTransparencyMode

Enumerates ways of displaying transparent (unselected) geometry in the x-ray draw mode.

XmlFilename

Type used to denote an XML filename.

Variables

DefaultTransitionDuration
Type

400

The default duration in milliseconds of camera transitions.

EmptyModelName
Type

_empty

InvalidNodeId
Type

NodeId

Ohm
Type

Subscript1
Type

¹

Subscript2
Type

²

Subscript3
Type

³

SubscriptNeg
Type

Functions

closestPointFromPointToSegment

closestPointFromPointToSegment(p0, p1, point)
Arguments
  • p0 (Point3()) – First point of the line segment

  • p1 (Point3()) – Second point of the line segment

  • point (Point3()) – Point at which to find closest line segment point.

Finds the closest point on line segment p0-p1 to the given point. The closest point will always lie on or between the line segment endpoints.

Return type

Point3

closestPointScalarFromPointToSegment

closestPointScalarFromPointToSegment(p0, p1, point)
Arguments
  • p0 (Point3()) – First point of the line segment

  • p1 (Point3()) – Second point of the line segment

  • point (Point3()) – Point at which to find closest line segment scalar

Finds the scalar for the closest point on line segment p0-p1 to the given point. The returned scalar will always be in the range [0, 1], where 0 indicates p0 is closest, and 1 indicates p1 is closest.

Return type

number

computeAngleBetweenVector

computeAngleBetweenVector(vector1, vector2)
Arguments
  • vector1 (Point3()) – The first vector.

  • vector2 (Point3()) – The second vector.

Computes the smallest angle between two vectors in degrees.

Returns

The angle between vectors in degrees.

Return type

number

computeOffaxisRotation

computeOffaxisRotation(axisVector, degrees[, out_rotationMatrix])
Arguments
  • axisVector (Point3()) – The vector to rotate around.

  • degrees (number()) – The amount to rotate.

  • out_rotationMatrix (Matrix()) – optional The out parameter for the rotation matrix.

Computes the rotation matrix defined by rotating around a vector.

Returns

The out parameter rotation matrix.

Return type

Matrix

computePointToLineDistance

computePointToLineDistance(point, lineBegin, lineEnd, out_closestPointOnLine)
Arguments
  • point (Point3()) – None

  • lineBegin (Point3()) – The start point of the line segment to compute against.

  • lineEnd (Point3()) – The end point of the line segment to compute against.

  • out_closestPointOnLine (Point3()) – The out parameter for a closest point on the line segment to the point.

Computes the shortest distance between a point and a line segment.

Returns

The distance from the point and the closest point on the line.

Return type

number

createUuid

createUuid()
Return type

Uuid

degreesToRadians

degreesToRadians(degrees)
Arguments
  • degrees (number()) – The degrees to convert.

Converts degrees to radians.

Returns

The converted radians.

Return type

number

distanceLineLine

distanceLineLine(line1Begin, line1End, line2Begin, line2End, out_closestPointLine1, out_closestPointLine2)
Arguments
  • line1Begin (Point3()) – The start of the first line segment.

  • line1End (Point3()) – The end of the first line segment.

  • line2Begin (Point3()) – The start of the second line segment.

  • line2End (Point3()) – The end of the second line segment.

  • out_closestPointLine1 (Point3()) – Out parameter for the closest point of line1 to line2.

  • out_closestPointLine2 (Point3()) – Out parameter for the closest point of line2 to line1.

Returns the distance between two line segments.

Returns

The distance between the two input line segments.

Return type

number

formatWithUnit

formatWithUnit(value, unit)
Arguments
  • value (number()) – The value to format (without units).

  • unit (number()) – The unit scale to be applied to value.

Returns the formatted string of a value and its units. Unit scaling is based on unit === 1 being for millimeters.

Return type

string

generateArcPoints

generateArcPoints(axis, angle, center, startOffset, segmentCount)
Arguments
  • axis (Point3()) – The normal of the plane containing the arc (in other words, the axis of rotation).

  • angle (number()) – The angle swept by the arc (may be negative).

  • center (Point3()) – The center point of the arc.

  • startOffset (Point3()) – The starting point of the arc, expressed as an offset relative to the center.

  • segmentCount (number()) – The number of line segments to be generated.

Returns an array of evenly-distributed points that lie on an arc.

Returns

An array containing segmentCount + 1 points.

Return type

[Point3]

generatePointsOnCircle

generatePointsOnCircle(out_points, center, radius, numPoints, axisVector)
Arguments
  • out_points ([Point3]()) – The out parameter for the generated points.

  • center (Point3()) – The center of the circle.

  • radius (number()) – The radius of the circle.

  • numPoints (number()) – The number of points to use for the tesesselated circle.

  • axisVector (Point3()) – The axis to orient the circle against.

Generates tessellated points suitable for mesh creation for a given circle.

Return type

void

getLongUnitString

getLongUnitString(unit)
Arguments
  • unit ([UnitElement]()) – None

Return type

string

intersect3d2Planes

intersect3d2Planes(plane1, pointOnPlane1, plane2, pointOnPlane2, out_lineBegin, out_lineEnd)
Arguments
  • plane1 (Plane()) – The first plane.

  • pointOnPlane1 (Point3()) – A point on the first plane.

  • plane2 (Plane()) – The second plane.

  • pointOnPlane2 (Point3()) – A point on the second plane.

  • out_lineBegin (Point3()) – Out parameter for resulting intersection line (if any).

  • out_lineEnd (Point3()) – Out parameter for resulting intersection line (if any).

Computes the intersection of two planes.

Returns

0 if the planes are disjoint. 1 if the planes coincide. 2 if the planes intersect in a line.

Return type

0 | 1 | 2

intersectionPlaneLine

intersectionPlaneLine(lineBegin, lineEnd, planePoint1, planePoint2, planePoint3, out_intersectionPoint)
Arguments
  • lineBegin (Point3()) – The start point of the line segment to intersect.

  • lineEnd (Point3()) – The end point of the line segment to intersect.

  • planePoint1 (Point3()) – A point on the plane to intersect.

  • planePoint2 (Point3()) – A point on the plane to intersect.

  • planePoint3 (Point3()) – A point on the plane to intersect.

  • out_intersectionPoint (Point3()) – The out parameter for the point of intersection if one exists.

Computes the intersection of a line segment and a plane.

Returns

True if the line segment and plane intersect. False otherwise. See also: [[intersectionPlaneLine2]].

Return type

boolean

intersectionPlaneLine2

intersectionPlaneLine2(lineBegin, lineEnd, plane, out_intersectionPoint)
Arguments
  • lineBegin (Point3()) – The start point of the line segment to intersect.

  • lineEnd (Point3()) – The end point of the line segment to intersect.

  • plane (Plane()) – The plane to intersect.

  • out_intersectionPoint (Point3()) – The out parameter for the point of intersection if one exists.

Computes the intersection of a line segment and a plane.

Returns

True if the line segment and plane intersect. False otherwise.

Return type

boolean

isIColor

isIColor(o)
Arguments
  • o (unknown()) – None

Return type

o

isIPoint2

isIPoint2(o)
Arguments
  • o (any()) – None

Return type

o

isIPoint3

isIPoint3(o)
Arguments
  • o (unknown()) – None

Return type

o

isIPoint4

isIPoint4(o)
Arguments
  • o (unknown()) – None

Return type

o

isPointInRect2d

isPointInRect2d(point, rectPos, rectSize, tolerance)
Arguments
  • point (Point2()) – The point to test

  • rectPos (Point2()) – The lower-left corner of the rectangle

  • rectSize (Point2()) – The width and height of the rectangle

  • tolerance (number()) – The maximum distance along the x- or y-axis that point is allowed to be outside the rectangle

Returns whether the 2-dimensional point point lies within the given rectangle.

Return type

boolean

isPointOnLineSegment

isPointOnLineSegment(p0, p1, point, epsilon)
Arguments
  • p0 (Point3()) – First point of the line segment

  • p1 (Point3()) – Second point of the line segment

  • point (Point3()) – Point that possibly lies on the line segment.

  • epsilon (number()) – Epsilon value used with point-on-line distance calculation.

Determine if the point is both on the line formed by p0-p1, and within the p0-p1 line-segment endpoints

Return type

boolean

isPointOnLineSegment2d

isPointOnLineSegment2d(point, p1, p2, tolerance)
Arguments
  • point (Point2()) – The point to test

  • p1 (Point2()) – The first endpoint of the line segment

  • p2 (Point2()) – The second endpoint of the line segment

  • tolerance (number()) – If the perpendicular distance of point from the line segment is less than or equal to tolerance, the function will return true.

Returns whether the 2-dimensional point point lies on the line segment p1p2.

Return type

boolean

lineLineIntersect

lineLineIntersect(p1, p2, p3, p4)
Arguments

Returns the closest point on line p1p2 to line p3p4.

Return type

Point3 | null

oneVectorCross

oneVectorCross(vector[, out_crossVector])
Arguments
  • vector (Point3()) – The input vector to cross.

  • out_crossVector (Point3()) – optional The out parameter for the cross product.

Returns the cross product of a vector against its least significant axis.

Return type

Point3

radiansToDegrees

radiansToDegrees(radians)
Arguments
  • radians (number()) – None

Converts radians to degrees.

Returns

The converted degrees.

Return type

number