Skip to content

Stair flights not yet drawn: monolithic spiral runs, riserless runs with a nosing, and nosing profiles #357

Open

Description

@DrunkOnJava

RE-52 draws 34 of Snowdon Towers' 43 stair flights as their treads and risers. This tracks the other 9 and the residuals, with what is measured so far.

Monolithic runs: geometry measured, one flag missing

Revit's IFC4 geometry of run 2061630 (type 168815, "3/4" Nosing", 2.5 in structural depth), as [along, up] from the run's sketch origin:

  • Each riser leans from the step's inner corner (u_{k-1} + N, (k-1)h) up to its nosing (u_{k-1}, kh), the slanted flag of the run type.
  • Each tread runs from its nosing to the next inner corner.
  • The underside is one straight line. It runs parallel to the line through the inner corners, one structural depth below it measured square to the pitch: 0.2225 ft vertically at h = 0.375, tread 1 ft, which is 0.2083 ft (2.5 in) square to the pitch.
  • Type 951855 ("Solid Base") closes the profile down to the floor instead.

The missing piece is Revit's "End with Riser" run setting:

  • 2061630 has 17 riser lines, and its flight riser count is 17. Revit draws 16 risers and ends the run with a tread at the 17th line.
  • 2234674 (13 lines, 12 risers) and 1563804 (3 lines, 2 risers) end with a tread too.
  • The 34 drawn runs all end with a riser.

No byte at a fixed offset from the run's data header or from its riser-count anchor separates the two groups, so the setting is stored elsewhere. Until it is read, these runs keep their box.

Other residuals

  • Upright-riser nosing (4 flights). Revit shapes the nosing with the type's nosing profile, a family. The tread's front is 0.0625 ft thick and chamfers back. rvt-rs draws it square.
  • First riser on a landing (run 1240916). Revit carries it one tread thickness below the landing top.
  • Riserless runs, type 1557288 (3 flights). Treads overhang the run's sides by 0.083 ft, and no read field gives that. The byte at +0xb9 of the run type is 3 on this type only. Separate treads also need a multi-solid body.
  • Spiral runs (2 flights). Their sketch is arcs, not the straight lines run_sketch reads.

Oracles: Snowdon Towers with Revit's IFC4 export (local only). Measured with the RE-52 probe and scoring script.

Activity

  1. DrunkOnJava commented on Sep 24, 2026

    @DrunkOnJava
    OwnerAuthor

    Two more places the "End with Riser" run setting is not, on Snowdon Towers (measured negative, 2026-09-24). The runs are split into the 34 that RE-52 draws, which end with a riser, and the three that end with a tread (2061630, 2234674, 1563804).

    • The run's element record prologue. Over its 0x88 bytes, read as 34 u32 words, no word is equal across the three and different from all 34. Flags, placement kind and the second-prologue flag are the same in both groups. Reference-list lengths vary within each group (5, 6 and 8 against 7, 8 and 9).
    • BuiltInParameter entries in the run's element data. In 0x3000 bytes from the element-data header, entries shaped i64 BuiltInParameter · u32 value, as material data keeps them (RE-58), number only 25, across 14 of the 37 runs. The run data does not keep its instance parameters in that form, so the setting cannot be read off such an entry.

    Together with the fixed offsets from the data header and the riser-count anchor (already negative), this rules out the run's own header and anchor regions. What is left is the stair's data (runs are its sub-elements) or a separate parameter store.

  2. DrunkOnJava commented on Sep 24, 2026

    @DrunkOnJava
    OwnerAuthor

    A near-miss in the stair's own data, not the run's. Each tread-ending run is the only run of its stair: 1501921, 2060002 and 2120094.

    In the stair's element data, the riser count sits at STAIR_DIMENSIONS_ANCHOR + 88. The words after it read 01 00 00 00 · 00 01 01 XX · 01 00 00 00, and over all 21 Snowdon stairs:

    stair's runs XX (byte +99) = 1 XX = 0
    end with a tread 2 (1501921, 2060002) 1 (2120094)
    end with a riser 0 18

    So byte +99 is not the End-with-Riser setting, but it may be a related one, such as the monolithic run construction that 1501921 and 2060002 share. Neighbouring bytes (+96, +97, +100) vary within each group. What follows is a variable-length u32 list (runs of 1, then 0), then 03 00 00 00 · ff ff ff ff fa 0e, so fixed offsets beyond +100 compare unrelated fields.

    Next: read that u32 list as per-step flags. Its length and its trailing zeros may encode the last step.

  3. DrunkOnJava commented on Sep 24, 2026

    @DrunkOnJava
    OwnerAuthor

    The u32 list after byte +100 of the stair's data is not a per-step list (measured negative, 2026-09-24, all 21 Snowdon stairs).

    • It opens another structure. From STAIR_DIMENSIONS_ANCHOR + 100 the words read 1 · ffffffff · 0x0efd · 0 ×8 · 0x20000 · 0 ×5 · 0x20000 · 0xff0b0000 · ffffffff · 0x00ffffff · N · 1 ×N · 0 ×3. Three stairs carry 0x10efd in place of 0x0efd, with a different layout after it: 1501921 and 2120094, which end with a tread, and 832580, which ends with a riser. 0x0efd and 0x10efd are shaped like class tags.
    • N does not follow the riser count.
      • N is 22 on 12 stairs with 19 to 26 risers.
      • It is 74 on 688457 (30 risers), 31 on 881948 (20 risers) and 12 on 2060002 (17 risers).
    • Neither the 0x0efd/0x10efd split nor N separates the stairs whose runs end with a tread (1501921, 2060002, 2120094) from the 18 whose runs end with a riser.

    Together with the earlier negatives, the "End with Riser" setting is in none of these:

    • the run's element-record prologue;
    • its element-data header region or riser-count anchor;
    • its BuiltInParameter entries;
    • the stair's bytes around the riser count, up to the structure that follows.

    The run type is not it either. The tread-ending runs use types that no riser-ending run uses: 2061630 and 2234674 use 168815, and 1563804 uses 1565035. The 34 drawn runs use 613941 and 168810. That correlation turns out to be coincidence:

    • 1565035 ("2" Tread 1" Nosing 1/4" Riser (Wood)") and 168810 (the same name without "(Wood)") read the same on every RE-52 value.
    • Their type objects (01 00 00 00 · u64 id, tag db 0f) are byte-identical up to the name, except two u64 ElementId slots at +0xa1 and +0xa9. Those are unset on 168810 and set on 1565035: its tread and riser materials.
    • So nothing in the type object separates a type whose run ends with a tread from one whose runs end with a riser.

    The three tread-ending runs keep their box. Every stored location examined so far is negative. The setting is a run instance parameter in Revit, so it is presumably kept outside the structures read here, such as an instance parameter table not yet located.

  4. DrunkOnJava commented on Sep 24, 2026

    @DrunkOnJava
    OwnerAuthor

    Two more places the End with Riser setting is not (measured negative, 2026-09-24, Snowdon Towers, the 3 tread-ending runs against 30 riser-ending runs):

    • The data around a run's second ElementId copy. Every run's id appears twice, 0x3c apart: once in its record-chain entry and once in its element-data header, the double-keyed shape RE-22 and RE-29 read room and IFC-override parameters from. Across 0x800 bytes aligned on that id, one byte separates the groups (−0x196, 57 on the tread-ending runs). It lies before the data, and the other runs take many values there, so it is coincidence.
    • Tagged frames in the run's data. Read as u32 value · u16 tag frames (as the ff ff ff ff fb 03 stair anchor is two unset frames), only 7 tags occur exactly once in every run's first 0x5a0 data bytes. None of them has a value that is the same on the three tread-ending runs and absent from the others.

    Negatives so far on this setting:

    • the run record prologue;
    • fixed offsets from the run's data header and riser anchor;
    • BuiltInParameter entries;
    • the stair's words after anchor+100;
    • the run type object;
    • the run's double-keyed data and its once-per-run frames.

    The three runs keep their box.

  5. DrunkOnJava commented on Sep 28, 2026

    @DrunkOnJava
    OwnerAuthor

    Riserless runs (type 1557288), measured on Revit's IFC4 mesh of run 746486 (10 risers):

    • The body is 9 separate treads, one per step except the top, which the landing carries. Each tread is the type's 2.5 in tread thickness.
    • Each tread spans from its riser line to the next one, plus the 3 in nosing: 1.1667 ft = 0.9167 + 0.25.
    • At the top face each tread is 0.0833 ft wider than the run on both sides. At the bottom face it is 0.0625 ft narrower than that, on the sides and at the front. That is a profile chamfer, like the upright types' nosing.
    • The run type holds no 1/12 ft value within 0x200 bytes of its id (searched as f64). What sets it apart is +0xb9 = 3, where every other run type has 0. That is consistent with Revit's "Apply Nosing Profile" option being Front, Left and Right, with the 1 in coming from the nosing profile family's geometry, which is not decoded. It is one type in one file, so this is not ruled on.

    Drawing these runs would also need a body of several solids per flight. They keep their box for now.

    Now handled by #464 (RE-92): End with Riser is read, and monolithic runs are drawn. Snowdon goes from 34 to 38 of 43 flights drawn. Still open: riserless (above), spiral (arc sketch), the upright nosing profile, and the first riser starting on a landing.

  6. added
    area:elements
    area:geometry
    priority:P2
    type:feature
    on Sep 30, 2026
  7. puzzbobb commented on Oct 5, 2026

    @puzzbobb
    Contributor

    The "End with Riser" setting is a named member of the run's own record: StairsRun.m_endWithRiser, next to m_beginWithRiser. The schema in Formats/Latest declares both, so they can be read by name with native_parameters::decode_graph instead of searched for at offsets. The probe below does that for every StairsRun and StairsRunType record. On Snowdon Towers Architectural it decodes all 43 runs and 8 run types.

    m_endWithRiser (m_beginWithRiser is true on all 43):

    runs m_endWithRiser
    1563804, 2234674 (two of your three tread-ending runs) false
    2061630 (the third) true
    1647253 false
    the other 39 true

    So it gives two of the three. Two things I can't settle from here:

    • 2061630 reads true. Its type, 168815, has StairsRunType.m_hasRiser false and m_hasMonolithicSupport true (below). For a monolithic type with no riser elements, "ends with a riser" may be met by the riser line and not drawn as a riser. Its riser indices also differ from the other two: m_topRiserIndex 17 against m_lastRiser 16, where 1563804 and 2234674 have 2/2 and 12/12. That difference doesn't separate the groups on its own, though: 20 riser-ending runs also have top = last + 1.
    • 1647253 reads false, with m_topRiserIndex 2 = m_lastRiser, like 1563804. Is it one of RE-52's 34 drawn runs? If so, Revit's IFC body of it would show whether it actually ends with a tread.

    The run types, which bear on the other residuals:

    type m_hasRiser m_riserIsSlanted m_hasMonolithicSupport m_riserTreadConnection
    168810, 1565035 true false false 0
    613941 true true false 1
    168815, 176831, 951855 false true true 0
    809789 false false false 0
    1557288 (your riserless type) false false false 0

    1557288 has no riser and no monolithic support, which matches the separate-treads body you measured. Its +0xb9 = 3 is not one of these four members. The slanted flag you read for the monolithic runs is m_riserIsSlanted.

    Measured on my copy of Snowdon Towers Architectural (sha256 8ac90a85…, written by Revit 2025). Its ElementIds match the ones in this issue, but please rerun on yours.

    Probe: examples/probe_357_stairs_run_members.rs (one JSON line per record; rustfmt and clippy -D warnings clean on c5f7e43)
    //! #357: the stair-run settings, read by member name from each record's
    //! own schema rather than at byte offsets.
    //!
    //! FACTS, each printed here for every `StairsRun` and `StairsRunType`
    //! record of every file given (channel 102, outside `ContentKey` blocks,
    //! decoded with `native_parameters::decode_graph`):
    //!
    //! 1. `StairsRun` declares `m_beginWithRiser` and `m_endWithRiser`, and the
    //!    riser indices `m_topRiserIndex`, `m_firstRiser`, `m_lastRiser`.
    //! 2. `StairsRunType` declares `m_hasRiser`, `m_riserIsSlanted`,
    //!    `m_hasMonolithicSupport` and `m_riserTreadConnection`.
    //!
    //! ```text
    //! cargo run --profile ci --example probe_357_stairs_run_members -- FILE.rvt ...
    //! ```
    
    use rvt::RevitFile;
    use rvt::compression::prepare_stream_for_inflate;
    use rvt::native_parameters::decode_graph;
    use rvt::native_segments;
    use rvt::schema_registry;
    use serde_json::{Value, json};
    use std::io::Read;
    
    const RUN_MEMBERS: &[&str] = &[
        "m_beginWithRiser",
        "m_endWithRiser",
        "m_topRiserIndex",
        "m_firstRiser",
        "m_lastRiser",
    ];
    const TYPE_MEMBERS: &[&str] = &[
        "m_hasRiser",
        "m_riserIsSlanted",
        "m_hasMonolithicSupport",
        "m_riserTreadConnection",
    ];
    
    /// Every value stored under `key` anywhere in a decoded field tree.
    fn find<'a>(v: &'a Value, key: &str, out: &mut Vec<&'a Value>) {
        match v {
            Value::Object(map) => {
                for (k, x) in map {
                    if k == key {
                        out.push(x);
                    }
                    find(x, key, out);
                }
            }
            Value::Array(items) => items.iter().for_each(|x| find(x, key, out)),
            _ => {}
        }
    }
    
    fn main() {
        for path in std::env::args().skip(1) {
            if let Err(e) = probe(&path) {
                println!("{}", json!({ "file": path, "error": format!("{e:#}") }));
            }
        }
    }
    
    fn probe(path: &str) -> anyhow::Result<()> {
        let file = std::path::Path::new(path)
            .file_name()
            .map(|n| n.to_string_lossy().into_owned())
            .unwrap_or_default();
        let mut rf = RevitFile::open(path)?;
        let release = rf.basic_file_info()?.version;
        let stored = rf.read_stream("Formats/Latest")?;
        let mut schema = Vec::new();
        flate2::bufread::GzDecoder::new(prepare_stream_for_inflate("Formats/Latest", &stored).as_ref())
            .read_to_end(&mut schema)?;
        let registry = schema_registry::parse(&schema)?;
        let id_bytes = if release >= 2024 { 8 } else { 4 };
        let wanted = ["StairsRun", "StairsRunType"];
    
        let names: Vec<String> = rf
            .stream_names()
            .into_iter()
            .filter(|n| n.starts_with("Partitions/"))
            .collect();
        for stream in &names {
            let stored = rf.read_stream(stream)?;
            let prepared = prepare_stream_for_inflate(stream, &stored);
            native_segments::walk(&prepared, &registry, 1 << 30, |source, bytes| {
                if source.content_key.is_some() || source.channel != 102 {
                    return Ok(());
                }
                let header = id_bytes + 8;
                let mut pos = 0;
                while pos + header <= bytes.len() {
                    let id = if id_bytes == 4 {
                        u64::from(u32::from_le_bytes(bytes[pos..pos + 4].try_into()?))
                    } else {
                        u64::from_le_bytes(bytes[pos..pos + 8].try_into()?)
                    };
                    let len =
                        u32::from_le_bytes(bytes[pos + header - 4..pos + header].try_into()?) as usize;
                    let body = &bytes[pos + header..pos + header + len];
                    pos += header + len + 4;
                    let Some(class) = body
                        .get(..2)
                        .and_then(|b| registry.class(u16::from_le_bytes([b[0], b[1]])))
                    else {
                        continue;
                    };
                    if !wanted.contains(&class.name.as_str()) {
                        continue;
                    }
                    let members = if class.name == "StairsRun" {
                        RUN_MEMBERS
                    } else {
                        TYPE_MEMBERS
                    };
                    let line = match decode_graph(body, &registry) {
                        Ok(graph) => {
                            let mut values = serde_json::Map::new();
                            for m in members {
                                let mut found = Vec::new();
                                for object in &graph.objects {
                                    find(&object.fields, m, &mut found);
                                }
                                values.insert((*m).into(), json!(found));
                            }
                            json!({ "file": file, "release": release, "stream": stream,
                                    "id": id, "class": class.name, "members": values })
                        }
                        Err(e) => json!({ "file": file, "stream": stream, "id": id,
                                          "class": class.name, "error": format!("{e:#}") }),
                    };
                    println!("{line}");
                }
                Ok(())
            })?;
        }
        Ok(())
    }
  8. 85 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:elementsarea:geometrypriority:P2type:feature

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions