pyrevitlabs/pyrevit/family-editing
- community
Checking that the SKILL.md file is still in the repository.
Editing Revit families. Covers opening a family from the project, family parameters, types and formulas, and loading the family back into the project. Use it for "add a parameter to these families", "create door types", "fix family formulas" and similar tasks.
Install
npx vskill@latest install pyrevitlabs/pyrevit/family-editingSKILL.md
Family editing
Read revit-scripting first. Check API names with lookup_revit_api.
Where the family lives
- Active document is a family (
get_context.document.is_familyis true):doc.FamilyManageris available directly. Change it inside transactions ondoc, as usual. - Family used in a project: open a family document from the project, edit it, and load it back.
doc.EditFamilytakes aDB.Familyand returns an in-memory family document; make your edits where this snippet adds a type:
``python family = doc.GetElement(family_id) fam_doc = doc.EditFamily(family) try: t = DB.Transaction(fam_doc, "Edit family") t.Start() fam_doc.FamilyManager.NewType("900 x 2100") t.Commit() from pyrevit.revit.db.create import FamilyLoaderOptionsHandler fam_doc.LoadFamily(doc, FamilyLoaderOptionsHandler()) finally: fam_doc.Close(False) ``
What the run guard covers here
The run guard, and the dry-run rollback, cover the project document only.
- In the family document: transactions are not rolled back by a dry run. They're discarded only because the family document is closed without saving.
- Failures in the family document are handled like the project's: warnings are removed and reported in
failures, and an error rolls back that transaction and fails the run withrevit_failure. Each entry names itsdocument. - The project change is `LoadFamily`. It's part of the guarded run, so it's rolled back by a dry run and needs approval under policy
ask. - Close without saving: always call
fam_doc.Close(False), in afinally. - Reloading replaces the `Family` object. After
LoadFamilybrings an edited family back, theFamilyyou edited is no longer valid (IsValidObjectis false). Keep its name before editing, and look the family up again by name to read it afterwards. - Save only on request: don't call
fam_doc.Save()orSaveAs()unless the user asked to change the family file on disk. A family fromEditFamilyorNewFamilyDocumentcan be saved; the project open when the run started, and any file you opened withOpenDocumentFile, can't.
Family parameters
- Groups and specs are
ForgeTypeIds:DB.GroupTypeId.*andDB.SpecTypeId.*. Look them up withlookup_revit_api("GroupTypeId"). - Existing parameters:
fm.get_Parameter("Name"), orfm.Parameters. pyRevit has helpers:from pyrevit.revit.db import query, thenquery.get_family_parameter(name, fam_doc)andquery.get_family_parameters(fam_doc). - Shared parameters:
fm.AddParameter(external_definition, group, is_instance)takes a definition from the shared parameter file.
Types
- Existing types:
fm.Types, andfm.CurrentTypefor the one being edited. - New type:
fm.NewType("900 x 2100"). It becomes the current type. - Set a value for the current type:
fm.Set(param, value). Lengths are in feet. - Change several types: set
fm.CurrentType = family_typebefore eachSet.
Loading families from disk
- Easiest:
from pyrevit.revit.db.create import load_family, thenload_family(path, doc=doc). - Direct API:
doc.LoadFamily(path, FamilyLoaderOptionsHandler())returns a tuple(loaded, family). - Before placing a loaded type, activate it:
symbol.Activate(), thendoc.Regenerate().
Before you report done
- [ ] The family's types and parameter values, queried after loading, are the ones asked for.
- [ ] A geometry change was checked on a placed instance or in a view with
capture_view. - [ ] Every family document you opened is closed: it's no longer in
app.Documents. - [ ] The family file on disk is unchanged unless the user asked to save it.
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
- SKILL.md in the repositoryCheckingpyrevitlib/pyrevit/agent/skills/family-editing/SKILL.md
Popularity
- Repository stars
- 1,972
- Repository forks
- 490
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. 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
[](https://verified-skill.com/skills/pyrevitlabs/pyrevit/family-editing)