Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

modeling

БесплатноБез исполняемых скриптовНе проверен

Building and changing model geometry. Covers levels, walls, floors, ceilings, roofs (gable, hip, shed), doors and windows, columns, rooms, re-runnable build…

pyrevitlabsот pyrevitlabs★ 2 094 звезды на GitHub

Об этом скилле

Modeling

Read revit-scripting and pyrevit-library first. The functions below are in pyrevitlib; check any of them with lookup_pyrevit_api. Fall back to the raw API only for what they don't cover.

from pyrevit import revit
from pyrevit.revit.db import query, create, update
from pyrevit.revit import units

Plan before you build

  • Check the drawing adds up. Sum the room dimensions along each band and compare them with the overall dimensions. If they conflict, tell the user what doesn't fit and ask which to keep before you build.

  • Find the types first with one query:

    def names(elements):
        return sorted(query.get_name(e) for e in elements)
    
    result = {
        "walls": names(query.get_types_by_class(DB.WallType)),
        "floors": names(query.get_types_by_class(DB.FloorType)),
        "roofs": names(query.get_types_by_class(DB.RoofType)),
        "doors": sorted("%s : %s" % (s.FamilyName, query.get_name(s)) for s in DB.FilteredElementCollector(doc).OfClass(DB.FamilySymbol).OfCategory(DB.BuiltInCategory.OST_Doors)),
        "levels": [(l.Name, l.Elevation) for l in DB.FilteredElementCollector(doc).OfClass(DB.Level)],
    }
    

    Names differ between templates; use the names this returns, never names from memory.

  • Keep plan data in the workspace. Put dimensions, wall lines, openings and rooms in a module such as house_plan.py in a folder, pass that folder as workspace to run_query and run_modify, and import house_plan. Give workspace modules unique names, because a name a library module has resolves to the library. It is re-imported fresh on every run. Don't paste the same data into every script.

  • Coordinates are in feet, with one origin. The create functions accept drawing strings ("32'-6\"", "900mm"); for your own arithmetic, convert with units.parse_length.

Build in stages

One run_modify per stage, dry run first:

  1. levels
  2. walls
  3. rooms (they check the walls: see below)
  4. floors and ceilings
  5. openings
  6. roofs, then attach the gable walls to them

Make each stage re-runnable: tag what it makes in Comments, and delete last run's output first. Delete with the same match you tag with: if tags carry a suffix (agent:walls:front), find them with get_elements_by_parameter(..., partial=True) and check the prefix; an exact match on agent:walls finds nothing and leaves duplicates.

from pyrevit.revit.db import delete

STAGE = "agent:walls"
with revit.Transaction("Stage 2 - walls"):
    stale = query.get_elements_by_parameter("Comments", STAGE)
    if stale:
        delete.delete_elements(stale)
    walls = create.create_walls(create.rectangle_points(0, 0, 65, 32), "Generic - 8\"", level="Level 1", height=9)
    for wall in walls:
        wall.get_Parameter(DB.BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS).Set(STAGE)
result = {"walls": len(walls)}

A failed or rejected stage leaves the earlier ones intact, and each committed stage is one undo entry.

Check after each stage with capture_view(view="3d"), or capture_view(view="3d", elements=[...]) to frame part of the model, plus a plan. Read back a number too: a height, an area, a count.

Levels

  • Create: DB.Level.Create(doc, elevation_ft), then set level.Name.
  • Look up: query.find_level("Level 1"), or query.find_level() for the active plan's level.

Walls

  • create.create_wall(start, end, wall_type, level=None, height=10, top_level=None, base_offset=0) places one wall on its location line (usually the centerline).
  • create.create_walls(points, wall_type, ...) walls a closed outline; closed=False for an open run. create.rectangle_points(x1, y1, x2, y2) gives the corners of a rectangle.
  • Joins: end walls exactly on each other's endpoints so Revit joins them. Wall thickness is wall_type.Width (feet).
  • Openings: leave room for them. An opening wider than its host segment fails with revit_failure ("can't cut instance").

Rooms: the layout check

  • create.create_room((x, y), level=None, name=None, number=None) places a room and raises when the point isn't enclosed. Place rooms right after the walls: a raise names the room whose walls have a gap.
  • create.create_room_separation_lines(points, level=None) separates rooms in an open plan without a wall.
  • Tags: doc.Create.NewRoomTag(DB.LinkElementId(room.Id), DB.UV(x, y), plan_view.Id).

Floors and ceilings

  • create.create_floor(points, floor_type, level=None, offset=0): points is the closed outline; offset is the height above the level.
  • create.create_ceiling(points, ceiling_type, level=None, offset=8).

Roofs

  • Native roofs only. They carry the roof type's layers and materials, stay editable, and walls can attach to them.
  • create.create_gable_roof(x1, y1, x2, y2, roof_type, "8:12", ridge="x", level=None, offset=9): the rectangle is the eave outline, overhangs included; ridge="x" runs the ridge along X; offset is the eave heig
Полный SKILL.md на GitHub

Установить modeling в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл modeling?

Building and changing model geometry. Covers levels, walls, floors, ceilings, roofs (gable, hip, shed), doors and windows, columns, rooms, re-runnable build stages, and when DirectShape is acceptable. Use it for "model this house", "add walls", "put windows in" and similar tasks.

Как установить скилл modeling?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл modeling запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить modeling с