Skip to main content

Paracore Extension Methods

This guide provides an exhaustive reference for the global objects, session commands, and extension methods available within Paracore. Every method is designed to simplify the Revit API, providing "Magic" resolution for strings, units, and element identities.


Global Context

These objects are automatically injected into every script and REPL session.

ObjectTypeDescriptionExample
DocDocumentThe active Revit Document.Doc.Title
UIDocUIDocumentThe active Revit UI Document.UIDoc.ActiveView
UIAppUIApplicationThe top-level Revit UI Application.UIApp.VersionBuild
ActiveViewViewThe currently active Revit view.ActiveView.Name
SelectionList<Element>Elements currently selected in Revit.Selection.Count
ParametersDictionaryParameters passed from the UI/Agent.Parameters["Mark"]
Println(msg)voidPrints to the Paracore Console.Println("Log message")
Print(msg)voidAlias for Println.Print("Log message")

REPL Syntax Rules

To ensure successful execution in the REPL environment:

  • Semicolons: Mandatory for variable assignments (var rooms = GetElements<Room>();), but optional for one-line queries (Selection.Count).
  • Count vs Count(): Use the .Count property for immediate lists (e.g., Selection.Count, GetMagicNames().Count) and the .Count() method for dynamic enumerable queries (e.g., GetElements<Wall>().Where(w => ...).Count()).

Session & Memory Management

The REPL is persistent. Use these commands (no semicolons required in REPL) to manage active memory.

list / vars

Enumerates all variables currently stored in the active REPL memory.

  • Example: list

clear vars / reset

Wipes the entire memory state to start a fresh session.

  • Example: reset

inspect <name>

Returns a formatted JSON tree of a specific variable.

  • Example: inspect myWall

Discovery & Filtering

Find elements by name, category, or class without writing boilerplate collectors.

GetElements("Category")

Gets instances or types of a specific category or family. Use the generic FamilySymbol for types.

  • Example: var doors = GetElements("Doors"); // All instances
  • Example: var types = GetElements<FamilySymbol>("Doors"); // All types

GetElements<T>(name)

Gets elements filtered by C# class (e.g. Wall, Room).

  • Example: var walls = GetElements<Wall>();
  • Example: var instances = GetElements<FamilyInstance>("Doors");
  • Example: var all = GetElements<Element>(); // Gets EVERY element in the model.

GetElement<T>(name)

Finds a single element by its name or identity.

  • Example: var level = GetElement<Level>("Level 1");

GetMagicNames()

Lists all strings (categories, classes) that can be resolved by the engine.

  • Example: foreach(var n in GetMagicNames()) Println(n)

GetCategories()

Lists all Revit categories available in the active document.

  • Example: foreach(var c in GetCategories()) Println(c)

Element Accessors (Extension Methods)

Paracore extends the Revit Element class with smart, unit-aware getters and setters.

GetStr(name)

Smart String Getter. Returns name (for IDs) or formatted string.

  • REPL: wall.GetStr("Base Constraint")
  • Script: var levelName = wall.GetStr("Base Constraint");

GetVal(name)

WYSIWYG Getter. Returns the exact string shown in the Revit Properties palette.

  • REPL: wall.GetVal("Length")
  • Script: var displayValue = wall.GetVal("Length");

GetNum(name, unit)

Numeric Getter. Returns internal units or converted units.

  • REPL: wall.GetNum("Length")
  • Script: var rawFeet = wall.GetNum("Length");

GetInt(name)

Integer Getter. Returns the integer value of the parameter.

  • REPL: wall.GetInt("Mark")
  • Script: var count = wall.GetInt("Mark");

SetVal(name, value)

The Smart Setter. Resolves unit-strings, names, and IDs automatically.

  • REPL: wall.SetVal("Base Offset", "500 mm")
  • Script: wall.SetVal("Base Offset", "500 mm");

SetNum(name, value, unit)

Numeric Setter. Explicitly sets value with unit conversion.

  • REPL: wall.SetNum("Base Offset", 100, "mm")
  • Script: wall.SetNum("Base Offset", 100, "mm");

Metadata & API Reflection (Peeks)

Techniques to inspect elements and their properties in a tabular format.

InstanceParams()

Returns every non-empty instance parameter (Name, Storage, Value) as a table.

  • Example: myWall.InstanceParams().Table()

TypeParams()

Returns parameters from the element's ElementType as a table.

  • Example: myWall.TypeParams().Table()

NativeProperties()

The BIM Manager's Peek. A curated list of essential metadata like Category, Location, Design Option, Level, and Workset.

  • Example: myWall.NativeProperties().Table()

ReflectionProperties()

The Developer's Peek. Uses C# Reflection to dump the actual public properties defined in the Revit API classes (e.g. Wall.Width, Room.Area, FamilyInstance.IsFlipped).

  • Example: myWall.ReflectionProperties().Table()

GeometrySummary()

Returns the complete collection of GeometryObject instances (Solids, Curves, Points) for the element.

  • Example: myWall.GeometrySummary().Table()

.Peek()

The definitive "Source of Truth" view. Lists Name, Storage, GetStr, GetNum, and UI Value side-by-side.

  • Example: Selection[0].Peek()
ToolDescriptionExample
.CombinedParams()Combined Instance & Type paramsmyWall.CombinedParams().Table()
.BuiltInParams()Lists BuiltInParameter strings.myWall.BuiltInParams().Table()
.NativeProperties()BIM Manager View. Hand-picked metadata (Level, Workset, Design Option, Location).myWall.NativeProperties().Table()
.ReflectionProperties()Developer View. Raw C# Class properties (e.g. Wall.Width, Wall.Flipped) via Reflection.myWall.ReflectionProperties().Table()
.GeometrySummary()Detailed solid/face/mesh breakdown.myWall.GeometrySummary().Table()

Geometry & Instance Handling

GetInstanceGeometry()

Returns geometry coordinates relative to the Revit Project Space. (Result is a COPY).

  • Example: var projectPts = inst.GetInstanceGeometry();

GetSymbolGeometry()

Returns raw coordinates relative to the family/CAD Local Space. (Result is a REFERENCE).

  • Example: var localPts = inst.GetSymbolGeometry();

Unit Conversions & Snapping

InputUnit(unit)

Converts a human value to Revit internal units.

  • Example: var target = 1500.InputUnit("mm");

OutputUnit(unit)

Converts internal units from feet/sqft to a human unit.

  • Example: var mm = val.OutputUnit("mm");

FormatUnit(unit)

Returns a formatted string with the unit suffix (e.g. "1500.0 mm").

  • Example: val.FormatUnit("mm");

RoundTo(unit)

Snaps the internal value to the nearest incremental precision of the unit.

  • Example: val.RoundTo("mm");

Precision-Aware Math

Always use these fuzzy comparison methods for Revit geometry.

MethodDescriptionExample
.AlmostZero()Checks if value is effectively 0.if (val.AlmostZero()) ...
.IsAlmostEqualTo(v)Fuzzy equality check (1e-9).val.IsAlmostEqualTo(target)
.IsLessThan(limit)Strictly less than (ignores noise).val.IsLessThan(limit)
.IsGreaterThan(limit)Strictly greater than (ignores noise).val.IsGreaterThan(limit)
.Round(decimals)Fluent rounding.val.Round(2)
.IsPositive() / .IsNegative()Directional check vs noise.val.IsPositive()

Universal Visualizers & Actions

These methods bridge the gap between "Code" and "UI". Every fluent extension has a corresponding global helper (e.g., data.Table() vs Table(data)) for maximum flexibility.

Extension MethodGlobal AliasDescription
.Table()Table(data)Renders dynamic parameter tables for collections/objects.
.PieChart()PieChart(data) / PieGraph()Renders high-contrast Pie Charts in the Summary tab.
.BarChart()BarChart(data) / BarGraph()Renders high-contrast Bar Charts in the Summary tab.
.LineChart()LineChart(data) / LineGraph()Renders high-contrast Line Charts in the Summary tab.
.Select() / .Zoom()-Selects and focuses elements in the Revit viewport.
.Isolate()-Isolates elements in the active view (Temporary).
**.Hide() / .Unhide()-Toggles element visibility in the active view.
.Delete()Delete(data)Deletes elements (Automatic Transaction).

Advanced Automation

id.ToElement(Doc)

Resolves a numeric/string ID directly to a Revit Element.

  • Example: 12345.ToElement(Doc).Select()

WhereParam(name, val)

High-speed filtering by string value.

  • Example: walls.WhereParam("Mark", "A1")

SumParam(name, unit)

Quickly sum a numeric parameter across a collection.

  • Example: rooms.SumParam("Area", "m2")

Transact(name, action)

Wraps modifications in a named transaction.

  • Example: Transact("TitleCase", () => element.Name = element.Name.ToTitleCase());

IntelliSense

When using Edit Script, all of these methods are available in VS Code with full documentation and autocomplete.


📊 Structured Output Reference

Use this matrix to understand when to manually call .Table() versus using auto-rendering diagnostic helpers.

MethodModeBest For
.Table()ManualDynamic element audits & custom projections.
.Peek()AutoForensic API vs UI value comparison.
.Delete()AutoSafely deletes elements.

Note: GetMagicNames() and GetCategories() return string lists. Use a foreach loop with Println() to see them in the console.


Pro Tip

If you need to filter or sort data before rendering it to a table, use the extension method equivalents (e.g., el.InstanceParams().OrderBy(p => p.Name).Table()) instead of chaining them directly.