drawings
БесплатноБез исполняемых скриптовНе проверенProducing drawings and blueprints. Covers sheets with title blocks, placing views and schedules on sheets, tags, room tags, dimensions, text, and preparing…
от 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 atY = 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.
- Face references:
- Tags:
create.tag_elements(view, elements, offset=1.8, tag_type=None)tags by category.offsetmoves 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"); withoutroomsit 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 fromOfClass(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 thecenterof the title block.marginis in sheet feet (0.1 ft = 1.2 in). The title block's right-hand information strip is inside its box, so pass theright_marginkeyword (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_sheetraises 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.Scaleor 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
Установить 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), без исполняемых скриптов.
Похожие скиллы
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
от AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
от Anthropicxlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
от Anthropicpptx
Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…
от Anthropic