Skip to content

feat(ifc): every element's IsExternal as Revit's exporter sets it: the parameter named for its set, its type's Function, else its class (RE-193) - #814

Merged
DrunkOnJava merged 13 commits into
mainfrom
feat/is-external
Oct 19, 2026
Merged

DrunkOnJava merged 13 commits into
mainfrom
feat/is-external

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Oct 19, 2026 •

Copy link
Copy Markdown
Owner

Summary

Every element's IsExternal is now written as Revit's exporter sets it. Revit's exporter reads a Yes/No parameter named for the property set first (Pset_WallCommon.IsExternal on a wall). Failing that, it calculates the value: a parameter named IsExternal, then the type's Function, then a roof's category, otherwise not external. rvt-rs wrote IsExternal only on doors and floors, from their type's Function (RE-158). Report: RE-193.

Motivation

Revit's export of the BIM4LCA office writes IsExternal on 12,375 elements of the as-built file; rvt-rs wrote 295 of them, 29 different from Revit's. The office defines a project parameter for each of twelve common sets' IsExternal (Pset_WallCommon.IsExternal, Pset_CurtainWallCommon.IsExternal, ...), and where rvt-rs reads the one named for the set Revit writes, it is Revit's value every time. revit-ifc's pset definitions explain why: PropertySetEntry("Pset_WallCommon.IsExternal", "IsExternal") (CLEANROOM.md source 5, read and cited).

Changes

  • src/native_wall_types.rs (new): a wall's type Function from the native records (m_WallAttributesId, then the type's m_function, RE-185). No wall type holds a FUNCTION_PARAM entry.
  • src/partition_schema_mvp.rs:
    • attach_type_functions reads every group's type Function, and attach_wall_type_functions the native one of a wall and of a curtain panel wall after RE-72 relabels it (2024 and 2025).
    • attach_is_external attaches each parameter named IsExternal or <set>.IsExternal an element carries, and the calculated value (IS_EXTERNAL_FIELD), following CategoryUtil.IsElementExternal.
    • Walls, curtain walls, curtain panel walls, doors, windows, floors and building pads get no calculated value without a Function or parameter: fail closed. A window never takes its host's value (6 of 18 on the R2025 models). Curtain mullions and panels get none. The last step, not external, applies on 2024 and 2025 only, the releases measured.
  • src/partition_room_parameters.rs: scan_integer_parameters reads several parameters in one pass over each stream's memoised data objects, without a backward search per entry (the first commit of this change made the office export 16 s slower).
  • src/ifc/export_content.rs: IsExternal goes in the common set of the entity actually written, from the parameter named for that set, else the calculated value. A space's goes in the Pset_SpaceCommon it already writes.
  • Fixtures:
    • Core Interior's property-set count 5,908 → 6,164: each of its 256 columns gains a Pset_ColumnCommon.
    • Its two rvt-rs witness observations are refreshed from CI's artifact; the verdicts regenerate byte-identically.
    • tests/space_common.rs leaves IsExternal out of RE1's comparison: that reference export is IFC2X3 Coordination View 2.0, whose Pset_SpaceCommon has no IsExternal.
  • examples/probe_re193_is_external.rs and tools/re/is_external_vs_ifc.py: the probe and its step-by-step scorer.
  • reports/element-framing/RE-193-is-external.md, CHANGELOG, README (new row), docs/status.md, docs/supported-profile.md, and a new ifc-is-external entry in docs/support-matrix.json.

Testing

  • Research: runs 39186463760, 39188815941 and 39190678462 score each step of the rule against Revit's export (RE-193 §4).

  • Measure A/B against main (f612f97), run 39194883495, IsExternal values:

    main this PR
    As built: equal, of Revit's 12,375 266 2,110
    As built: different 29 0
    At building permit: equal, of Revit's 12,420 268 2,118
    At building permit: different 27 0
    Reference and R2025 models: equal, of Revit's 310 13 245
    Reference and R2025 models: different 0 0
    • All property values: as built, equal 12,687 → 14,531 and different 36 → 7; at permit, 12,651 → 14,501 and 34 → 7.
    • Values Revit does not write: +85 and +86 on the office files, and +789 on the reference and R2025 models, 732 of them on Core Interior, whose Revit export carries no property values.
  • Samples: run 39192700482, 42 of 64 hashed exports identical. The 2024 and 2025 samples gain values; two 2026 and two 2027 samples gain 2 to 6; none loses any.

  • Curtain panel walls (after Bugbot's review): runs 39199638398 and 39199640105 against the commit before change only Snowdon Towers' architectural sample, whose panel walls now take their native Function; the office, reference and R2025 exports are byte-identical.

  • Time: on one runner, Core Interior 3.7 s → 4.0 s and the RE1 models 2 to 7 % longer (run 39194885426). The office files are not in that comparison; on the A/B's separate runners the as-built export takes 10.3 s against main's 12.5 s.

  • Not shown: curtain mullions and panels. On the office, members of one type on the same external curtain walls are 8,460 times not external and 397 times external, so no value is written for them.

cargo fmt is clean. No unit tests, by the repository's rule: the existing RE1 test changes only by leaving out the property its IFC2X3 reference cannot have.

Audit-honesty checklist

  • README / docs reflect the current state after this PR
  • Commit messages describe what changed and why
  • No emojis in code, docs, or commit messages
  • No private paths, personal email addresses, or internal jargon in committed files
  • New limitations documented: mullions and panels, windows without a Function, Core Interior's extra values, the releases measured (RE-193 §6)
  • Reverse-engineering finding: dated report RE-193, with its probe examples/probe_re193_is_external.rs

Legal and contribution hygiene

  • I agree this work is licensable under Apache-2.0
  • This PR contains no Autodesk proprietary source, decompiled internals, or NDA'd SDK content

Contributor declaration (CLEANROOM.md). The change rests on:

  • byte observations of the BIM4LCA office, RE1 and R2025 files, compared with Revit's own IFC exports of them (accepted source 1);
  • buildingSMART's IFC4 and IFC2x3 property set definitions (source 4);
  • reading Autodesk's open-source exporter revit-ifc (source 5): CategoryUtil.IsElementExternal, PropertySetEntryMap.CreatePropertyFromElementOrSymbol and its pset definitions.

No revit-ifc code is copied or translated.

Breaking changes

None. TYPE_FUNCTION_FIELD now also carries a wall type's native Function, and the RE-158 door and floor rule is subsumed.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

Bugbot Autofix prepared fixes for both issues found in the latest run.

  • ✅ Fixed: IsExternal dropped on later years
    • Named-parameter scanning stays limited to measured 2024–2025 releases, while m_is_external is still attached from type Function (and roofs) on 2024+ without the unmeasured default-false fallback.
  • ✅ Fixed: Panel walls guessed not external
    • CurtainPanelWall is listed with other unknown curtain parts so calculated_is_external returns None and export omits IsExternal instead of writing false.

Create PR

Or push these changes by commenting:

@cursor push c60e62fd80
Preview (c60e62fd80)
diff --git a/src/ifc/export_content.rs b/src/ifc/export_content.rs
--- a/src/ifc/export_content.rs
+++ b/src/ifc/export_content.rs
@@ -1579,12 +1579,59 @@
     .collect()
 }
 
-/// Add `IsExternal` (`IfcBoolean`) to a door's `Pset_DoorCommon` or a
-/// slab's `Pset_SlabCommon` among `sets`, from its type's Function, 0
-/// interior or 1 exterior (RE-158), starting the set when the element has
-/// none (no type name for its `Reference`). Nothing for another Function,
-/// which RE1 does not show, when the type's Function was not read, or for a
-/// door written as its opening alone (RE-84).
+/// The common property set Revit's export writes `IsExternal` in on an
+/// element exported as `ifc_type` (RE-193).
+fn is_external_set(ifc_type: &str) -> Option<&'static str> {
+    Some(match ifc_type {
+        "IFCWALL" | "IFCWALLSTANDARDCASE" => "Pset_WallCommon",
+        "IFCCURTAINWALL" => "Pset_CurtainWallCommon",
+        "IFCDOOR" => "Pset_DoorCommon",
+        "IFCWINDOW" => "Pset_WindowCommon",
+        "IFCSLAB" => "Pset_SlabCommon",
+        "IFCROOF" => "Pset_RoofCommon",
+        "IFCCOLUMN" => "Pset_ColumnCommon",
+        "IFCBEAM" => "Pset_BeamCommon",
+        "IFCMEMBER" => "Pset_MemberCommon",
+        "IFCPLATE" => "Pset_PlateCommon",
+        "IFCCOVERING" => "Pset_CoveringCommon",
+        "IFCRAILING" => "Pset_RailingCommon",
+        "IFCRAMP" => "Pset_RampCommon",
+        "IFCSTAIR" => "Pset_StairCommon",
+        "IFCBUILDINGELEMENTPROXY" => "Pset_BuildingElementProxyCommon",
+        "IFCSPACE" => "Pset_SpaceCommon",
+        _ => return None,
+    })
+}
+
+/// An element's `IsExternal` in its common property set `set` (RE-193): the
+/// Yes/No parameter named `<set>.IsExternal` on the element, which revit-ifc's
+/// property set entry reads before anything else (`PropertySetEntry
+/// ("Pset_WallCommon.IsExternal", "IsExternal")` in its pset definitions,
+/// CLEANROOM.md source 5), else the value Revit's exporter calculates
+/// ([`crate::partition_schema_mvp::IS_EXTERNAL_FIELD`]). `None` where neither
+/// is read.
+fn is_external_value(decoded: &DecodedElement, set: &str) -> Option<bool> {
+    use crate::partition_schema_mvp as mvp;
+    let flag = |wanted: &str| {
+        decoded.fields.iter().find_map(|(name, value)| match value {
+            InstanceField::Bool(flag) if name == wanted => Some(*flag),
+            _ => None,
+        })
+    };
+    flag(&format!(
+        "{}{set}.{}",
+        mvp::NAMED_PARAMETER_FIELD_PREFIX,
+        mvp::IS_EXTERNAL_PARAMETER_NAME
+    ))
+    .or_else(|| flag(mvp::IS_EXTERNAL_FIELD))
+}
+
+/// Add `IsExternal` (`IfcBoolean`) to the common property set of the entity
+/// an element is exported as, among `sets` ([`is_external_value`], RE-193),
+/// starting the set when the element has none (no type name for its
+/// `Reference`). Nothing where no value is read, for a door written as its
+/// opening alone (RE-84), or for a space, whose set
+/// [`space_common_property_set`] writes.
 fn add_is_external(
     sets: &mut Vec<PropertySet>,
     ifc_type: &str,
@@ -1594,23 +1641,11 @@
     if opening_only {
         return;
     }
-    let common = match ifc_type {
-        "IFCDOOR" => "Pset_DoorCommon",
-        "IFCSLAB" => "Pset_SlabCommon",
-        _ => return,
+    let Some(common) = is_external_set(ifc_type).filter(|set| *set != "Pset_SpaceCommon") else {
+        return;
     };
-    let function = decoded.fields.iter().find_map(|(name, value)| match value {
-        InstanceField::Integer { value, .. }
-            if name == crate::partition_schema_mvp::TYPE_FUNCTION_FIELD =>
-        {
-            Some(*value)
-        }
-        _ => None,
-    });
-    let external = match function {
-        Some(0) => false,
-        Some(1) => true,
-        _ => return,
+    let Some(external) = is_external_value(decoded, common) else {
+        return;
     };
     let property = Property {
         name: "IsExternal".into(),
@@ -1869,9 +1904,9 @@
 }
 
 /// A room's or an Area's `Pset_SpaceCommon` (RE-153, #763), as Revit's
-/// export writes it: `Reference` (`IfcIdentifier`) its name and number, and
-/// a room's `FloorCovering` (`IfcLabel`) its Floor Finish. `None` when
-/// neither was read.
+/// export writes it: `Reference` (`IfcIdentifier`) its name and number, a
+/// room's `FloorCovering` (`IfcLabel`) its Floor Finish, and `IsExternal`
+/// (RE-193). `None` when none was read.
 fn space_common_property_set(decoded: &DecodedElement) -> Option<PropertySet> {
     use crate::partition_schema_mvp as mvp;
     if decoded.class != "Room" && decoded.class != "Area" {
@@ -1901,6 +1936,12 @@
             value: PropertyValue::Label(finish),
         });
     }
+    if let Some(external) = is_external_value(decoded, "Pset_SpaceCommon") {
+        properties.push(Property {
+            name: "IsExternal".into(),
+            value: PropertyValue::Boolean(external),
+        });
+    }
     (!properties.is_empty()).then(|| PropertySet {
         name: "Pset_SpaceCommon".into(),
         properties,

diff --git a/src/lib.rs b/src/lib.rs
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -185,6 +185,7 @@
 pub mod native_saved_mesh;
 pub mod native_saved_scene;
 pub mod native_segments;
+pub mod native_wall_types;
 pub mod object_graph;
 pub mod parse_mode;
 pub mod part_atom;

diff --git a/src/native_wall_types.rs b/src/native_wall_types.rs
new file mode 100644
--- /dev/null
+++ b/src/native_wall_types.rs
@@ -1,0 +1,73 @@
+//! A wall's type Function, from the native records of the wall and its
+//! type (RE-185, RE-193).
+//!
+//! A wall's native record names its type in `m_WallAttributesId`, and the
+//! type's record holds its Function as `m_function`, the enum Revit's API
+//! calls `WallFunction`: 0 interior, 1 exterior, then foundation, retaining,
+//! soffit and core shaft. No wall type holds a `FUNCTION_PARAM` entry in its
+//! data object (RE-185), so a wall's Function is read here. It is Revit's
+//! `IsExternal` on RE1 Architecture's 8 walls and on the 117 walls of the
+//! R2025 models (RE-185), and on the 2 walls of the BIM4LCA office no
+//! parameter decides (RE-193).
+
+use crate::{RevitFile, native_document};
+use std::collections::{BTreeMap, BTreeSet};
+
+/// `{"m_id":{"m_id64":n}}` as `n`.
+fn element_id(value: &serde_json::Value) -> Option<u64> {
+    value
+        .pointer("/m_id/m_id64")
+        .and_then(serde_json::Value::as_i64)
+        .and_then(|n| u64::try_from(n).ok())
+}
+
+/// The type Function (`m_function`) of each of `walls`, by the wall's
+/// ElementId: the wall's record names its type, and the type's record holds
+/// the Function. A wall whose type or Function is not found is left out.
+/// Errs where the native record path does not read the file's release.
+pub fn wall_type_functions(
+    rf: &mut RevitFile,
+    walls: &BTreeSet<u64>,
+) -> anyhow::Result<BTreeMap<u64, i64>> {
+    let mut wall_type: BTreeMap<u64, u64> = BTreeMap::new();
+    let options = native_document::Options {
+        selected_ids: walls.clone(),
+        ..native_document::Options::default()
+    };
+    native_document::extract_graphs(rf, &options, |record| {
+        let Some(graph) = record.graph.as_ref() else {
+            return Ok(());
+        };
+        if let Some(type_id) = graph
+            .objects
+            .iter()
+            .find_map(|object| object.fields.get("m_WallAttributesId").and_then(element_id))
+        {
+            wall_type.insert(record.identity.element_id, type_id);
+        }
+        Ok(())
+    })?;
+    let mut function: BTreeMap<u64, i64> = BTreeMap::new();
+    let options = native_document::Options {
+        selected_ids: wall_type.values().copied().collect(),
+        ..native_document::Options::default()
+    };
+    native_document::extract_graphs(rf, &options, |record| {
+        let Some(graph) = record.graph.as_ref() else {
+            return Ok(());
+        };
+        if let Some(value) = graph.objects.iter().find_map(|object| {
+            object
+                .fields
+                .get("m_function")
+                .and_then(serde_json::Value::as_i64)
+        }) {
+            function.insert(record.identity.element_id, value);
+        }
+        Ok(())
+    })?;
+    Ok(wall_type
+        .into_iter()
+        .filter_map(|(wall, type_id)| Some((wall, *function.get(&type_id)?)))
+        .collect())
+}

diff --git a/src/partition_schema_mvp.rs b/src/partition_schema_mvp.rs
--- a/src/partition_schema_mvp.rs
+++ b/src/partition_schema_mvp.rs
@@ -445,8 +445,21 @@
         })
         .collect();
     attach_system_type_names(rf, revit_version, &mut unnamed);
-    // --- A door's and a floor's type Function (RE-158) ---
-    attach_type_functions(rf, revit_version, [&mut out.doors, &mut out.slabs]);
+    // --- Each element's type Function (RE-158), and a wall's from its native
+    // type record (RE-185) ---
+    attach_type_functions(
+        rf,
+        revit_version,
+        [
+            &mut out.walls,
+            &mut out.columns,
+            &mut out.doors,
+            &mut out.windows,
+            &mut out.slabs,
+            &mut out.products,
+        ],
+    );
+    attach_wall_type_functions(rf, revit_version, &mut out.walls);
     // --- Curtain panels that are walls (RE-64) ---
     let mut unnamed_panels: Vec<&mut DecodedElement> = out
         .products
@@ -599,6 +612,21 @@
     attach_door_sizes(rf, revit_version, &mut out.doors);
     // --- Steel beams' and columns' I sections from their type (RE-103, RE-104) ---
     attach_beam_sections(rf, revit_version, &mut out.products);
+    // --- IsExternal: the parameters named for it, and Revit's calculation (RE-193) ---
+    attach_is_external(
+        rf,
+        revit_version,
+        [
+            &mut out.walls,
+            &mut out.columns,
+            &mut out.doors,
+            &mut out.windows,
+            &mut out.slabs,
+            &mut out.rooms,
+            &mut out.areas,
+            &mut out.products,
+        ],
+    );
     Ok(out)
 }
 
@@ -4465,8 +4493,10 @@
     Some((field(CURVE_SIZE_FIELDS[0])?, field(CURVE_SIZE_FIELDS[1])?))
 }
 
-/// Field carrying the Function of an element's type (`FUNCTION_PARAM`: 0
-/// interior, 1 exterior), RE-158.
+/// Field carrying the Function of an element's type: `FUNCTION_PARAM` (0
+/// interior, 1 exterior), RE-158, or a wall type's native `m_function`, the
+/// same values followed by foundation, retaining, soffit and core shaft
+/// (RE-185).
 pub const TYPE_FUNCTION_FIELD: &str = "m_type_function";
 
 /// Give each element of `groups` whose type is known its type's Function,
@@ -4475,7 +4505,7 @@
 fn attach_type_functions(
     rf: &mut RevitFile,
     revit_version: u32,
-    groups: [&mut Vec<DecodedElement>; 2],
+    groups: [&mut Vec<DecodedElement>; 6],
 ) {
     use crate::partition_room_parameters as prp;
     let type_of = |element: &DecodedElement| {
@@ -4503,6 +4533,211 @@
     }
 }
 
+/// Releases whose walls' native type Function is measured (RE-185, RE-193).
+pub const WALL_TYPE_FUNCTION_REVIT_VERSIONS: &[u32] = &[2024, 2025];
+
+/// Give each wall with no [`TYPE_FUNCTION_FIELD`] its type's Function from
+/// the type's native record ([`crate::native_wall_types`], RE-185). Nothing
+/// on a release not measured, or where the native records are not read.
+fn attach_wall_type_functions(
+    rf: &mut RevitFile,
+    revit_version: u32,
+    walls: &mut [DecodedElement],
+) {
+    if !WALL_TYPE_FUNCTION_REVIT_VERSIONS.contains(&revit_version) {
+        return;
+    }
+    let has_function = |element: &DecodedElement| {
+        element
+            .fields
+            .iter()
+            .any(|(name, _)| name == TYPE_FUNCTION_FIELD)
+    };
+    let ids: BTreeSet<u64> = walls
+        .iter()
+        .filter(|element| !has_function(element))
+        .filter_map(|element| element.id.map(u64::from))
+        .collect();
+    if ids.is_empty() {
+        return;
+    }
+    let Ok(functions) = crate::native_wall_types::wall_type_functions(rf, &ids) else {
+        return;
+    };
+    for element in walls.iter_mut() {
+        if has_function(element) {
+            continue;
+        }
+        if let Some(&function) = element.id.and_then(|id| functions.get(&u64::from(id))) {
+            element.fields.push((
+                TYPE_FUNCTION_FIELD.into(),
+                InstanceField::Integer {
+                    value: function,
+                    signed: true,
+                    size: 8,
+                },
+            ));
+        }
+    }
+}
+
+/// Prefix of a field carrying the Yes/No value of a project or shared
+/// parameter on an element, named by the parameter's name (RE-193).
+pub const NAMED_PARAMETER_FIELD_PREFIX: &str = "m_named_parameter:";
+
+/// Prefix of a field carrying the same value on the element's type.
+pub const TYPE_NAMED_PARAMETER_FIELD_PREFIX: &str = "m_type_named_parameter:";
+
+/// The name of the parameter Revit's exporter reads `IsExternal` from (RE-193).
+pub const IS_EXTERNAL_PARAMETER_NAME: &str = "IsExternal";
+
+/// Field carrying the `IsExternal` Revit's exporter calculates for an element
+/// (RE-193), which a parameter named for the property set it is written in
+/// takes precedence over ([`crate::ifc::export_content`]).
+pub const IS_EXTERNAL_FIELD: &str = "m_is_external";
+
+/// Classes whose `IsExternal` Revit's exporter takes from their type's
+/// Function, so one whose Function is not read gets none: a value calculated
+/// without it would be a guess (fail closed). A window's host does not give
+/// it: on the R2025 models the host wall's value is Revit's on 6 of 18.
+const IS_EXTERNAL_FUNCTION_CLASSES: &[&str] = &[
+    "Wall",
+    CURTAIN_WALL_CLASS,
+    "Door",
+    "Window",
+    "Floor",
+    "BuildingPad",
+];
+
+/// Classes whose `IsExternal` is not established: on the BIM4LCA office
+/// Revit's export writes most curtain mullions and panels as not external
+/// where their curtain wall is, and some as external (RE-193).
+const IS_EXTERNAL_UNKNOWN_CLASSES: &[&str] = &[
+    "CurtainWallMullion",
+    "CurtainWallPanel",
+    CURTAIN_PANEL_WALL_CLASS,
+];
+
+/// The `IsExternal` Revit's exporter calculates for `element` (RE-193),
+/// following revit-ifc's `CategoryUtil.IsElementExternal` (CLEANROOM.md
+/// source 5): a parameter named [`IS_EXTERNAL_PARAMETER_NAME`] on the
+/// element, then on its type; its type's Function, external unless interior
+/// (0); a roof is external; otherwise not external. `None` for the classes
+/// whose value cannot be calculated from what is read.
+fn calculated_is_external(element: &DecodedElement, allow_default_false: bool) -> Option<bool> {
+    let flag = |wanted: &str| {
+        element.fields.iter().find_map(|(name, value)| match value {
+            InstanceField::Bool(flag) if name == wanted => Some(*flag),
+            _ => None,
+        })
+    };
+    if let Some(value) = flag(&format!(
+        "{NAMED_PARAMETER_FIELD_PREFIX}{IS_EXTERNAL_PARAMETER_NAME}"
+    ))
+    .or_else(|| {
+        flag(&format!(
+            "{TYPE_NAMED_PARAMETER_FIELD_PREFIX}{IS_EXTERNAL_PARAMETER_NAME}"
+        ))
+    }) {
+        return Some(value);
+    }
+    let function = element.fields.iter().find_map(|(name, value)| match value {
+        InstanceField::Integer { value, .. } if name == TYPE_FUNCTION_FIELD => Some(*value),
+        _ => None,
+    });
+    if let Some(function) = function {
+        return Some(function != 0);
+    }
+    if element.class == "Roof" {
+        return Some(true);
+    }
+    let class = element.class.as_str();
+    if IS_EXTERNAL_FUNCTION_CLASSES.contains(&class) || IS_EXTERNAL_UNKNOWN_CLASSES.contains(&class)
+    {
+        return None;
+    }
+    allow_default_false.then_some(false)
+}
+
+/// Releases where `IsExternal` is measured (RE-193).
+pub const IS_EXTERNAL_REVIT_VERSIONS: &[u32] = &[2024, 2025];
+
+/// Give each element of `groups` the Yes/No parameters named `IsExternal` or
+/// `<property set>.IsExternal` that it carries ([`NAMED_PARAMETER_FIELD_PREFIX`];
+/// for the plain name also its type's, [`TYPE_NAMED_PARAMETER_FIELD_PREFIX`]),
+/// then the value Revit's exporter calculates ([`IS_EXTERNAL_FIELD`]). Revit's
+/// exporter reads `Pset_WallCommon.IsExternal` on a wall before anything else,
+/// and the BIM4LCA office defines one such parameter for each of twelve
+/// property sets (RE-193). Nothing on a release not measured.
+fn attach_is_external(
+    rf: &mut RevitFile,
+    revit_version: u32,
+    mut groups: [&mut Vec<DecodedElement>; 8],
+) {
+    use crate::partition_room_parameters as prp;
+    if revit_version < 2024 {
+        return;
+    }
+    let measured = IS_EXTERNAL_REVIT_VERSIONS.contains(&revit_version);
+    if measured {
+        let type_of = |element: &DecodedElement| {
+            element.fields.iter().find_map(|(name, value)| match value {
+                InstanceField::ElementId { id, .. } if name == TYPE_ID_FIELD => Some(*id),
+                _ => None,
+            })
+        };
+        let parameters: Vec<(String, u32)> = prp::find_parameter_definitions(rf, revit_version)
+            .into_iter()
+            .filter(|(name, _)| {
+                name == IS_EXTERNAL_PARAMETER_NAME
+                    || name.ends_with(&format!(".{IS_EXTERNAL_PARAMETER_NAME}"))
+            })
+            .collect();
+        if !parameters.is_empty() {
+            let owners: BTreeSet<u32> = groups
+                .iter()
+                .flat_map(|elements| elements.iter())
+                .flat_map(|element| element.id.into_iter().chain(type_of(element)))
+                .collect();
+            let values: Vec<(String, BTreeMap<u32, u32>)> = parameters
+                .into_iter()
+                .map(|(name, id)| {
+                    let found =
+                        prp::scan_integer_parameter(rf, revit_version, &owners, i64::from(id));
+                    (name, found)
+                })
+                .collect();
+            for element in groups.iter_mut().flat_map(|elements| elements.iter_mut()) {
+                let type_id = type_of(element);
+                for (name, found) in &values {
+                    if let Some(&value) = element.id.and_then(|id| found.get(&id)) {
+                        element.fields.push((
+                            format!("{NAMED_PARAMETER_FIELD_PREFIX}{name}"),
+                            InstanceField::Bool(value != 0),
+                        ));
+                    }
+                    if let (true, Some(&value)) = (
+                        name == IS_EXTERNAL_PARAMETER_NAME,
+                        type_id.and_then(|id| found.get(&id)),
+                    ) {
+                        element.fields.push((
+                            format!("{TYPE_NAMED_PARAMETER_FIELD_PREFIX}{name}"),
+                            InstanceField::Bool(value != 0),
+                        ));
+                    }
+                }
+            }
+        }
+    }
+    for element in groups.into_iter().flat_map(|elements| elements.iter_mut()) {
+        if let Some(external) = calculated_is_external(element, measured) {
+            element
+                .fields
+                .push((IS_EXTERNAL_FIELD.into(), InstanceField::Bool(external)));
+        }
+    }
+}
+
 /// Field carrying the name of the phase an element was created in
 /// ([`crate::partition_phases`], spike 257).
 pub const PHASE_CREATED_FIELD: &str = "m_phase_created";

You can send follow-ups to the cloud agent here.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 2112fc294947f3ce5aea0a24c3a27984024be2dd. Configure here.

Comment thread src/partition_schema_mvp.rs Resolved
Comment thread src/partition_schema_mvp.rs Resolved
…e parameter named for its set, its type's Function, else its class's rule (RE-193)
…lumns' new Pset_ColumnCommon, and RE1's IFC2X3 space sets are compared without IsExternal (RE-193)
@DrunkOnJava DrunkOnJava changed the title feat(ifc): every element's IsExternal as Revit's exporter sets it (RE-193) feat(ifc): every element's IsExternal as Revit's exporter sets it: the parameter named for its set, its type's Function, else its class (RE-193) Oct 19, 2026
…93 names the members and coverings it counts
@DrunkOnJava
DrunkOnJava marked this pull request as ready for review October 19, 2026 03:54
@DrunkOnJava
DrunkOnJava merged commit 8087e60 into main Oct 19, 2026
26 checks passed
@DrunkOnJava
DrunkOnJava deleted the feat/is-external branch October 19, 2026 04:59
@DrunkOnJava DrunkOnJava mentioned this pull request Oct 19, 2026
6 tasks done
DrunkOnJava added a commit that referenced this pull request Oct 19, 2026
## Summary

Prepare v0.6.0. Merging this is not the release: the release is the signed `v0.6.0` tag on the merged commit, after the maintainer's go-ahead. This stays a draft until then.

## Motivation

Since 0.5.1, `main` has:

- **IFC4's own property sets (#822):** the IFC2X3 sets 0.5 took from Revit's exports of the RE1 models are gone or moved to where IFC4 and Revit's own IFC4 export put them (#825, #829, #833), and Measure checks every export's standard property sets against buildingSMART's published IFC4 property set definitions (#826). That is rvt-rs's own check: buildingSMART's Validation Service has not been run on the exports, and quantity sets are not checked.
- **More of what Revit's exporter writes:** parameters named for an IFC4 property set's property (RE-194, #815, #817/#821), each element's `IsExternal` (RE-193, #814), a type's Fire Rating (#830), a door's overall size (#788), Revit 2024 Areas as spaces (#811), port types and electrical flow directions (#832), rooms with no number (#818), pieces' property sets (#819), a room's floor finish in IFC4's set (#820).
- **Older and newer releases, experimentally:** Revit 2015 to 2022 (#742) and 2027 (#740) element records.
- **Fixes:** Export to IFC As on fixtures, stairs, doors, curtain walls and wall sweeps (#796, #804, #812, #813), the latest copy of an element's or type's data (#803, #809), declared ElementIds (#797), diagnostics naming the file, not its folders (#785), the browser viewer's wasm32 string-length panic (#835), and `rvt-inspect`, `rvt-corpus doctor` and the viewer's File Status taking Revit 2015 and 2027 as releases rvt-rs reads (#838).
- **CI and release:** IfcOpenShell 0.9.0.post1 (#795), Rust installed with rustup (#793), a tag publishes nothing until the maintainer approves it (#786, #787), and Measure's office, R2025, paired-probe and per-sample hashing (#790, #799, #805, #806).

## Changes

- **Versions 0.5.1 → 0.6.0** in the nine files that carry them: `rvt`, `rvt-py` and its pin, `rvt-wasm`, the `stream_evidence` pin, `CITATION.cff` (with `date-released`), `.release-please-manifest.json`, `viewer/package.json` and both lockfiles' workspace entries.
- **CHANGELOG:** `[0.6.0] — 2026-10-19`, with an introduction, **Upgrading from 0.5** (the property sets that moved, the public API changes, the releases that now export elements) and the outside contributors credited: puzzbobb (#740, #742, #798), Erry91 (#788) and MadsHolten (#835). The section's headings were already single; its 41 entries are all kept, with #835's and #838's added. Its introduction says the property sets match buildingSMART's published IFC4 definitions by rvt-rs's own check, as does the README's release summary.
- **README:** "Release 0.6.0 and main" names v0.6.0 and summarises what it added. The lines that said `main` reads Revit 2015 to 2022 and 2027 now say experimental (since 0.6.0). The opening and "Not yet" lines name those releases, and so does the capability table. The bullet list of what 0.5.0 added is gone; #832 had put 0.6.0's port types in it. As Codex found, the IFC4 export row, the viewer paragraph and the decoder-work paragraph also said 2022 and earlier export only the scaffold, and the by-input table skipped 2014; they name 2015 to 2022, 2026 and 2027 now.
- **Witnesses:** the IFC header carries the version, so both Core Interior `rvt-rs.json` observations and their verdicts are refreshed from this pull request's CI run.

## Testing

- CI on this pull request, the witness replays included.
- Measure on `main` at 23a9d76, which is everything in this release but #835's wasm32-only fix and #838's CLI and viewer version range, neither of which changes an export: run [39273188597](https://github.com/DrunkOnJava/rvt-rs/actions/runs/39273188597). All 89 exports (the reference models, both BIM4LCA office files, Autodesk's 58 sample projects and the 23 R2025 models) have no finding in Measure's IFC4 property set check (#826, against buildingSMART's published definitions), and IfcOpenShell's schema validation finds nothing on any of the 89; none was too large to validate.
- Witnesses: both Core Interior observations and verdicts are taken from this pull request's CI run 39275014518; only `witness_version` and the verdict hashes differ, and CI's replay on b82c0c3 passes.

## Audit-honesty checklist

- [x] README / docs reflect the current state after this PR
- [x] Commit messages describe what changed and why
- [x] No emojis in code, docs, or commit messages
- [x] No private paths, personal email addresses, or internal jargon in committed files

## Legal and contribution hygiene

- [x] I agree this work is licensable under Apache-2.0
- [x] This PR contains no Autodesk proprietary source, decompiled internals, or NDA'd SDK content

## Breaking changes

See **Upgrading from 0.5** in the CHANGELOG: standard property sets moved to IFC4's, and five public API changes.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Version and documentation-only release prep with no runtime code changes in this PR.
> 
> **Overview**
> **Bumps the workspace from 0.5.1 to 0.6.0** across `Cargo.toml`, `rvt-py` / `rvt-wasm` / `stream_evidence` pins, lockfiles, `viewer/package.json`, `.release-please-manifest.json`, and `CITATION.cff` (release date 2026-10-19).
> 
> **Documents the release:** adds the `[0.6.0]` section to `CHANGELOG.md` (IFC4 property sets, broader Revit export parity, experimental 2015–2022/2027 element export, wasm viewer fix, and **Upgrading from 0.5** breaking notes). **README** now treats v0.6.0 as the current release—updates the support matrix and “Release 0.6.0 and main” to describe shipped capabilities instead of the old 0.5.1 bullet list.
> 
> No application or library source changes in this diff; it packages and narrates work already on `main`.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit c8826b82982270fd4f47b8da656f2e3e6021c76b. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant