Command Palette

Search for a command to run...

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

drawings

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

Producing drawings and blueprints. Covers sheets with title blocks, placing views and schedules on sheets, tags, room tags, dimensions, text, and preparing…

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

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

Drawings (views, sheets, annotation)

Read revit-scripting and pyrevit-library first. The functions below are in pyrevitlib; check any of them with lookup_pyrevit_api.

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

Views

Create, frame and find views with the views skill: create.create_plan_view, create_section_view, create_elevation_view, create_model_3d_view, update.crop_view_to_elements.

  • Settings: view.Scale (for example 48 for 1/4" = 1'-0", 100 for 1:100), view.DetailLevel, view.CropBoxActive.
  • Annotation crop: view.get_Parameter(DB.BuiltInParameter.VIEWER_ANNOTATION_CROP_ACTIVE).Set(1) keeps tags and dimensions inside the crop.
  • Hide what the drawing doesn't need: update.hide_categories(view, ["OST_Levels", "OST_Grids", "OST_Elev", "OST_Sections"]).
  • Templates: prefer the project's templates to setting graphics by hand.

Annotation

Annotation belongs to a view. Pass the plan, not the sheet.

  • Dimensions: create.create_dimension(view, references, axis="x", position=y) draws a chain through the references; axis="x" measures along X with the line at Y = position.
    • Face references: query.get_face_references(wall, DB.XYZ.BasisX.Negate())[0] is the wall's outer face looking west. It works for walls, floors and other host elements.
    • Doors and windows: instance.GetReferences(DB.FamilyInstanceReferenceType.CenterLeftRight).
    • Keep dimension chains in lists of (references, axis, position) and build them in one loop; place the lines outside the model with room between chains.
  • Tags: create.tag_elements(view, elements, offset=1.8, tag_type=None) tags by category. offset moves each tag along the element's facing direction, so window tags sit outside and door tags (negative offset) inside.
  • Room tags: create.create_room_tags(view, rooms=None, tag_type="Room Tag With Area"); without rooms it tags every room visible in the view.
  • Text: DB.TextNote.Create(doc, view.Id, DB.XYZ(x, y, 0), "text", text_type.Id), with a type from OfClass(DB.TextNoteType).

Schedules

create.create_schedule takes the display names returned by GetSchedulableFields(), which are localized by Revit. Discover those names in the current session before creating a schedule; for filters, grouping and formatting, see the scheduling skill.

Sheets

titleblock = query.find_family_symbol("D 22 x 34 Horizontal", family_name="D 22 x 34 Horizontal", category="OST_TitleBlocks")
sheet = create.create_sheet("A101", "Floor Plan", titleblock.Id)
create.place_on_sheet(sheet, plan_view, anchor="top_left")
create.place_on_sheet(sheet, schedule, anchor="top_right", right_margin=0.25)
  • Placing: create.place_on_sheet(sheet, view_or_schedule, anchor, margin=0.1) aligns the viewport or schedule to a corner (top_left, top_right, bottom_left, bottom_right) or the center of the title block. margin is in sheet feet (0.1 ft = 1.2 in). The title block's right-hand information strip is inside its box, so pass the right_margin keyword (the strip's width in sheet feet, measured on the sheet) when anchoring right or center. Passing a sheet instead of a view raises.
  • One sheet per view: a view can be placed on only one sheet; place_on_sheet raises when it's already on one. Duplicate it (view.Duplicate(DB.ViewDuplicateOption.WithDetailing)) for another. Schedules can repeat.
  • Fit: if the viewport is bigger than the sheet, raise view.Scale or tighten the crop.
  • Title block parameters such as drawn by and date are parameters on the title block instance on the sheet.
  • Re-runnable: delete the previous sheet, view and schedule by number and name before creating them again.

Exporting to PDF and images

A run may export only into export_dir, a folder the host creates for that run; any other target is cancelled. Exporting works in run_query too, since it doesn't change the model. The response lists the files in exports.

Files in export_dir are temporary: they last at least 14 days, and after that any host start or later recorded run, including one in another Revit instance, may delete them, even while this Revit session stays open. When you give the user those paths, say so, and offer to copy the deliverables to a folder they name. Copy them with your own file tools after the run, or ask the user to copy them; never write to that folder from the script.

An export shows the model as the script had it, so files from a dry run or a declined modify run show changes that were rolled back: export deliverables only from the state the user should get.

import os
from System.Collections.Generic import List
from pyrevit.api import DB

ids = List[DB.ElementId]()
for sheet in DB.FilteredElementCollector(doc).OfClass(DB.ViewSheet):
    if sheet.SheetNumber in ("A101", "A102"):
        ids.Add(sheet.Id)

pdf_dir = os.path.join(export_dir, "pdf")
if not os
Полный SKILL.md на GitHub

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

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

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

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

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

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

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

FAQ

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

Producing drawings and blueprints. Covers sheets with title blocks, placing views and schedules on sheets, tags, room tags, dimensions, text, and preparing sheets for PDF export. Use it for "set up sheets", "make a floor plan drawing", "tag all doors", "dimension the walls", "export to PDF" and similar tasks.

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

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

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

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

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

Сравнить drawings с