Skip to content

[Bug]: revit.db.ensure - ensure_element_ids missing support for Revit>2024 #2818

@Wurschdhaud

Description

@Wurschdhaud

✈ Pre-Flight checks

  • I don't have SentinelOne antivirus installed (see above for the solution)
  • I have searched in the issues (open and closed) but couldn't find a similar issue
  • I have searched in the pyRevit Forum for similar issues
  • I already followed the installation troubleshooting guide thoroughly
  • I am using the latest pyRevit Version

🐞 Describe the bug

elif isinstance(item, int):

This won't work anymore due to API changes. The value is no longer an int but rather Int64/long. A fix like this:

from pyrevit.compat import get_elementid_from_value_func
get_elementid_from_value = get_elementid_from_value_func()
def ensure_element_ids(mixed_list):
...
        elif isinstance(item, (int, Int64)):
            element_id_list.append(get_elementid_from_value(item))

Should solve it. Strictly speaking the additional compat shouldn't be necessary, but there might be edge cases? I'll do a PR after testing.

⌨ Error/Debug Message

When run with in Revit 2026, no output is generated by this function.

♻️ To Reproduce

No response

⏲️ Expected behavior

No response

🖥️ Hardware and Software Setup (please complete the following information)

==> Registered Clones (deployed from archive/image)
master | Branch: "master" | Version: "5.2.0.25181+1332" | Path: "C:\Program Files\pyRevit-Master"
==> Attachments
master | Product: "2026 First Customer Ship" | Engine: DEFAULT (2712) | Path: "C:\Program Files\pyRevit-Master" | AllUsers

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugBug that stops user from using the tool or a major portion of pyRevit functionality [class]

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions