Advertisement

Friday, April 20, 2012

The Building Coder Samples for Revit 2013

I've posted previously about the Revit SDK, which includes working code samples. Jeremy Tammik is a member of the AEC workgroup of the Autodesk Developer Network ADN DevTech team, providing developer support and other services. Well, over on Jeremy's The Building Coder blog, he often posts code snippets from his support calls for the benefit of the Revit community at large. Quite brilliant.

Today Jeremy posted that he had ported his "Building Coder Samples" to Revit 2013. That got my attention. He has samples? Yes - not only does he write posts on his blog, he keeps a running set of working samples to capture his work! And he provides it free to the Revit community with the source code! Now THAT'S brilliant!

When loaded, a RvtSamples panel is added to the Add-ins tab. It contains two pulldown buttons, one labeled A-M and the other N-Z.

I couldn't find a  handy listing of the sample commands on Jeremy's blog so I wrote a quick little VB.net app to strip them out of his include file. Here are the rather extensive results (command names followed by descriptions):

Analytical Model Geometry
Retrieve analytical model geometry

Azimuth
Calculate azimuth

Bounding Box
Retrieve Element Bounding Box

Cannot Create Railing Instance
Cannot create a new railing instance

Categories
List document and built-in categories

Change Linked File Path
Change linked RVT file path

Close Document
Close active document by sending Windows message

Collector Performance
Benchmark Revit 2011 API collector performance

Coords Of View On Sheet
Retrieve coordinates of view on sheet

Copy Wall Type
Duplicate a system type from on project to another to partially transfer project standards

Create Area
Create a new area element

Create Beam Type and Instance
Create a new beam type and insert an instance of it

Create Column Type and Instance
Create a new column type and insert an instance of it

Create Gable Wall
Create gable wall specifying non-rectangular wall profile

Crop 3D View to Room
Set 3D view crop box to room extents

Curtain Wall Geometry
Retrieve curtain wall geometry

Cylindrical Column
Determine whether column is round

Detail Curves
Create detail curves

Dimension Two Walls Finding References
Create dimensioning elements between opposing walls by using FindReferencesByDirection

Dimension Two Walls Iterating Faces
Create dimensioning elements between opposing walls by iterating over their faces

Disallow Join
Allow or disallow join at wall ends

Duplicate Elements
Duplicate selected elements

Edit Floor
Generate a new floor element from the curve array of an existing one

Element Materials
Retrieve building element materials

Elliptical Arc
Create a new elliptical arc geometry object with a given start and end angle

Extract Part Atom
Extract part atom from family file

Family Parameter Guid
Determine familt parameter IsShared and GUID properties using System.Reflection

Family Parameter Values
List family parameter values defined on the types in a family document

FilledRegion Coordinates
Retrieve FilledRegion coordinates

Floor Boundary Polygon Areas
Determine floor slab boundary loop polygon areas

Get Transformed Coordinates
Determine transformed vertex coordinates for family instance symbol geometry

Idling
Subscribe to the Idling event

Imports in Families
List all imported symbols in all families in project

Install Location
Determine Revit product install location

LandXML Import
Import LandXML data and create TopographySurface

Library Paths
List existing and update application options library paths

Linked File Elements
List elements in linked files

Linked Files
Determine linked files and their full path

List Marks
List all door marks

List Railing Types
List all railing and stair types

List Shared Parameters
List all shared parameters defined in document and saved on wall instances

List Views
Determine all all the view ports of a drawing sheet and vice versa

List Walls
List wall lengths and areas

MEP Element Shape
Determine element shape

Mirror Elements
Mirror selected elements

Mirror List Added
Mirror selected elements and list the resulting new elements added to the database

Nested Families
List nested family files and instances in a family document

Nested Instance Geometry
Determine nested instance geometry and structure

New Blend
Create a new blend using the NewBlend method

New Dimension Label
Create a new dimension label in a family document

New Duct System
Create a new duct system via the NewMechanicalSystem API call

New Lighting Fixture
Insert a new lighting fixture family instance

New Line Loads
Create a new structural line load elements

New Project Document
Create a new project document

New Spot Elevation on Beam
Insert a new spot elevation on top surface of beam

New Sprinkler
Insert a new sprinkler family instance

New Swept Blend
Create a new swept blend element

New Wall Layer
Create a new wall type with a new compound structure layer

Pick Point in 3D
Set active work plane to pick a point in 3d

Place Family Instance
Call PromptForFamilyInstancePlacement to place family instances and use the DocumentChanged event to capture the newly added element ids

Plan Topology
List plan topology and its rooms and circuits with no rooms

Preprocess Failure
Suppress warning message by implementing the IFailuresPreprocessor interface

Press Keys to Launch Command
Press keys to launch 'Create Similar' and other Revit commands

Preview Image
Display the element type preview image of all family instances

Purge TextNote Types
Delete all unused TextNote types

Rectangular Duct Corners
Determine the corners of a rectangular duct

Relationship Inverter
Determine opening > wall host relationships and invert them to wall > opening

Remove DWF Links
Remove DWF links

Remove Imported Images
Remove imported JPG image files

Room Data Access
List properties from all rooms

Room Wall Adjacency
Determine part of wall face area that bounds a room

Rotated Beam Location
Determine rotated beam location

Set Room Occupancy
Set room occupancy via built-in parameter ROOM_OCCUPANCY

Set Tag Type
Create a wall

Shared Parameters
Create shared parameters for Doors

Sheet Data Export
Export sheet data to XML file

Sheet Size
List title block element types and title block and view sheet instances and sizes

Sketch Elements
Retrieve sketch elements for a selected wall

Slab Boundaries
Determine polygonal floor slab boundary loops

Slab Sides
Determine floor slab side faces

Sloped Wall
Create a sloped wall

Space Adjacency
Analyse and report space adjacencies

Status Bar Text
Set the status bar text using Windows API

Steel Stair Beams
Create a series of connected mitered steel beams for a steel stair

Unit Converter
Test ParameterUnitConverter on all floating point valued parameters on a selected element

Unrotate North
Transform element location back to original coordinates to cancel effect of rotating project north

Update Referencing Sheet
Update 'Referencing Sheet' parameter value displayed in section view header

Wall Bottom Face
Determine the bottom face of a wall

Wall Dimensions
Extract wall solid and list all its dimensions

Wall Footing
Determine wall footing from selected wall

Wall Layer Volumes
Calculate compound wall layer volumes

Wall Layers
List and determine position of all wall compound layers

Wall Neighbours
Determine wall neighbours

Wall Profile
Determine wall elevation profile boundary loop polygons

Wall Profile Polygon Areas
Determine wall elevation profile boundary loop polygon areas

Wall Top Faces
Retrieve top faces of selected or all wall

Window Handle
Determine Revit window handle and display a modeless form

The Building Coder Samples for Revit 2013 can be downloaded from near the bottom of this blog post.

No comments: