Skip to content

IDS: an Entity facet with predefinedType throws on entities that have no PredefinedType attribute #819

Closed

Description

@helenkwok

IDSEntity.evalPredefinedType (facets/Entity.ts) does "value" in itemData.PredefinedType. Some entities have no PredefinedType attribute at all, for example IfcSite in IFC4, so their item data has no such key and the check throws:

TypeError: Cannot use 'in' operator to search for 'value' in undefined

It throws both when the facet is used as applicability (getEntities) and as a requirement (test), so a whole IDS check aborts on any model where such an entity reaches the facet. The same unguarded check is used on the type's attributes (typeAttrs.PredefinedType).

Reproduce

With the repo's own tests/fixtures/type-psets.ifc (it has one IfcSite):

const site = new OBC.IDSEntity(components, { type: "simple", parameter: "IFCSITE" });
site.predefinedType = { type: "simple", parameter: "USERDEFINED" };
await site.getEntities([/type-psets/], {}); // TypeError

Expected: the site is not selected (it has no predefined type), and as a requirement it fails rather than throwing.

A PR with a test follows.

System info

main at 8479a7c, Node 24.14.0, macOS, yarn 3.2.1 (the repo's own setup).

Activity

  1. helenkwok commented on Oct 11, 2026

    @helenkwok
    ContributorAuthor

    A more common trigger than IfcSite: in models converted by IfcImporter, an occurrence whose own PredefinedType is unset ($, which is common in exported models) has no PredefinedType key in its item data either, so IFCWALL + a predefined type throws on such walls too.

    Once the throw is guarded, a second problem shows: the inherited value is looked up only through IsTypedBy, but IfcImporter models link the type through IsDefinedBy. So a wall with an unset PredefinedType and a STANDARD IfcWallType would fail, where IDS passes it: see the buildingSMART IDS test cases entity/pass-inherited_predefined_types_should_pass and entity/fail-a_null_predefined_type_should_always_fail_a_specified_predefined_types, which throw on main and give the expected result with #820.

    #820 now covers both, with a fixture for the inherited case.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions