# Revit Context Access

> >

- **Type:** Skill
- **Install:** `agentstack add skill-nice3point-revit-skills-revit-context-access`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [Nice3point](https://agentstack.voostack.com/s/nice3point)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [Nice3point](https://github.com/Nice3point)
- **Source:** https://github.com/Nice3point/revit-skills/tree/main/plugins/revit-ui/skills/revit-context-access

## Install

```sh
agentstack add skill-nice3point-revit-skills-revit-context-access
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Revit Context Access

`RevitApiContext.Application` exposes the database-level Revit application for tests and Design Automation, where a UI session is unavailable.
`RevitContext` adds UI-session access to the active application, document, and view, plus bounded dialog suppression.

Use `RevitApiContext` for database-level access and failure suppression.
Use `RevitContext` only when a UI session is available.

## When to use

- Reading the database-level `Application` in a test or Design Automation.
- Reading the active document, UI application, or view from a service, helper, or window in a UI session.
- Suppressing predictable dialogs for a bounded operation.

## When not to use

- Inside an external command or application, where the base class already exposes the context — use `revit-command-and-application`.
- Accessing Revit from a test or Design Automation through UI types — use `RevitApiContext.Application`.
- Suppressing failures or warnings during a transaction — use `RevitApiContext.BeginFailureSuppressionScope`.

## Workflow

### Step 1: Read database-level context without a UI session

Use `RevitApiContext.Application` in tests and Design Automation.

```csharp
var application = RevitApiContext.Application;
```

### Step 2: Read UI-session context

```csharp
var uiApplication = RevitContext.UiApplication;
var document = RevitContext.ActiveDocument;
var view = RevitContext.ActiveView;
```

### Step 3: Suppress dialogs for a bounded operation

```csharp
using (RevitContext.BeginDialogSuppressionScope(TaskDialogResult.Ok))
{
    LoadFamilies();
}
```

Overloads accept a result code, a `TaskDialogResult`, a `MessageBoxResult`, or a custom handler that overrides the result.

### Step 4: Verify

Confirm database-only code accesses `RevitApiContext.Application`, UI-session code reads the expected active document, and a suppressed dialog no longer blocks the operation.

## Validation

- [ ] Tests and Design Automation access the database-level application through `RevitApiContext.Application`.
- [ ] UI-session access uses `RevitContext`, and nullable reads (`ActiveDocument`, `ActiveView`) are guarded.
- [ ] Dialog suppression is scoped to the operation that raises the dialog.

## Common Pitfalls

| Pitfall                                               | Correct approach                                                               |
|-------------------------------------------------------|--------------------------------------------------------------------------------|
| Using `RevitContext` in a test or Design Automation  | Use `RevitApiContext.Application`; it does not require a UI session.          |
| Assuming `RevitContext.ActiveDocument` is non-null    | It is nullable; guard when no document is open.                                |
| Suppressing a transaction failure with a dialog scope | Use `RevitApiContext.BeginFailureSuppressionScope`.                             |
| `RevitContext` not found                              | The `Nice3point.Revit.Toolkit` package is not referenced.                      |

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [Nice3point](https://github.com/Nice3point)
- **Source:** [Nice3point/revit-skills](https://github.com/Nice3point/revit-skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-nice3point-revit-skills-revit-context-access
- Seller: https://agentstack.voostack.com/s/nice3point
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
