Class: Factory

PD.BRep. Factory


new Factory()

A static factory class for generating standard primitive shapes as BReps.

Author:
  • drajmarsh

Methods


addSubdividedQuad(brep, quad, size, variation [, colorFn]) <static>

Adds a series of quad faces distributed over a quad to the face array.

Parameters:
Name Type Argument Description
brep PD.BRep

The BRep to add to.

quad PD.Polygon

The 4-sided vector-object-based polygon to subdivide.

size number

The preferred size of faces, in model units.

variation number

The amount of positional variation to apply.

colorFn function <optional>

An optional random color callback function.

Returns:

Returns true if one or more faces were generated.

Type
boolean

addSubdividedTriangle(brep, triangle, size, variation [, colorFn]) <static>

Adds leaves distributed over a triangle to the face array.

Parameters:
Name Type Argument Description
brep PD.BRep

The BRep to add to.

triangle PD.Polygon

The 3-sided polygon to subdivide.

size number

The size of the leaf, in model units.

variation number

The amount of positional variation to apply.

colorFn function <optional>

An optional random color callback function.

Returns:

Returns true if one or more faces were generated.

Type
boolean

addVerticalDropEdgesToShell(shell, face, footprint, depth [, brep]) <static>

Adds vertical side polygons to the edges of all faces that follow the given footprint.

This is used when surfaces covering the footprint of an element are clipped to other elements and vertical surfaces at the clip edge are required in the shell for spatial adjacency analysis.

In this method, all side drop by the same amount, creating parallelograms.

Parameters:
Name Type Argument Description
shell PD.Shell

The shell to add the vertical surfaces to.

face PD.BRep.Face

The BRep face to check.

footprint PD.Polygon

The footprint to check face edges against.

depth number

The Z-axis value to extrude up/down by.

brep PD.BRep <optional>

An optional BRep to copy faces to as well as the shell.


addVerticalEdgesToShell(shell, face, footprint, z [, brep]) <static>

Adds vertical side polygons to the edges of all faces that follow the given footprint.

This is used when surfaces covering the footprint of an element are clipped to other elements and vertical surfaces at the clip edge are required in the shell for spatial adjacency analysis.

In this method, all side drop to the same value in the Z axis, creating a flat bottom.

Parameters:
Name Type Argument Description
shell PD.Shell

The shell to add the vertical surfaces to.

face PD.BRep.Face

The BRep face to check.

footprint PD.Polygon

The footprint to check face edges against.

z number

The Z-axis value to extrude up/down to.

brep PD.BRep <optional>

An optional BRep to copy faces to as well as the shell.


barrelRoofShape(brep, vertices, normal, config [, height] [, base]) <static>

Creates the top surfaces of a barrel roof with an optional base.

A barrel roof is formed from a series of planes that form a semicircular arch at each end. The number of planes is determined by the face resolution. A rainbow roof is very similar, but forms a pointed arch instead of a semicircular one.

The vertices array must contain at least four (4) points that define a convex coplanar quadrilateral, with the order of vertices illustrated below. All other points are defined by the face edges.

    3------------------------------------2
    +------------------------------------+
    |                                    |
    +------------------------------------+
    |                                    |
    |                                    |
    +------------------------------------+
    |                                    |               , - ~ ' ~ - ,
    |                                    |           , '               ' ,
    +------------------------------------+         ,                       ,
    |                                    |        ,                         ,
    +------------------------------------+       ,                           ,
    0------------------------------------1       1  -  -  -  -   -  -  -  -  2 - + - height
                                                 |                           |
                                                 +---------------------------+ - + - 0.0
Parameters:
Name Type Argument Description
brep PD.BRep

The BRep to receive the roof shape.

vertices Array.<PD.Point>

A list of at least 4 points defining the boundary.

normal THREE.Vector3

The normalised surface normal of the boundary.

config object

A configuration object.

Properties of config:
Name Type Description
faces number

The number of faces in the barrel roof (2 to 72), defaults to 12.

heightFactor number

A ridge height multiplier for this roof, defaults to 1.

height number <optional>

The Z-axis height of roof surfaces above ground level, defaults to 0.

base number | Array.<PD.Point> <optional>

The Z-axis position of the shape base from roof surfaces, or a list of one or more boundary points, defaults to 0.

Returns:

Returns an array of roof faces.

Type
Array.<PD.BRep.Face>

barrelRoofSurfaces(brep, vertices, normal, config [, height] [, arch_1] [, arch_2]) <static>

Creates the top surfaces of a barrel roof element.

A barrel roof is formed from a series of planes that form a semicircular arch at each end. The number of planes is determined by the face resolution. A rainbow roof is very similar, but forms a pointed arch instead of a semicircular one.

The vertices array must contain at least four (4) points that define a convex coplanar quadrilateral, with the order of vertices illustrated below. All other points are defined by the face edges.

    3------------------------------------2
    +------------------------------------+
    |                                    |
    +------------------------------------+
    |                                    |
    |                                    |
    +------------------------------------+
    |                                    |               , - ~ ' ~ - ,
    |                                    |           , '               ' ,
    +------------------------------------+         ,                       ,
    |                                    |        ,                         ,
    +------------------------------------+       ,                           ,
    0------------------------------------1       1  -  -  -  -   -  -  -  -  2
Parameters:
Name Type Argument Description
brep PD.BRep

The BRep to receive the roof shape.

vertices Array.<PD.Point>

A list of at least 4 points defining the boundary.

normal THREE.Vector3

The normalised surface normal of the boundary.

config object

A configuration object.

Properties of config:
Name Type Description
facets number

The number of facets in the barrel roof (2 to 72), defaults to 12.

heightFactor number

A ridge height multiplier for this roof, defaults to 1.

height number <optional>

The Z-axis height of roof surfaces above ground level, defaults to 0.

arch_1 number <optional>

An empty array to recive the first arch vertices.

arch_2 number <optional>

An empty array to recive the second arch vertices.

Returns:

Returns an array of roof faces.

Type
Array.<PD.BRep.Face>

barrelRoofWithCeiling(brep, vertices, normal, config [, height]) <static>

Creates a barrel roof with an inclined ceiling beneath it.

A barrel roof is formed from a series of planes that form a semicircular arch at each end. The number of planes is determined by the face resolution. A rainbow roof is very similar, but forms a pointed arch instead of a semicircular one.

The vertices array must contain at least four (4) points that define a convex coplanar quadrilateral, with the order of vertices illustrated below. All other points are defined by the face edges.

    3------------------------------------2
    +------------------------------------+
    |                                    |
    +------------------------------------+
    |                                    |
    |                                    |
    +------------------------------------+
    |                                    |               , - ~ ' ~ - ,
    |                                    |           , '  ,  ~ ' ~ ,   ' ,
    +------------------------------------+         ,  , '            ' ,   ,
    |                                    |        ,  ,                   ,  ,
    +------------------------------------+       ,  ,          :          ,  ,
    0------------------------------------1       1  +  -  -  - + -  -  -  +  2 - + - height
                                                 |  |          :             |
                                                 +--+  -  -  -   -  -  -  +--+ - + - 0.0
Parameters:
Name Type Argument Description
brep PD.BRep

The BRep to receive the roof shape.

vertices Array.<PD.Point>

A list of at least 4 points defining the boundary.

normal THREE.Vector3

The surface normal or 'up' vector of the boundary.

config BIM.Roofs | object

A roof type component or POJO configuration object.

Properties of config:
Name Type Argument Description
angle number <optional>

The angle of the roof surfaces in degrees, defaults to 30.

ceilingStyle number <optional>

Defines the ceiling/gutter style (0:Flat, 1:Gutter, 2:Normal, 3:Horizontal, 4=Vertical), defaults to 1.

roofThickness number <optional>

The thickness of the inclined roof surface, defaults to PD.GlobalState.defaultSlabDepth.

eavesWidth number <optional>

The horizontal width of the eaves, defaults to the roof thickness.

eavesDepth number <optional>

The vertical depth of the eaves, defaults to the roof thickness.

height number <optional>

The Z-axis height of roof surfaces above ground level, defaults to 0.

Returns:

Returns an array of roof faces.

Type
Array.<PD.BRep.Face>

buildRoofFromSpotHeights(brep, polyline, config [, height]) <static>

Generates a roof surface using spot heights.

This method uses a series of spot heights generated over the roof area to create a triangulated approximation of the roof surface.

Parameters:
Name Type Argument Description
brep PD.BRep

The boundary representation to add the shape to.

polyline PD.Polyline

The polyline, polygoin or path to build the skeleton from.

config object

A configuration object.

Properties of config:
Name Type Description
angle number

The angle of the roof surfaces, in degrees.

maxHeight number

The maximum height of the roof in model units, above which it surfaces will be flattened/clipped.

gridDensity number

The relative density of the grid used to generate the roof surface.

height number <optional>

The Z-axis height of roof surfaces above ground level, defaults to 0.

Returns:

Returns an array of new faces added to the BRep.

Type
Array.<PD.BRep.Face>

buildStraightSkelton(brep, poly [, angle] [, height]) <static>

Creates a horizontal straight skeleton shape from a given path.

Parameters:
Name Type Argument Description
brep PD.BRep

The boundary representation to add the shape to.

poly PD.Polyline

The polyline, polygon or path to build the skeleton from.

angle number <optional>

The angle of the skeleton elements in degrees (0 to 75), defaults to 25deg.

height number <optional>

The Z-axis height of roof surfaces above ground level, defaults to 0.

Returns:

Returns an array of new faces added to the BRep.

Type
Array.<PD.BRep.Face>

butterflyRoofShape(brep, vertices, normal, config [, height] [, base]) <static>

Creates the top surfaces of a butterfly roof with an optional base.

A butterfly roof consists of two inclined planes that meet in the middle of a base quad to form a central valley. As opposed to a gable roof, the planes are generated from the center value and incline upwards towards the

The vertices array must contain at least four (4) points that define a convex coplanar quadrilateral, with the order of vertices illustrated below. This shape actually requires six (6) points, where the last two will be automatically computed and added to the array if required.

     3-----------------------------------2
      \                                _/
       \                             _/
        5---------------------------4       '-._                 _.-'
         \                        _/        :    '-._       _.-'    :
          \                     _/          :         '-4-'         :
           0-------------------1            1  -  -  -  -  -  -  -  2 - + - height
                                            +-----------------------+ - + - base
Parameters:
Name Type Argument Description
brep PD.BRep

The BRep to receive the roof shape.

vertices Array.<PD.Point>

A list of at least 4 points defining the boundary.

normal THREE.Vector3

The normalised surface normal of the boundary.

config object

A configuration object.

Properties of config:
Name Type Description
angle number

The angle of the roof surfaces, in degrees.

height number <optional>

The Z-axis height of roof surfaces above ground level, defaults to 0.

base number | Array.<PD.Point> <optional>

The Z-axis position of the shape base from roof surfaces, or a list of one or more boundary points, defaults to 0.

Returns:

Returns an array of two (2) roof faces.

Type
Array.<PD.BRep.Face>

butterflyRoofSurfaces(brep, vertices, normal, config [, height]) <static>

Creates the top surfaces of a butterfly roof with an optional base.

A butterfly roof consists of two inclined planes that meet in the middle of a base quad to form a central valley. As opposed to a gable roof, the planes are generated from the center value and incline upwards towards the perimeter.

The vertices array must contain at least four (4) points that define a convex coplanar quadrilateral, with the order of vertices illustrated below. This shape actually requires ten (10) points, where the last six will be automatically computed and added to the array if required.

     3-----------------------------------2
      \                                _/
       \                             _/
        5---------------------------4       '-._                 _.-'
         \                        _/        :    '-._       _.-'    :
          \                     _/          :         '-.-'         :
           0-------------------1            1  -  -  -  -  -  -  -  2
Parameters:
Name Type Argument Description
brep PD.BRep

The BRep to receive the roof shape.

vertices Array.<PD.Point>

A list of at least 4 points defining the boundary.

normal THREE.Vector3

The normalised surface normal of the boundary.

config object

A configuration object.

Properties of config:
Name Type Description
angle number

The angle of the roof surfaces, in degrees.

height number <optional>

The Z-axis height of roof surfaces above ground level, defaults to 0.

Returns:

Returns an array of two (2) roof faces.

Type
Array.<PD.BRep.Face>

butterflyRoofWithCeiling(brep, vertices, normal, config [, height]) <static>

Creates a butterfly roof with an inclined ceiling beneath it.

A butterfly roof consists of two inclined planes that meet in the middle of a base quad to form a central valley. As opposed to a gable roof, the planes are generated from the center value and incline upwards towards the

The vertices array must contain at least four (4) points that define a convex coplanar quadrilateral, with the order of vertices illustrated below. This shape actually requires six (6) points, where the last two will be automatically computed and added to the array if required.

     3-----------------------------------2
      \  -  -  -  -  -  -  -  -  -  -  _/
       \                             _/
        5---------------------------4       '-._                 _.-'
         \                        _/        : +_ '-._       _.-' _+ :
          \ -  -  -  -  -  -  - _/          : :  '-._ '-4-' _.-'  : :
           0-------------------1            1 :       '-4-'       : 2 - + - height
                                            +-+                   +-+ - + - base
Parameters:
Name Type Argument Description
brep PD.BRep

The BRep to receive the roof shape.

vertices Array.<PD.Point>

A list of at least 4 points defining the boundary.

normal THREE.Vector3

The normalised surface normal of the boundary.

config BIM.Roofs | object

A roof type component or POJO configuration object.

Properties of config:
Name Type Argument Description
angle number <optional>

The angle of the roof surfaces in degrees, defaults to 30.

ceilingStyle number <optional>

Defines the ceiling/gutter style (0:Flat, 1:Gutter, 2:Normal, 3:Horizontal, 4=Vertical), defaults to 1.

roofThickness number <optional>

The thickness of the inclined roof surface, defaults to PD.GlobalState.defaultSlabDepth.

eavesWidth number <optional>

The horizontal width of the eaves, defaults to the roof thickness.

eavesDepth number <optional>

The vertical depth of the eaves, defaults to the roof thickness.

height number <optional>

The Z-axis height of roof surfaces above ground level, defaults to 0.

Returns:

Returns an array of two (2) roof faces.

Type
Array.<PD.BRep.Face>

convertShapeToSections(shape [, curveSegments]) <static>

Converts a shape instance into an array of linear and curved sections.

You can generate faceted BReps very easily by simply adding a series of planar faces that all share common boundary and trimagle vertices. This is because each face has its own computed surface normal, and the vertices of each face are added to renderable meshes seperately using the face normal. Adding curved faces is significantly more complex as each point on each curve has its own normal, and can only share vertices with other faces if their surfaces smoothly transition together.

Thus when extruding, sweeping or revolving a shape, we need to treat curved sections differently from straight sections, differentiate between each section with an edge, and be very caeful when sharinf vertices. Simply extracting points from a shape doesn't allow us to make this distinction, so the aim of this method is to extract each section separately into arrays of points that define separate planar and curved faces.

The key reason for this is the need to differentiate between extruded, swept or revolved edges that can share vertices and those that should not. For example, the seam between two lines that meet at different angles needs two separate sets of vertices, one with the normal from the previous face and one with the normal from the next face. However, the seam between two points on the same curve can share the same vertices and normals as we want to see a smooth surface at that point.

Thus, any section with two points will be treated as a straight line and should generate its own face and edge. Any entry with three or more vertices will be treated as a curve and will generate a curved face with shared vertices and an edge.

Parameters:
Name Type Argument Description
shape THREE.Shape

The shape to convert to contours.

curveSegments number <optional>

The number of segments to sample curves in (1 to 360), defaults to 12.

Returns:

Returns an array of separate curve sections.

Type
Array.<Array.<THREE.Vector2>>

createRoofBaseVertices(brep, vertices, height, base) <static>

Creates a base of four (4) points defining the base of a roof shape using either a numeric value or an array of points.

Parameters:
Name Type Description
brep PD.BRep

The BRep to receive the roof shape.

vertices Array.<PD.Point>

A list of at least 4 points defining the boundary.

height number

The Z-axis height of roof surfaces above ground level, defaults to 0.

base number | Array.<PD.Point>

The Z-axis position of the shape base from roof surfaces, or a list of one or more points, defaults to 0.

Returns:

Returns an array of four (4) base vertices.

Type
Array.<PD.Point>

cuboid(brep, coords, size) <static>

Generates a cuboid primitive shape consisting of eight (8) vertices, twelve (12) edges and six (6) rectangular faces.

           (0,d,h)            (w,d,h)
             7-------------------6
         Z  /|                  /|
         | / |                 / |
         |/  |        (w,0,h) /  | Y
 (0,0,h) 4-------------------5   |/
         |   3---------------|---2 (w,d,0)
         |  /(0,d,0)         |  /
         | /                 | /
         |/                  |/
         0-------------------1 -- -- X
      (0,0,0)             (w,0,0)

              3---------2
              |  back   |
              |    3    |
              |         |
    3---------7---------6---------2
    |  left   |   top   |  right  |
    |    4    |    5    |    2    |
    |         |         |         |
    0---------4---------5---------1
              |  front  |
              |    1    |
              |         |
              0---------1
              | bottom  |
              |    0    |
              |         |
              3---------2
Parameters:
Name Type Description
brep PD.BRep

The BRep to add the shape to.

coords PD.LocalCoordinates | null

The local coordinate system to use, defaults to Cartesian axis at the origin.

size THREE.Vector3 | Array.<number>

The size of the shape in each local axis as an {x,y,z} object or [x,y,z] array.

Returns:

Returns one or more faces.

Type
Array.<PD.BRep.Face>

cylinder(brep [, config]) <static>

Generates a cylindrical primitive shape consisting of two planar circular/elliptical disks and a curved face lofted between them.

This shape fully utilises the capacity of the PD.BRep class to display smooth curves, especially if you add a fillet at either end.

             , - ~ ' ~ - ,
         ,           .       ' ,
      ,            :.           ,
     |          -- + --          |
     |,           .:            ,|
     |   ,      .             ,  |
     |      ' - , _:_ _ ,  '     |
     |                           |
     |             :             |
     |                           |
     |             :             |
     |             Z             |
     |             | Y           |
     |             |/            |
     |       -- -- + -- -- X     |
      ,           /|            ,
         ,       / |          ,
            ' - , _ _ _ ,  '
Parameters:
Name Type Argument Description
brep PD.BRep

The BRep to add the shape to.

config object <optional>

An optional configuration object.

Properties of config:
Name Type Argument Description
pos THREE.Vector3 <optional>

The position of the bottom centre point, defaults to the local coordinates origin.

coords PD.LocalCoordinates <optional>

The local coordinate system to use when generating the shape.

height number <optional>

The height of the shape, defaults to 1000mm (1m).

radius number <optional>

The base radius of the shape, defaults to 1000mm (1m).

fillet number | Array.<number> <optional>

An optional radius or [bot,top] array for filleting edges and corners, defaults to 0 (no fillet).

chamfer number | Array.<number> <optional>

An optional radius or [bot,top] array for chamfering edges and corners, defaults to 0 (no chamfer).

faces number <optional>

An optional number of faces in the vertical circumference to use, defaults to 72.

angle number <optional>

An optional longitude angle in radians (0 to 2PI), defaults to 2PI.

Returns:

Returns a list of added faces.

Type
Array.<PD.BRep.Face>

dome(brep, coords [, radiusX] [, radiusY] [, radiusZ]) <static>

Generates a hemispherical dome shape consisting of a single curved face.

              , - ~ ' ~ - ,
          , '               ' ,
        ,    .   -  Z  -  .     ,
       ,  '         | Y      ' . ,
      ,'            |/           ',
      ,       -- -- + -- -- X     ,
       ,           /|            ,
         ,        / |          ,
            ' - , _ _ _ , - '
Parameters:
Name Type Argument Description
brep PD.BRep

The BRep to add the shape to.

coords PD.LocalCoordinates | null

The local coordinate system to use, defaults to Cartesian axis at the origin.

radiusX number <optional>

The radius of the hemisphere in the local X axis, defaults to 1000mm (1m).

radiusY number <optional>

The radius of the hemisphere in the local Y axis, defaults to radiusX.

radiusZ number <optional>

The radius of the hemisphere in the local Z-axis, defaults to radiusX.

Returns:

Returns a list of added faces.

Type
Array.<PD.BRep.Face>

extrude(brep, face, distance) <static>

Extrudes a face in the opposite direction of its surface normal by the given distance.

You can use a negative distance value to extrude the shape in the same direction as its surface normal, but this will reverse the direction of the given face so that its surface normal faces outwards.

Parameters:
Name Type Description
brep PD.BRep

The BRep to add the extruded shape to.

face PD.BRep.Face

The face to extrude.

distance number

The distance to extrude in the normal direction.

Returns:

Returns an array of faces.

Type
Array.<PD.BRep.Face>

freeFormRoofShape(brep, polyline, config [, height]) <static>

Creates the surfaces of a free-form roof with an optional base.

A free-form roof uses a straight-sekeleton algorithm to generate ridgelines at the given angle, and then checks to trim the maximum height of the resulting shapes.

The vertices array must contain at least three (3) points that define a coplanar polygon, which may be concave or convex but should not self-intersect.

Parameters:
Name Type Argument Description
brep PD.BRep

The BRep to receive the roof shape.

polyline PD.Polyline

A polyline defining the defining the boundary and any holes.

config object

A configuration object.

Properties of config:
Name Type Description
angle number

The angle of the roof surfaces, in degrees.

maxHeight number

The maximum height of the roof in model units, above which it surfaces will be flattened/clipped.

height number <optional>

The Z-axis height of roof surfaces above ground level, defaults to 0.

Returns:

Returns an array of new faces.

Type
Array.<PD.BRep.Face>

freeFormRoofSurfaces(brep, polyline, config [, height]) <static>

Creates the top surfaces of a free-form roof element.

A free-form roof uses a straight-sekeleton algorithm to generate ridgelines at the given angle, and then checks to trim the maximum height of the resulting shapes.

The vertices array must contain at least three (3) points that define a coplanar polygon, which may be concave or convex but should not self-intersect.

Parameters:
Name Type Argument Description
brep PD.BRep

The BRep to receive the roof shape.

polyline PD.Polyline

A polyline defining the defining the boundary and any holes.

config object

A configuration object.

Properties of config:
Name Type Description
angle number

The angle of the roof surfaces, in degrees.

height number <optional>

The Z-axis height of roof surfaces above ground level, defaults to 0.

Returns:

Returns an array of new faces.

Type
Array.<PD.BRep.Face>

gableRoofShape(brep, vertices, normal, config [, height] [, base]) <static>

Creates the top surfaces of a gable roof with an optional base.

A gable roof consists of two inclined planes that meet in the middle of a base quad to form a central ridge, as well as the end planes and and optional gutter depth.

The vertices array must contain at least four (4) points that define a convex coplanar quadrilateral, with the order of vertices illustrated below. This shape actually requires six (6) points, where the last two will be automatically computed and added to the array if required.

     3-----------------------------------2
      \                                _/
       \                             _/
        5---------------------------4                   _.-._
         \                        _/               _.-'       '-._
          \                     _/            _.-'                 '-._
           0-------------------1            1  -  -  -  -   -  -  -  -  2 - + - height
                                            +---------------------------+ - + - base
Parameters:
Name Type Argument Description
brep PD.BRep

The BRep to receive the roof shape.

vertices Array.<PD.Point>

A list of at least 4 points defining the boundary.

normal THREE.Vector3

The normalised surface normal of the boundary.

config object

A configuration object.

Properties of config:
Name Type Description
angle number

The angle of the roof surfaces, in degrees.

height number <optional>

The Z-axis height of roof surfaces above ground level, defaults to 0.

base number | Array.<PD.Point> <optional>

The Z-axis position of the shape base from roof surfaces, or a list of one or more boundary points, defaults to 0.

Returns:

Returns an array of two (2) roof faces.

Type
Array.<PD.BRep.Face>

gableRoofSurfaces(brep, vertices, normal, config [, height]) <static>

Creates the top two surfaces of a gable roof.

A gable roof consists of two inclined planes that meet in the middle of a base quad to form a central ridge.

The vertices array must contain at least four (4) points that define a convex coplanar quadrilateral, with the order of vertices illustrated below. This shape actually requires six (6) points, where the last two will be automatically computed and added to the array if required.

     3-----------------------------------2
      \                                _/
       \                             _/
        5---------------------------4                   _.-._
         \                        _/               _.-'       '-._
          \                     _/            _.-'                 '-._
           0-------------------1            1  -  -  -  -   -  -  -  -  2
Parameters:
Name Type Argument Description
brep PD.BRep

The BRep to receive the roof shape.

vertices Array.<PD.Point>

A list of at least 4 points defining the boundary.

normal THREE.Vector3

The normalised surface normal of the boundary.

config object

A configuration object.

Properties of config:
Name Type Description
angle number

The angle of the roof surfaces, in degrees.

height number <optional>

The Z-axis height of roof surfaces above ground level, defaults to 0.

Returns:

Returns an array of two (2) roof faces.

Type
Array.<PD.BRep.Face>

gableRoofWithCeiling(brep, vertices, normal, config [, height]) <static>

Creates a gable roof shape with an inclined ceiling beneath it.

A gable roof consists of two inclined planes that meet in the middle of a base quad to form a central ridge, as well as the end planes and and optional gutter depth.

The vertices array must contain at least four (4) points that define a convex coplanar quadrilateral, with the order of vertices illustrated below. This shape actually requires six (6) points, where the last two will be automatically computed and added to the array if required.


     3------------------------------------2
      \ -  -  -  -  -  -  -  -  -  -  - _/
       \            [1]               _/
        5----------------------------4               _.-4-._
         \          [0]            _/            _.-'_.-'''-._'-._
          \ -  -  -  -  -  -  -  _/         _.-'_.-'          '-._'-._
           0--------------------1          1 +'                    '+ 2 - + - height
                                           6-+                      +-+ - + - base

Parameters:
Name Type Argument Description
brep PD.BRep

The BRep to receive the roof shape.

vertices Array.<PD.Point>

A list of at least 4 points defining the boundary.

normal THREE.Vector3

The surface normal or 'up' vector of the boundary.

config BIM.Roofs | object

A roof type component or POJO configuration object.

Properties of config:
Name Type Argument Description
angle number <optional>

The angle of the roof surfaces in degrees, defaults to 30.

ceilingStyle number <optional>

Defines the ceiling/gutter style (0:Flat, 1:Gutter, 2:Normal, 3:Horizontal, 4=Vertical), defaults to 1.

roofThickness number <optional>

The thickness of the inclined roof surface, defaults to PD.GlobalState.defaultSlabDepth.

eavesWidth number <optional>

The horizontal width of the eaves, defaults to the roof thickness.

eavesDepth number <optional>

The vertical depth of the eaves, defaults to the roof thickness.

height number <optional>

The Z-axis height of roof surfaces above ground level, defaults to 0.

Returns:

Returns an array of two (2) roof faces.

Type
Array.<PD.BRep.Face>

gambrelRoofShape(brep, vertices, normal, config [, height] [, base]) <static>

Creates the top surfaces of a gambrel roof with an optional base.

A gambrel roof consists of four inclined planes, where the bottom two planes are inclined at different angles to the top two planes.

The vertices array must contain at least four (4) points that define a convex coplanar quadrilateral, with the order of vertices illustrated below. This shape actually requires ten (10) points, where the last six will be automatically computed and added to the array if required.

    3------------------------------------2
    |                                    |
    6------------------------------------7
    |                                    |                 _.-'-._
    8------------------------------------9            _.-'         '-._
    |                                    |          +                   +
    4------------------------------------5        _/                     \_
    |                                    |      _/                         \_
    0------------------------------------1     1  -  -  -  -  -  -  -  -  -  2 - + - height
                                               |                             |
                                               +-----------------------------+ - + - 0.0
Parameters:
Name Type Argument Description
brep PD.BRep

The BRep to receive the roof shape.

vertices Array.<PD.Point>

A list of at least 4 points defining the boundary.

normal THREE.Vector3

The normalised surface normal of the boundary.

config object

A configuration object.

Properties of config:
Name Type Argument Description
heightLower number <optional>

The height of the lower roof area, defaults to 5' (60") or 1500mm.

angleLower number <optional>

The pitch angle of the lower roof area in degrees, defaults to 75.

angleUpper number <optional>

The pitch angle of the upper roof area, in degrees, defaults to 25.

height number <optional>

The Z-axis height of roof surfaces above ground level, defaults to 0.

base number | Array.<PD.Point> <optional>

The Z-axis position of the shape base from roof surfaces, or a list of one or more boundary points, defaults to 0.

Returns:

Returns an array of four (4) roof faces.

Type
Array.<PD.BRep.Face>

gambrelRoofSurfaces(brep, vertices, normal, config [, height]) <static>

Creates the top surfaces of a gambrel roof element.

A gambrel roof consists of four inclined planes, where the bottom two planes are inclined at different angles to the top two planes.

The vertices array must contain at least four (4) points that define a convex coplanar quadrilateral, with the order of vertices illustrated below. This shape actually requires ten (10) points, where the last six will be automatically computed and added to the array if required.

    3------------------------------------2
    |                [1]                 |
    6------------------------------------7
    |                [3]                 |                 _.-'-._
    8------------------------------------9            _.-'         '-._
    |                [2]                 |          +                   +
    4------------------------------------5        _/                     \_
    |                [0]                 |      _/                         \_
    0------------------------------------1     1  -  -  -  -  -  -  -  -  -  2
Parameters:
Name Type Argument Description
brep PD.BRep

The BRep to receive the roof shape.

vertices Array.<PD.Point>

A list of at least 4 points defining the boundary.

normal THREE.Vector3

The normalised surface normal of the boundary.

config object

A configuration object.

Properties of config:
Name Type Argument Description
heightLower number <optional>

The height of the lower roof area, defaults to 5' (60") or 1500mm.

angleLower number <optional>

The pitch angle of the lower roof area in degrees, defaults to 75.

angleUpper number <optional>

The pitch angle of the upper roof area, in degrees, defaults to 25.

height number <optional>

The Z-axis height of roof surfaces above ground level, defaults to 0.

Returns:

Returns an array of four (4) roof faces.

Type
Array.<PD.BRep.Face>

gambrelRoofWithCeiling(brep, vertices, normal, config [, height]) <static>

Creates a gambrel roof with an inclined ceiling beneath it.

A gambrel roof consists of four inclined planes, where the bottom two planes are inclined at different angles to the top two planes.

The vertices array must contain at least four (4) points that define a convex coplanar quadrilateral, with the order of vertices illustrated below. This shape actually requires ten (10) points, where the last six will be automatically computed and added to the array if required.

    3------------------------------------2
    |                 [1]                |
    6------------------------------------7
    |                 [3]                |                 _.-'-._
    8------------------------------------9            _.-' _.-'-._ '-._
    |                 [2]                |          +' +-'         '-+ '+
    4------------------------------------5        _/ _/               \_ \_
    |                 [0]                |      _/ _/                   \_ \_
    0------------------------------------1     1  +  -  -  -  -  -  -  -  +  2 - + - height
                                               +--+                       +--+ - + - eavesDepth
Parameters:
Name Type Argument Description
brep PD.BRep

The BRep to receive the roof shape.

vertices Array.<PD.Point>

A list of at least 4 points defining the boundary.

normal THREE.Vector3

The surface normal or 'up' vector of the boundary.

config BIM.Roofs | object

A roof type component or POJO configuration object.

Properties of config:
Name Type Argument Description
heightLower number <optional>

The height of the lower roof area, defaults to 5' (60") or 1500mm.

angleLower number <optional>

The pitch angle of the lower roof area in degrees, defaults to 75.

angleUpper number <optional>

The pitch angle of the upper roof area, in degrees, defaults to 25.

ceilingStyle number <optional>

Defines the ceiling/gutter style (0:Flat, 1:Gutter, 2:Normal, 3:Horizontal, 4=Vertical), defaults to 1.

roofThickness number <optional>

The thickness of the inclined roof surface, defaults to PD.GlobalState.defaultSlabDepth.

eavesWidth number <optional>

The horizontal width of the eaves, defaults to the roof thickness.

eavesDepth number <optional>

The vertical depth of the eaves, defaults to the roof thickness.

height number <optional>

The Z-axis height of roof surfaces above ground level, defaults to 0.

Returns:

Returns an array of four (4) roof faces.

Type
Array.<PD.BRep.Face>

geodesicDome(brep, center, radius [, detail]) <static>

Creates a geodesic dome as a series of triangular faces.

Parameters:
Name Type Argument Description
brep PD.BRep

The BRep to receive the dome shape.

center THREE.Vector3

The position of the center of the dome.

radius THREE.Vector3 | number

The radius of the dome, in model units, as a number, vector or vector array.

detail number <optional>

The level of triangulation detail (0 to 16), defaults to 5.

Returns:

Returns an array of faces.

Type
Array.<PD.BRep.Face>

hipRoofShape(brep, vertices, normal, config [, height] [, base]) <static>

Creates the top surfaces of a hip roof with an optional base.

A hip roof consists of four inclined planes that meet in the middle of a base quad to form a central ridge. The angle of inclination for all planes is typically the same, unless the two end triangular planes intersect each other in which case their angles are modified to create a pyramid shape.

The vertices array must contain at least four (4) points that define a convex coplanar quadrilateral, with the order of vertices illustrated below. This shape actually requires six (6) points, where the last two will be automatically computed and added to the array if required.

    3---------------------2
     \''..              _/ \
      \   ''..        _/    \
       \      _5-----4.      \                  _______
        \   _/         ''..   \            _.-'         '-._
         \ /               ''..\      _.-'                   '-._
          0---------------------1    0----------------------------1 - + - height
                                     +----------------------------+ - + - 0.0
Parameters:
Name Type Argument Description
brep PD.BRep

The BRep to receive the roof shape.

vertices Array.<PD.Point>

A list of at least 4 points defining the boundary.

normal THREE.Vector3

The normalised surface normal of the boundary.

config object

A configuration object.

Properties of config:
Name Type Description
angle number

The angle of the roof surfaces, in degrees.

height number <optional>

The Z-axis height of roof surfaces above ground level, defaults to 0.

base number | Array.<PD.Point> <optional>

The Z-axis position of the shape base from roof surfaces, or a list of one or more boundary points, defaults to 0.

Returns:

Returns an array of four (4) roof faces.

Type
Array.<PD.BRep.Face>

hipRoofSurfaces(brep, vertices, normal, config [, height]) <static>

Creates the top surfaces of a hip roof element.

A hip roof consists of four inclined planes that meet in the middle of a base quad to form a central ridge. The angle of inclination for all planes is typically the same, unless the two end triangular planes intersect each other in which case their angles are modified to create a pyramid shape.

The vertices array must contain at least four (4) points that define a convex coplanar quadrilateral, with the order of vertices illustrated below. This shape actually requires six (6) points, where the last two will be automatically computed and added to the array if required.

    3---------------------2
     \''..              _/ \
      \   ''..        _/    \
       \      _5-----4.      \                  _______
        \   _/         ''..   \            _.-'         '-._
         \ /               ''..\      _.-'                   '-._
          0---------------------1    0----------------------------1
Parameters:
Name Type Argument Description
brep PD.BRep

The BRep to receive the roof shape.

vertices Array.<PD.Point>

A list of at least 4 points defining the boundary.

normal THREE.Vector3

The normalised surface normal of the boundary.

config object

A configuration object.

Properties of config:
Name Type Description
angle number

The angle of the hip roof surfaces, in degrees.

height number <optional>

The Z-axis height of roof surfaces above ground level, defaults to 0.

Returns:

Returns an array of four (4) roof faces.

Type
Array.<PD.BRep.Face>

hipRoofWithCeiling(brep, vertices, normal, config [, height]) <static>

Creates the top surfaces of a hip roof element.

A hip roof consists of four inclined planes that meet in the middle of a base quad to form a central ridge. The angle of inclination for all planes is typically the same, unless the two end triangular planes intersect each other in which case their angles are modified to create a pyramid shape.

The vertices array must contain at least four (4) points that define a convex coplanar quadrilateral, with the order of vertices illustrated below. This shape actually requires six (6) points, where the last two will be automatically computed and added to the array if required.

    3---------------------2
     \''..              _/ \
      \   ''..   2/3  _/    \
       \      _5-----4.      \                  _______
        \   _/   0/1   ''..   \            _.-'_.-----._'-._
         \ /               ''..\      _.-'_.-'           '-._'-._
          0---------------------1    0  +                     +  1 - + - height
                                     +--+                     +--+ - + - base
Parameters:
Name Type Argument Description
brep PD.BRep

The BRep to receive the roof shape.

vertices Array.<PD.Point>

A list of at least 4 points defining the boundary.

normal THREE.Vector3

The surface normal or 'up' vector of the boundary.

config BIM.Roofs | object

A roof type component or POJO configuration object.

Properties of config:
Name Type Argument Description
angle number <optional>

The angle of the roof surfaces in degrees, defaults to 30.

ceilingStyle number <optional>

Defines the ceiling/gutter style (0:Flat, 1:Gutter, 2:Normal, 3:Horizontal, 4=Vertical), defaults to 1.

roofThickness number <optional>

The thickness of the inclined roof surface, defaults to PD.GlobalState.defaultSlabDepth.

eavesWidth number <optional>

The horizontal width of the eaves, defaults to the roof thickness.

eavesDepth number <optional>

The vertical depth of the eaves, defaults to the roof thickness.

height number <optional>

The Z-axis height of roof surfaces above ground level, defaults to 0.

Returns:

Returns an array of four (4) roof faces.

Type
Array.<PD.BRep.Face>

hippedGableRoofShape(brep, vertices, normal, config [, height] [, base]) <static>

Creates the top surfaces of a hipped gable roof with an optional base.

A hipped gable roof consists of four inclined planes that meet in the middle of a base quad to form a central ridge. The angle of inclination for all planes is typically the same, unless the two end triangular end planes intersect each other in which case their angles are modified to create a pyramid shape.

The vertices array must contain at least four (4) points that define a convex coplanar quadrilateral, with the order of vertices illustrated below. This shape actually requires six (6) points, where the last two will be automatically computed and added to the array if required.

   3---------------------2
    \                     \
     8.                   _7
      \''-.              /  \
       \   '5-----------4.   \              _____________________
        \ .'              ''..\           _/                     \_
         9                    '6        _/                         \_
          \                     \      :                             :
           0---------------------1     0-----------------------------1 - + - height
                                       |                             |
                                       +-----------------------------+ - + - 0.0
Parameters:
Name Type Argument Description
brep PD.BRep

The BRep to receive the roof shape.

vertices Array.<PD.Point>

A list of at least 4 points defining the boundary.

normal THREE.Vector3

The normalised surface normal of the boundary.

config object

A configuration object.

Properties of config:
Name Type Description
angle number

The angle of the roof surfaces, in degrees.

fraction number

The fractional ridge offset of the hip triangles (0 to 1).

height number <optional>

The Z-axis height of roof surfaces above ground level, defaults to 0.

base number | Array.<PD.Point> <optional>

The Z-axis position of the shape base from roof surfaces, or a list of one or more boundary points, defaults to 0.

Returns:

Returns an array of four (4) roof faces.

Type
Array.<PD.BRep.Face>

hippedGableRoofSurfaces(brep, vertices, normal, config [, height]) <static>

Creates the top surfaces of a hipped gable roof element.

A hipped gable roof consists of four inclined planes that meet in the middle of a base quad to form a central ridge. The angle of inclination for all planes is typically the same, unless the two end triangular end planes intersect each other in which case their angles are modified to create a pyramid shape.

The vertices array must contain at least four (4) points that define a convex coplanar quadrilateral, with the order of vertices illustrated below. This shape actually requires six (6) points, where the last two will be automatically computed and added to the array if required.

   3---------------------2
    \                     \
     8.                   _7
      \''-.              /  \
       \   '5-----------4.   \              _____________________
        \ .'              ''..\           _/                     \_
         9                    '6        _/                         \_
          \                     \      :                             :
           0---------------------1     0-----------------------------1
Parameters:
Name Type Argument Description
brep PD.BRep

The BRep to receive the roof shape.

vertices Array.<PD.Point>

A list of at least 4 points defining the boundary.

normal THREE.Vector3

The normalised surface normal of the boundary.

config object

A configuration object.

Properties of config:
Name Type Argument Description
angle number <optional>

The angle of the roof surfaces in degrees, defaults to 30.

fraction number <optional>

The fractional ridge offset of the hip triangles (0 to 1), defaults to 0.5.

height number <optional>

The Z-axis height of roof surfaces above ground level, defaults to 0.

Returns:

Returns an array of four (4) roof faces.

Type
Array.<PD.BRep.Face>

hippedGableRoofWithCeiling(brep, vertices, normal, config [, height]) <static>

Creates hipped gable roof with an inclined ceiling beneath it.

A hipped gable roof consists of four inclined planes that meet in the middle of a base quad to form a central ridge. The angle of inclination for all planes is typically the same, unless the two end triangular end planes intersect each other in which case their angles are modified to create a pyramid shape.

The vertices array must contain at least four (4) points that define a convex coplanar quadrilateral, with the order of vertices illustrated below. This shape actually requires six (6) points, where the last two will be automatically computed and added to the array if required.

   3---------------------2
    \                     \
     8.                   _7
      \''-.              /  \
       \   '5-----------4.   \               ___________________
        \ .'              ''..\            _/_-----------------_\_
         9                    '6         _/_/                   \_\_
          \                     \       / /                       \ \
           0---------------------1     0-+                         +-1 - + - height
                                       +-+                         +-+ - + - base
Parameters:
Name Type Argument Description
brep PD.BRep

The BRep to receive the roof shape.

vertices Array.<PD.Point>

A list of at least 4 points defining the boundary.

normal THREE.Vector3

The normalised surface normal of the boundary.

config BIM.Roofs | object

A roof type component or POJO configuration object.

Properties of config:
Name Type Argument Description
angle number <optional>

The angle of the roof surfaces in degrees, defaults to 30.

fraction number <optional>

The fractional ridge offset of the hip triangles (0 to 1), defaults to 0.5.

roofThickness number <optional>

The thickness of the inclined roof surface, defaults to PD.GlobalState.defaultSlabDepth.

eavesWidth number <optional>

The horizontal width of the eaves, defaults to the roof thickness.

eavesDepth number <optional>

The vertical depth of the eaves, defaults to the roof thickness.

height number <optional>

The Z-axis height of roof surfaces above ground level, defaults to 0.

Returns:

Returns an array of four (4) roof faces.

Type
Array.<PD.BRep.Face>

loftBetweenFaces(brep, face1, face2 [, reverse]) <static>

Lofts new faces between two given faces.

Parameters:
Name Type Argument Description
brep PD.BRep

The BRep to receive the dome shape.

face1 PD.BRep.Face

The face within the given shape to loft from.

face2 PD.BRep.Face

The face within the given shape to loft to.

reverse boolean <optional>

Whether or not to reverse surface orientations, defaults to false.

Returns:

Returns an array of faces.

Type
Array.<PD.BRep.Face>

mansardRoofShape(brep, vertices, normal, config [, height] [, base]) <static>

Creates the top surfaces of a mansard roof with an optional base.

A mansard roof consists of eight inclined planes, where the bottom four planes are inclined at different angles to the top four planes. A Dutch gable is where the end triangle planes (5,6,8 and 7,4,9) are vertical.

The vertices array must contain at least four (4) points that define a convex coplanar quadrilateral, with the order of vertices illustrated below. This shape actually requires ten (10) points, where the last six will be automatically computed and added to the array if required.

    3------------------------------------2
    | '.                              .' |
    |   7----------------------------6   |                      ____________
    |   | '.                      .' |   |                 _.-'              '-._
    |   |   9--------------------8   |   |            _.-'                        '-._
    |   | .'                      '. |   |          +----------------------------------+
    |   4----------------------------5   |        _/                                    \_
    | .'                              '. |      _/                                        \_
    0------------------------------------1     0--------------------------------------------1 - + - height
                                               |                                            |
                                               +--------------------------------------------+ - + - 0.0
Parameters:
Name Type Argument Description
brep PD.BRep

The BRep to receive the roof shape.

vertices Array.<PD.Point>

A list of at least 4 points defining the boundary.

normal THREE.Vector3

The normalised surface normal of the boundary.

config BIM.Roofs | object

A roof type component or POJO configuration object.

Properties of config:
Name Type Argument Description
heightLower number <optional>

The height of the lower roof area.

angleLower number <optional>

The pitch angle of the lower roof area, in degrees.

angleUpper number <optional>

The pitch angle of the upper roof area, in degrees.

dutchGable number <optional>

The factor for turning the mansard shape into a Dutch gable (0 to 1).

height number <optional>

The Z-axis height of roof surfaces above ground level, defaults to 0.

base number | Array.<PD.Point> <optional>

The Z-axis position of the shape base from roof surfaces, or a list of one or more boundary points, defaults to 0.

Returns:

Returns an array of eight (8) roof faces.

Type
Array.<PD.BRep.Face>

mansardRoofSurfaces(brep, vertices, normal, config [, height]) <static>

Creates the top surfaces of a mansard roof element.

A mansard roof consists of eight inclined planes, where the bottom four planes are inclined at different angles to the top four planes. A Dutch gable is where the end triangle planes (5,6,8 and 7,4,9) are vertical.

The vertices array must contain at least four (4) points that define a convex coplanar quadrilateral, with the order of vertices illustrated below. This shape actually requires ten (10) points, where the last six will be automatically computed and added to the array if required.

    3------------------------------------2
    | '.              [2]             .' |
    |   7----------------------------6   |                      ____________
    |   | '.          [6]         .' |   |                 _.-'              '-._
    |[3]|[7]9--------------------8[5]|[1]|            _.-'                        '-._
    |   | .'          [4]         '. |   |          +----------------------------------+
    |   4----------------------------5   |        _/                                    \_
    | .'              [0]             '. |      _/                                        \_
    0------------------------------------1     0--------------------------------------------1
Parameters:
Name Type Argument Description
brep PD.BRep

The BRep to receive the roof shape.

vertices Array.<PD.Point>

A list of at least 4 points defining the boundary.

normal THREE.Vector3

The normalised surface normal of the boundary.

config BIM.Roofs | object

A roof type component or POJO configuration object.

Properties of config:
Name Type Argument Description
heightLower number <optional>

The height of the lower roof area, defaults to 1500mm or 5' (60").

angleLower number <optional>

The pitch angle of the lower roof area in degrees, defaults to 75.

angleUpper number <optional>

The pitch angle of the upper roof area in degrees, defaults to 25.

dutchGable number <optional>

The factor for turning the mansard shape into a Dutch gable (0 to 1), defaults to 0.

height number <optional>

The Z-axis height of roof surfaces above ground level, defaults to 0.

Returns:

Returns an array of eight (8) roof faces.

Type
Array.<PD.BRep.Face>

mansardRoofWithCeiling(brep, vertices, normal, config [, height]) <static>

Creates a mansard roof with an inclined ceiling beneath it.

A mansard roof consists of eight inclined planes, where the bottom four planes are inclined at different angles to the top four planes. A Dutch gable is where the end triangle planes (5,6,8 and 7,4,9) are vertical.

The vertices array must contain at least four (4) points that define a convex coplanar quadrilateral, with the order of vertices illustrated below. This shape actually requires ten (10) points, where the last six will be automatically computed and added to the array if required.

    3------------------------------------2
    | '.                              .' |
    |   7----------------------------6   |                      ____________
    |   | '.                      .' |   |                 _.-'              '-._
    |   |   9--------------------8   |   |            _.-'                        '-._
    |   | .'                      '. |   |          +----------------------------------+
    |   4----------------------------5   |        _/                                    \_
    | .'                              '. |      _/                                        \_
    0------------------------------------1     0--------------------------------------------1 - + - height
                                               |                                            |
                                               +--------------------------------------------+ - + - 0.0
Parameters:
Name Type Argument Description
brep PD.BRep

The BRep to receive the roof shape.

vertices Array.<PD.Point>

A list of at least 4 points defining the boundary.

normal THREE.Vector3

The surface normal or 'up' vector of the boundary.

config BIM.Roofs | object

A roof type component or POJO configuration object.

Properties of config:
Name Type Argument Description
heightLower number <optional>

The height of the lower roof area.

angleLower number <optional>

The pitch angle of the lower roof area, in degrees.

angleUpper number <optional>

The pitch angle of the upper roof area, in degrees.

dutchGable number <optional>

The factor for turning the mansard shape into a Dutch gable (0 to 1).

angle number <optional>

The angle of the roof surfaces in degrees, defaults to 30.

ceilingStyle number <optional>

Defines the ceiling/gutter style (0:Flat, 1:Gutter, 2:Normal, 3:Horizontal, 4=Vertical), defaults to 1.

roofThickness number <optional>

The thickness of the inclined roof surface, defaults to PD.GlobalState.defaultSlabDepth.

eavesWidth number <optional>

The horizontal width of the eaves, defaults to the roof thickness.

eavesDepth number <optional>

The vertical depth of the eaves, defaults to the roof thickness.

height number <optional>

The Z-axis height of roof surfaces above ground level, defaults to 0.

Returns:

Returns an array of eight (8) roof faces.

Type
Array.<PD.BRep.Face>

offsetRoofFaces(brep, faces, distance) <static>

Offsets the given faces by the specified distance.

This method assumes that the faces have been generated by the xxxRoofSurfaces() methods in this class, and thus that they are planar all and share the same vertices along each coincident edges. This allows the average surfaces normals of each vertex to be calculated accurately, and thus the offset vectors.

Parameters:
Name Type Description
brep PD.BRep

The BRep to add the shape to.

faces Array.<PD.BRep.Face>

The faces to offset.

distance number

The distance to offset the faces.

Returns:

Returns an array of the new offset faces.

Type
Array.<PD.BRep.Face>

pavilionRoofShape(brep, vertices, normal, config [, height] [, base]) <static>

Creates the top surfaces of a pavilion roof with an optional base.

A pavilion roof consists of four inclined planes that all meet at a central apex point to form a pyramid.

The vertices array must contain at least four (4) points that define a convex coplanar quadrilateral, with the order of vertices illustrated below. This shape actually requires five (5) points, where the last one will be automatically computed and added to the array if required.

    3---------------2
     \''..        _/ \
      \   ''..  _/    \
       \      _4       \
        \   _/   ''..   \             _.-'-._
         \ /         ''..\       _.-'         '-._
          0---------------1    0-------------------1 - + - height
                               |                   |
                               +-------------------+ - + - 0.0
Parameters:
Name Type Argument Description
brep PD.BRep

The BRep to receive the roof shape.

vertices Array.<PD.Point>

A list of at least 4 points defining the boundary.

normal THREE.Vector3

The normalised surface normal of the boundary.

config object

A configuration object.

Properties of config:
Name Type Description
angle number

The angle of the roof surfaces, in degrees.

height number <optional>

The Z-axis height of roof surfaces above ground level, defaults to 0.

base number | Array.<PD.Point> <optional>

The Z-axis position of the shape base from roof surfaces, or a list of one or more boundary points, defaults to 0.

Returns:

Returns an array of four (4) roof faces.

Type
Array.<PD.BRep.Face>

pavilionRoofSurfaces(brep, vertices, normal, config [, height]) <static>

Creates the top surfaces of a pavilion roof element.

A pavilion roof consists of four inclined planes that all meet at a central apex point to form a pyramid.

The vertices array must contain at least four (4) points that define a convex coplanar quadrilateral, with the order of vertices illustrated below. This shape actually requires five (5) points, where the last one will be automatically computed and added to the array if required.

    3---------------2
     \''..        _/ \
      \   ''..  _/    \
       \      _4       \
        \   _/   ''..   \             _.-'-._
         \ /         ''..\       _.-'         '-._
          0---------------1    0-------------------1
Parameters:
Name Type Argument Description
brep PD.BRep

The BRep to receive the roof shape.

vertices Array.<PD.Point>

A list of at least 4 points defining the boundary.

normal THREE.Vector3

The normalised surface normal of the boundary.

config object

A configuration object.

Properties of config:
Name Type Description
angle number

The angle of the roof surfaces, in degrees.

height number <optional>

The Z-axis height of roof surfaces above ground level, defaults to 0.

Returns:

Returns an array of four (4) roof faces.

Type
Array.<PD.BRep.Face>

pavilionRoofWithCeiling(brep, vertices, normal, config [, height]) <static>

Creates a pavilion (pyramid) roof with an inclined ceiling beneath it.

A pavilion roof consists of four inclined planes that all meet at a central apex point to form a pyramid.

The vertices array must contain at least four (4) points that define a convex coplanar quadrilateral, with the order of vertices illustrated below. This shape actually requires five (5) points, where the last one will be automatically computed and added to the array if required.

    3---------------2
     \''..        _/ \
      \   ''..  _/    \
       \      _4       \
        \   _/   ''..   \             _.-'-._
         \ /         ''..\       _.-'         '-._
          0---------------1    0-------------------1 - + - height
                               |                   |
                               +-------------------+ - + - 0.0
Parameters:
Name Type Argument Description
brep PD.BRep

The BRep to receive the roof shape.

vertices Array.<PD.Point>

A list of at least 4 points defining the boundary.

normal THREE.Vector3

The surface normal or 'up' vector of the boundary.

config BIM.Roofs | object

A roof type component or POJO configuration object.

Properties of config:
Name Type Argument Description
angle number <optional>

The angle of the roof surfaces in degrees, defaults to 30.

ceilingStyle number <optional>

Defines the ceiling/gutter style (0:Flat, 1:Gutter, 2:Normal, 3:Horizontal, 4=Vertical), defaults to 1.

roofThickness number <optional>

The thickness of the inclined roof surface, defaults to PD.GlobalState.defaultSlabDepth.

eavesWidth number <optional>

The horizontal width of the eaves, defaults to the roof thickness.

eavesDepth number <optional>

The vertical depth of the eaves, defaults to the roof thickness.

height number <optional>

The Z-axis height of roof surfaces above ground level, defaults to 0.

Returns:

Returns an array of four (4) roof faces.

Type
Array.<PD.BRep.Face>

prism(brep, contour, coords, distance) <static>

Generates a prism by extruding in the local Z-axis direction a shape created from the coordinates of points in the given contour.

The coordinates of the points that make up the contour will be translated and rotated based on the given local coordinate system (LCS), so must be specified relative to its origin. Thus, to extrude the contour in place, the LCS should use the global origin {0,0,0}. Any origin other than the global origin will translate the prism as well as rotating it.

Parameters:
Name Type Description
brep PD.BRep

The BRep to add the shape to.

contour Array.<PD.Point>

A set of points whose X and Y coordinates define a closed boundary.

coords PD.LocalCoords

The local coordinate system to use, extruding in the local Z axis.

distance number

The distance to extrude in the local Z axis.

Returns:

Returns an array of faces.

Type
Array.<PD.BRep.Face>

revolveSections(brep, sections, coords [, scale] [, startAngle] [, endAngle] [, axialSegments]) <static>

Revolves 2D curve sections around the Z-axis of the given local coordinate system.

This method generates a series of curves faces, each a surface of revolution created from the various sections of a 2D shape. The sections can be scaled and the start/end angles specified to control the extent of the revolution.

It is important to note that any part of the a section with a negative X coordinate will very likely generate invalid 3D geometry as those faces may be inside the volume of the final shape.

If you have a THREE.Shape instance, use the PD.BRep.Factory.revolveShape method instead, or use the PD.BRep.Factory.convertShapeToSections method to convert the shape into sections compatible with this method.

Parameters:
Name Type Argument Description
brep PD.BRep

The BRep to add revolved shape to.

sections Array.<Array.<THREE.Vector2>>

The 2D linear and/or curved sections to revolve.

coords PD.LocalCoords

The local coordinate system to use, revolving around the local Z axis.

scale THREE.Vector3 <optional>

The scale to apply to each local axis, defaults to {x:1,y:1,z:1}.

startAngle number <optional>

The start rotation angle (-360 to 360), defaults to 0.

endAngle number <optional>

The end rotation angle (-360 to 360), defaults to 360.

axialSegments number <optional>

The number of segments to sample curves in (3 to 360), defaults to 36.

Returns:

Returns an array of faces.

Type
Array.<PD.BRep.Face>

revolveShape(brep, shape, coords [, scale] [, startAngle] [, endAngle] [, axialSegments] [, curveSegments]) <static>

Revolves a 2D shape around the Z-axis of the given local coordinate system.

This method generates a series of curves faces, each a surface of revolution created from the various sections of a 2D shape. The shape can be scaled and the start/end angles specified to control the extent of the revolution.

It is important to note that any part of the 2D shape with a negative X coordinate will very likely generate invalid 3D geometry as those faces may be inside the volume of the final shape.

Parameters:
Name Type Argument Description
brep PD.BRep

The BRep to add revolved shape to.

shape THREE.Shape

The 2D shape to revolve.

coords PD.LocalCoords

The local coordinate system to use, revolving around the local Z axis.

scale THREE.Vector3 <optional>

The scale to apply to each local axis, defaults to {x:1,y:1,z:1}.

startAngle number <optional>

The start rotation angle (-360 to 360), defaults to 0.

endAngle number <optional>

The end rotation angle (-360 to 360), defaults to 360.

axialSegments number <optional>

The number of segments to revolve in (3 to 360), defaults to 36.

curveSegments number <optional>

The number of segments to sample curves in (2 to 360), defaults to 12.

Returns:

Returns an array of faces.

Type
Array.<PD.BRep.Face>

roundedPrismByPath(brep, path, contourIndex [, offset] [, radius] [, height] [, reverse] [, curveSegments] [, curveThreshold]) <static>

Adds an extruded prism with rounded top and side edges.

This method requires a PD.Path to follow as it relies on the precalculated trigonometric data for each path point. It also requires the path normal to be facing updates, which can be done by calling the PD.Path#ensureUpwardsNormal method. If you are processing a polygonal path with multiple contours, ensure that each internal hole faces downwards by setting the reverseInner argument of the ensureUpwardsNormal() method to true.

        _+---------+_
       |\ \        :\\
       | \:\       : \\
       |  \ 4----------3'
 X     |  :| |     : : ||
  .     \ +|-|- - - +  ||
   .     \ | |       . ||
    +  Z  \| |        .||
     \ :   '0----------1'
      \:
       + - - - - > Y
      path

The method returns an object containing either the top and bottom faces or the top and bottom edges, depending on whether the radius is positive or negative. If the radius is positive, the curves will orient inwards relative to the path, so the top and bottom infill faces will be returned. If the radius is negative, the curves will orient outwards, so the top and bottom edges are returned. You can see how to manage these two cases in the example below.

NOTE: This method reuses vertices and facets already in the BRep, so must only be used between calls to reuseStart() and reuseEnd().

Parameters:
Name Type Argument Description
brep PD.BRep

The BRep to add the shape to.

path BIM.Path

The polyline or element path to extrude.

contourIndex number

The index of the contour to sweep along.

offset number <optional>

A sideways offset from the path, defaults to 0.

radius number <optional>

The fillet radius for the top and sides, defaults to 250.

height number <optional>

The extrusion height, defaults to 2400mm or 8' (96").

reverse boolean <optional>

Whether or not to reverse the orientation of each polygon, defaults to false.

curveSegments number <optional>

The number of segments to sample curves in (2 to 360), defaults to 8.

curveThreshold number <optional>

The angle between surfaces at which to draw edges in degrees (0 to 45), defaults to 20deg.

Returns:

Returns an object with top and bot properties containing either two faces or two edges.

Type
object
Example
this.brep.reuseStart();
 this.brep.hasVertexAttributes = true;
 this.brep.hasUniqueEdges = true;

 /// Moderate curve accuracy based on the top radius.
 const curve_segments = Math.round(PD.Utils.mapAndConstrainTo(this.topRadius, 0, 1000, 2, 16));

 /// External boundary up, holes up or down if polygon.
 this.path.ensureUpwardsNormal(true, this.path.isPolygon);

 if (this.path.isPolygon) {

     const contour_count = this.path.contours.length;

     /// Create rounded prism for outer boundary in path.
     const faces = PD.BRep.Factory.roundedPrismByPath(this.brep, this.path, 0, this.outerOffset, this.topRadius, this.height, false, curve_segments);

     if (contour_count > 1) {

         /// Add inner contours with negative radius.
         for (let ii = 1; ii < contour_count; ++ii) {
             const hole = PD.BRep.Factory.roundedPrismByPath(this.brep, this.path, ii, -this.innerOffset, -this.topRadius, this.height, false, curve_segments);
             if (hole.top) this.brep.addHoleToFace(faces.top, hole.top, true);
             if (hole.bot) this.brep.addHoleToFace(faces.bot, hole.bot, true);
         }

         faces.top.update(this.brep);
         faces.top.computeVertexNormals();
         faces.bot.update(this.brep);
         faces.bot.computeVertexNormals();

     }

 }

 else { /// Create rounded prism for each contour in path.
     for (let ii = 0; ii < this.path.contours.length; ++ii) {
         PD.BRep.Factory.roundedPrismByPath(this.brep, this.path, ii, this.outerOffset, this.topRadius, this.height, false, curve_segments);
     }
 }

 this.brep.reuseEnd();

sphere(brep, coords [, radiusX] [, radiusY] [, radiusZ]) <static>

Generates a spherical shape consisting of two hemispherical curved faces.

              , - ~ ' ~ - ,
          , '               ' ,
        ,           Z           ,
       ,            | Y          ,
      ,             |/            ,
      ,       -- -- + -- -- X     ,
      ,            /|             ,
       ,          / |            ,
        ,                       ,
          ,                  , '
            ' - , _ _ _ ,  '
Parameters:
Name Type Argument Description
brep PD.BRep

The BRep to add the shape to.

coords PD.LocalCoordinates | null

The local coordinate system to use, defaults to Cartesian axis at the origin.

radiusX number <optional>

The radius of the hemisphere in the local X axis, defaults to 1000mm (1m).

radiusY number <optional>

The radius of the hemisphere in the local Y axis, defaults to radiusX.

radiusZ number <optional>

The radius of the hemisphere in the local Z-axis, defaults to radiusX.

Returns:

Returns a list of added faces.

Type
Array.<PD.BRep.Face>

sweepShapeByPath(brep, sections, path, contourIndex [, reverse] [, curveSegments]) <static>

Adds a shape created by sweeping a profile along a path.

This method requires a PD.Path to follow as it relies on the precalculated trigonometric data for each path point. It also requires the path normal to be facing upwards, which can be done by calling the PD.Path#ensureUpwardsNormal method. If you are processing a polygonal path with multiple contours, ensure that each internal hole faces downwards by setting the reverseInner argument of the ensureUpwardsNormal() method to true.

The method returns an object containing either the top and bottom faces or the top and bottom edges, depending on whether the radius is positive or negative. If the radius is positive, the curves will orient inwards relative to the path, so the top and bottom infill faces will be returned. If the radius is negative, the curves will orient outwards, so the top and bottom edges are returned. You can see how to manage these two cases in the example below.

NOTE: This method reuses vertices and facets already in the BRep, so must only be used between calls to reuseStart() and reuseEnd().

Parameters:
Name Type Argument Description
brep PD.BRep

The BRep to add geometry to.

sections Array.<Array.<THREE.Vector2>>

The 2D curve sections to sweep.

path BIM.Path

The polyline or element path to extrude.

contourIndex number

The index of the contour to sweep along.

reverse boolean <optional>

Whether or not to reverse the orientation of each polygon, defaults to false.

curveSegments number <optional>

The number of segments to sample shape curves, defaults to 12.

Returns:

Returns an object with top and bot properties containing either two faces or two edges.

Type
object
Example
this.brep.reuseStart();
 this.brep.hasVertexAttributes = true;
 this.brep.hasUniqueEdges = true;

 /// Moderate curve accuracy based on the top radius.
 const curve_segments = Math.round(PD.Utils.mapAndConstrainTo(this.topRadius, 0, 1000, 2, 16));

 /// External boundary up, holes up or down if polygon.
 this.path.ensureUpwardsNormal(true, this.path.isPolygon);

 if (this.path.isPolygon) {

     const contour_count = this.path.contours.length;

     /// Create rounded prism for outer boundary in path.
     const faces = PD.BRep.Factory.sweepShapeByPath(this.brep, this.path, 0, false, curve_segments);

     if (contour_count > 1) {

         /// Add inner contours with negative radius.
         for (let ii = 1; ii < contour_count; ++ii) {
             const hole = PD.BRep.Factory.sweepShapeByPath(this.brep, this.path, ii, false, curve_segments);
             if (hole.top) this.brep.addHoleToFace(faces.top, hole.top, true);
             if (hole.bot) this.brep.addHoleToFace(faces.bot, hole.bot, true);
         }

         faces.top.update(this.brep);
         faces.top.computeVertexNormals();
         faces.bot.update(this.brep);
         faces.bot.computeVertexNormals();

     }

 }

 else { /// Create rounded prism for each contour in path.
     for (let ii = 0; ii < this.path.contours.length; ++ii) {
         PD.BRep.Factory.sweepShapeByPath(this.brep, this.path, ii, this.outerOffset, this.topRadius, this.height, false, curve_segments);
     }
 }

 this.brep.reuseEnd();

wedge(brep, coords, size [, taperHeight] [, taperWidth]) <static>

Generates a wedge, which is similar to a cuboid but with an angled top and possibly also sides.

         Z
         |
         |                         Y
         4-------------------5._  /
         |'' 3---------------|--'2
  height |  /                |  /
         | /                 | /
         |/                  |/
         0-------------------1 -- -- X
                 width

A wedge shape tapers in the direction of the local +Y axis. It typically tapers in height, but may also taper in width.

The taper height can be given as a single number or as an array containing the bottom and top heights at the taper end.

The taper width can also be given as a single number or as an array containing the left and right X-axis values at the taper end.

Parameters:
Name Type Argument Description
brep PD.BRep

The BRep to add the shape to.

coords PD.LocalCoordinates | null

The local coordinate system to use, defaults to Cartesian axis at the origin.

size THREE.Vector3 | Array.<number>

The size of the shape in each local axis as an {x,y,z} object or [x,y,z] array.

taperHeight number | Array.<number> <optional>

The height at the tapered end in the local Z-axis or a [min_z,max_z] array, defaults to [0,0].

taperWidth number | Array.<number> <optional>

The width at the tapered end in the local X-axis or a [min_x,max_x] array, defaults to [0,width].

Returns:

Returns one or more faces.

Type
Array.<PD.BRep.Face>