Riser

Creating a Riser element for the new Stair tool

Example object for this post can be downloaded here.

Since the new Stair and Railing tools have been introduced in ARCHICAD 21, Riser library elements can be scripted for the Stair tool in GDL. This post helps getting through the available Stair riser 3D global variables under the Riser Component subtype.

Origo of the Riser

The origo of a Riser is on the intersection of the Walking Line and the bottom of the Tread. The edited Walking Line Symbol is not considerated into the position of the origo.

! Sizes
_coordSize	= 0.1
_shapeSize	= 0.01
_smallThk	= 0.001

! Local coordinate system
sphere _smallThk

pen 58					! X axis, red pen
lin_ 0, 0, 0, _coordSize, 0, 0
pen 4					! Y axis, green pen
lin_ 0, 0, 0, 0, _coordSize, 0
pen 46					! Z axis, blue pen
lin_ 0, 0, 0, 0, 0, _coordSize

Geometry of the Riser

The geometry of a Riser is given in the STAIR_RISER_GEOMETRY[][3] global variable. Each Riser can be edited separately, so this global gives the geometry of the actual Riser, relative to the position of the Riser’s origo. The sequence of the nodes is continuous, the global variable provides a polyline geometry which describes the Riser.

The following script shows the values of this global variable graphically in 3D. Spheres are placed to the node coordinates, the angle is shown by an arc and an arrow, measured from the direction of the Riser original local coordinate system’s X axis.

for _vert = 1 to vardim1(STAIR_RISER_GEOMETRY)
    add STAIR_RISER_GEOMETRY[_vert][1], STAIR_RISER_GEOMETRY[_vert][2], 0
    sphere _shapeSize

    roty 90
    cylind _coordSize/2, _smallThk

    rotz 90
    addz _coordSize/2 - _shapeSize
    roty 90
    if STAIR_RISER_GEOMETRY[_vert][3] < EPS then 
        mulz -1
    endif

    elbow _coordSize/2 - _shapeSize, abs(STAIR_RISER_GEOMETRY[_vert][3]), _smallThk

    if STAIR_RISER_GEOMETRY[_vert][3] < EPS then
        del 1
    endif
    del 4

    rotz STAIR_RISER_GEOMETRY[_vert][3]
    roty 90
    cylind _coordSize/2, _smallThk

    addz _coordSize/2
    cone _shapeSize * 2, _smallThk * 4, 0, 90, 90

    del 4
next _vert

Note that the clockwise arc directions are represented as negative values to the in the Riser's coordinate system.

Riser sizes and slanting angle

The following script draws a block from the origo of the Riser's local coordinate system. The block is rotated around the X axis by the value of the RISER_SLANT_ANGLE, for its thickness the RISER_THICKNESS global variable, for its height the RISER_HEIGHT global variable is used. The width of the block is 0.05 meter.

mulz -1
rotx -(90 - RISER_SLANT_ANGLE)
block _coordSize, RISER_THICKNESS, RISER_HEIGHT
del 2

Riser position information

In the Stair tool the relative position of the Riser and the Tread can be defined:

The global variable values are filled according to this checkbox, but this information could be still needed. The ac_RiserPosition Fix named optional parameter stores the value 0 if the Riser on Tread checkbox is checked, otherwise its value is 1.


Creating a Riser tube

Based on the STAIR_RISER_GEOMETRY[][3] global variable, we can create a tube for the Riser. The TUBE command does not accept arcs as path edges, so in this example the generated Riser ignores the curved edges.

The sides of the Riser should fit to the boundary of the Stair - which geometry is not known in the Riser element. However, the RISER_CUT[2][2] global variable defines the tube path closing points, which determines the normal of the surfaces according to the Stair boundary (blue spheres on the picture below).

The following script creates a Riser tube, using global variables for the Riser sizes and the tube path:

! Get Riser Path
for _vert = 1 to vardim1(STAIR_RISER_GEOMETRY)
    put STAIR_RISER_GEOMETRY[_vert][1], STAIR_RISER_GEOMETRY[_vert][2], 0, 0
next _vert

! Draw a Tube on the Riser Path
tube 4, 2 + nsp / 4, 1 + 2 + 16 + 32,
    0, 0, 0,
    -RISER_THICKNESS / sin(RISER_SLANT_ANGLE), 0, 0,
    -RISER_THICKNESS / sin(RISER_SLANT_ANGLE) - RISER_HEIGHT / tan(RISER_SLANT_ANGLE), -RISER_HEIGHT, 0,
    -RISER_HEIGHT / tan(RISER_SLANT_ANGLE), -RISER_HEIGHT, 0,

    RISER_CUT[1][1], RISER_CUT[1][2], 0, 0,
    get(nsp),
    RISER_CUT[2][1], RISER_CUT[2][2], 0, 0