pyrevitlabs/pyrevit/pyrevit-library

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Map of the shared Python libraries every script can import, pyrevitlib (pyrevit.revit) and rpw, and how to find a function in them. Read it before writing raw Revit API code for lookups, element or view creation, parameters, units, transactions or navigation.

Install

npx vskill@latest install pyrevitlabs/pyrevit/pyrevit-library

SKILL.md

pyrevitlib and rpw

pyRevit ships two maintained libraries that agent scripts can import on every engine. Use them first: their functions handle version differences, engine quirks and the Revit API traps agents fall into. Write raw DB. code only for what they don't cover.

Finding a function

lookup_pyrevit_api searches both libraries from their source, without Revit:

  • lookup_pyrevit_api(query="section box") searches names and docstrings.
  • lookup_pyrevit_api(query="create_gable_roof") returns the signature, the full docstring and the import line.
  • lookup_pyrevit_api(query="pyrevit.revit.db.create") lists a module.
  • list_automation(offset=0, limit=25) lists reviewed APIs with stable IDs, effects, context and transaction requirements. Use an ID with lookup_pyrevit_api to read its full contract.
  • run_automation(id=..., inputs=...) runs a small reviewed subset through the existing guarded query path. It currently accepts pyrevit.units.parse-length and pyrevit.units.parse-slope, each with {"value": ...}; pyrevit.levels.resolve with {"name": ...}; and pyrevit.elements.by-category with {"categories": ["OST_Walls"], "limit": 50}. The document-bound operations require an active document.

When a script fails on a name from these libraries, the error hint lists similar names.

Where things live

python
from pyrevit import revit
from pyrevit.revit.db import query, create, update
from pyrevit.revit import units, ui
NeedUse
Transactionwith revit.Transaction("name"): rolls back and re-raises on an exception
Current document, view, selectionrevit.doc, revit.uidoc, revit.active_view, revit.get_selection()
Levels, types, family types, views by name; raises with the valid namesquery.find_level, query.find_type(DB.WallType, "name"), query.find_family_symbol("36\" x 84\"", family_name=..., category="OST_Doors") or query.find_family_symbol("Family : 36\" x 84\""), query.find_view, query.find_plan_view(level)
Other lookups (return None or a list when nothing matches)query.get_types_by_class, query.get_family_symbol, query.get_all_views, query.get_view_by_name, query.get_category("OST_Walls"), query.get_elements_by_categories, query.get_param, query.get_sheets, query.get_elements_by_parameter…
Extentsquery.get_elements_bounding_box(elements), query.get_model_elements()
Walls, floors, ceilings, rooms, room separation, model linescreate.create_wall(s), create.create_floor, create.create_ceiling, create.create_room, create.create_room_separation_lines, create.create_model_lines
Roofscreate.create_gable_roof, create_hip_roof, create_shed_roof, create_footprint_roof; gable end walls with create.create_gable_wall, or update.attach_wall_tops(walls, roof) where Revit supports wall attachment
Non-rectangular wallscreate.create_profile_wall(points) from an outline in the wall's vertical plane
Doors, windows, furniture, columnscreate.place_hosted_instance, create.place_family_instance, create.create_column
Viewscreate.create_plan_view, create_model_3d_view, create_section_view, create_elevation_view
Drawingsquery.get_face_references(element, direction), create.create_dimension, create.tag_elements, create.create_room_tags, create.create_schedule, create.create_sheet, create.place_on_sheet
View framing and visibilityupdate.set_section_box, update.orient_3d_view, update.set_3d_view_camera, update.crop_view_to_elements, update.set_crop_region, update.hide_non_model_categories, update.hide_categories
Navigationui.request_view_change(view), ui.zoom_to_elements(elements), ui.zoom_fit()
Unitsunits.parse_length("32'-6\"") (feet), units.parse_slope("8:12") (rise over run), units.format_length(value)
Parametersquery.get_param(element, name), update.update_param_value(param, value)
Element ids across Revit versionsfrom pyrevit.compat import get_elementid_value_func
Wrappers with a friendlier APIfrom rpw import db: db.Collector(of_class="Wall", is_not_type=True), db.Element(element).parameters["Comments"].value, db.Room, db.Wall, db.View, graphic overrides

Functions that create elements take points as DB.XYZ or (x, y[, z]) tuples, and lengths as feet or strings such as 32'-6" and 900mm. Types, levels and family types can be passed by name.

Revit's own utility classes

When the libraries don't cover a step, Revit may still have it in a static ...Utils class that isn't reachable from the element: wall joins, face references for hosting, solid booleans, MEP caps and terminal connections, beam end joins, unit formatting, worksharing. Read get_skill("pyrevit-library", "revit-utilities.md") before writing the geometry or connection logic yourself, and before concluding that the API can't do something.

Rules

  • Libraries first, raw API second. Look the task up with lookup_pyrevit_api before writing DB. code for it.
  • Prefer `find_*` to `get_*` in agent scripts. get_* returns None and the script carries on; find_* stops with the names that exist.
  • Don't use `pyrevit.forms` or `rpw.ui.forms`. Agent runs have no user to answer a dialog.
  • Report library gaps. If a common step has no function, say so in your answer; the maintainers add missing functions to the libraries.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/pyrevitlabs/pyrevit/pyrevit-library/badge)](https://verified-skill.com/skills/pyrevitlabs/pyrevit/pyrevit-library)

Something wrong with this skill or its page? Tell us.