# Revit Api Option Handlers

> >

- **Type:** Skill
- **Install:** `agentstack add skill-nice3point-revit-skills-revit-api-option-handlers`
- **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-api/skills/revit-api-option-handlers

## Install

```sh
agentstack add skill-nice3point-revit-skills-revit-api-option-handlers
```

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

## About

# Revit API Option Handlers

Several Revit API calls demand a small callback interface.
`Nice3point.Revit.Toolkit` ships ready implementations with a default behavior plus lambda or enum customization; you do not hand-roll a class each time.

## When to use

- A Revit API call requires `IFamilyLoadOptions`, `IDuplicateTypeNamesHandler`, or `ISaveSharedCoordinatesCallback`.

## Workflow

### Step 1: Family load options

```csharp
document.LoadFamily(fileName, new FamilyLoadOptions(), out var family); //overwrite existing types, load from the family
document.LoadFamily(fileName, new FamilyLoadOptions(false, FamilySource.Project), out var family); // keep values, load from the project
document.LoadFamily(fileName, UIDocument.GetRevitUIFamilyLoadOptions(), out var family); //reuse Revit's interactive prompt
```

The default constructor overwrites the parameter values of existing types; the `(overwrite, FamilySource)` constructor sets those explicitly, and `UIDocument.GetRevitUIFamilyLoadOptions()` defers to Revit's own dialog.

### Step 2: Duplicate type names handler

```csharp
var options = new CopyPasteOptions();
options.SetDuplicateTypeNamesHandler(new DuplicateTypeNamesHandler()); //default: UseDestinationTypes
options.SetDuplicateTypeNamesHandler(new DuplicateTypeNamesHandler(DuplicateTypeAction.Abort)); //fixed action
options.SetDuplicateTypeNamesHandler(new DuplicateTypeNamesHandler(args => DuplicateTypeAction.Abort)); // decide per call
```

The default constructor keeps the destination types; pass a `DuplicateTypeAction` for a fixed action, or a lambda to decide per call from the `args`.

### Step 3: Save shared coordinates callback

```csharp
linkType.Unload(new SaveSharedCoordinatesCallback()); //default: SaveLinks
linkType.Unload(new SaveSharedCoordinatesCallback(SaveModifiedLinksOptions.DoNotSaveLinks)); //fixed option
linkType.Unload(new SaveSharedCoordinatesCallback(link => //decide per link
{
    if (link.AttachmentType == AttachmentType.Overlay) return SaveModifiedLinksOptions.SaveLinks;
    return SaveModifiedLinksOptions.DoNotSaveLinks;
}));
```

The default constructor saves the links; pass a `SaveModifiedLinksOptions` value for a fixed choice, or a lambda to decide per link.

### Step 4: Verify

Call the API with the handler and confirm the intended behavior applies — the family loads with the chosen source, the duplicate resolves as selected, or the link unloads with the chosen coordinate option.

## Validation

- [ ] The callback uses the Toolkit handler, not a hand-rolled interface implementation.
- [ ] Customization is expressed with the lambda or enum overload, not a new class.
- [ ] The selected default behavior matches the operation's requirement.

## Common Pitfalls

| Pitfall                                                      | Correct approach                                                    |
|--------------------------------------------------------------|---------------------------------------------------------------------|
| Writing a class that implements `IDuplicateTypeNamesHandler` | Use `DuplicateTypeNamesHandler` with a lambda returning the action. |
| `FamilyLoadOptions` 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-api-option-handlers
- 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%.
