Revit 2015 API News – DevDays Online Recording

As

the Walrus said
,
now “the time has come … to talk of many things”, including the highlights of the new Revit API functionality, so here we go!

Welcome to my first post on the Revit 2015 API, disregarding the

RevitLookup migration to Revit 2015
,
of course.

A couple of posts on upcoming Revit 2015 product functionality were already published in the past week or so, e.g.:

I will therefore skip all product related stuff and dive straight into the API instead.

Here is the Revit 2015 DevDays Online recording material, based on the presentations shown at the confidential Autodesk DevDays conferences in and around December 2013.

The next thing I want to do is to publish the “What’s New” section from the updated Revit API help file RevitAPI.chm, to ensure it is available for and easily found by online searches, as for the past few releases:

That is always the first place to explore if you have any questions about or problems with your migration or the new functionality provided.

I wish you lots of fun and excitement exploring the new possibilities provided by the Revit 2015 API!

Right Click Circle of Commands GUI Design for Revit

Sticking with what we already have for the moment, another interesting this that just came up on the Revit API forum is this discussion thread initiated by Ryan on

GUI design for Revit
.

Ryan suggests developing a secondary user-infterface for Revit, like the right-click command in Fusion 360, or Inventor, a wheel (or circle) showing a pre-determined list of commands.

The Revit user interface could look something like this:

Revit user interface

Commands placed on circle segments:

Commands placed on circle segments

Interactive command population:

Interactive command population

Now Brett of BRevit presented a
20-second video of WheelConcept,
a working implementation of a right-click circle of commands based on the PostCommand API.

In his own words:

I think a lot can be achieved with the postcommand function. Hope you don’t mind but i took your idea and gave it a crack….

Firstly i created a form with the wheel as the background. I created a public property on the form which is the id of the command to issue:


  Public CommandToIssue As RevitCommandId

I then created transparent picture boxes over the various icons. Clicking on a picturebox asigns a command id and closes the form:


  Private Sub PictureBox2_Click( _
    ByVal sender As Object, _
    ByVal e As EventArgs) _
  Handles PictureBox2.Click
    CommandToIssue _
      = RevitCommandId.LookupPostableCommandId( _
        PostableCommand.StructuralColumn)
    Close()
  End Sub

Under the forms show event i added code to locate the form at the mouses current position:


  Private Sub WheelForm_Shown( _
    ByVal sender As Object, _
    ByVal e As EventArgs) _
  Handles Me.Shown
    Location = New System.Drawing.Point( _
      CInt(MousePosition.X - (Me.Width / 2)), _
      CInt(MousePosition.Y - (Me.Width / 2)))
  End Sub

Finally I setup a command to display the wheel, and post the command:


Option Strict On
Option Explicit On
 
Imports Autodesk.Revit.Attributes
Imports Autodesk.Revit.UI
 
Imports BrevitTools.UI.Wheel
 
<Transaction(TransactionMode.Manual)> _
Public Class Wheel
  Implements IExternalCommand
 
  Public Function Execute( _
    ByVal cmdData As ExternalCommandData, _
    ByRef message As String, _
    ByVal elements As Autodesk.Revit.DB.ElementSet) _
  As Result Implements IExternalCommand.Execute
 
    Dim form As New WheelForm
    form.ShowDialog()
 
    If form.CommandToIssue IsNot Nothing Then
      cmdData.Application.PostCommand(
        form.CommandToIssue)
    End If
 
    Return Result.Succeeded
 
  End Function
 
End Class

To display the wheel inside revit I assigned a shotcut key (ww).

Here is link to a

video of it in action
.

I think there is loads of potential for this. You could easily add code to check what elements are preselected and then display a contextual wheel.

Thank you very much, Ryan, for the interesting suggestion, and Brett, for sharing this fine implementation!


Comments

8 responses to “Revit 2015 API News – DevDays Online Recording”

  1. With the new version of Revit and Changes to the API, does it now handle trimmed surfaces form other programs?

  2. Thanks Jeremy for staying on top of this. Its just something I’ve been fiddling with lately and I’m glad someone could help.

  3. Dear Ryan,
    Thank you very much for your appreciation.
    I am very glad and above all grateful to Brett that we could bring this forward so far so fast.
    Looking forward to that beer in Las Vegas!
    Cheers, Jeremy.

  4. Dear Chris,
    There are some small but significant enhancements to the geometry API.
    I cannot tell off-hand, though, nor do I know exactly what you are after.
    Please take a look as soon as you can obtain a version and let us know if it leaves anything to be desired.
    If so, please provide a reproducible case for us to understand your needs, exactly what you are trying to achieve, and how, and what behaviour you are observing, so we can raise a wish list item for any missing functionality, i.e.:

    A complete yet minimal Revit sample model to run a test in.
    A complete yet minimal Visual Studio solution with add-in manifest so that we can compile, load and run the application with a single click and explore its behaviour live in the sample model you provide.
    Detailed step-by-step instructions for reproducing the issue.
    Specification of the exact behaviour you observe versus what you expect.

    Thank you!
    I am sorry to say that if you did not already submit a wish list item specifying your exact needs in the past, it is quite unlikely that they have been fulfilled now, you know.
    Cheers, Jeremy.

  5. I got five errors after compiling the API samples. All were related to the STLImportCommand. After “fixing” them the commands won’t work for me.

  6. Dear Mike,
    Thank you for your report.
    Do you mean the samples demonstrating the new Revit 2015 API functionality?
    Please be aware that these samples were created for an early pre-release and have not been updated or tested since.
    They probably require adaptation for the final version.
    Are you testing them on Revit 2015 UR1?
    What are the five errors you see?
    How did you fix them?
    What behaviour are you expecting?
    What is the behaviour you observe?
    Cheers, Jeremy.

  7. Thank you! This is an awesome idea/design!
    This is a great alternative to always having to use keyboard for ‘keyboard shortcuts’.
    Now all I need is collapse/expand all for view/sheet/family browser.

  8. Hello Jeremy,
    Can you please provide the full command for this. I have no idea how to input this to create my own.
    I am clueless when it comes to API even though I would really enjoy learning about how it works…
    This would mean a lot to me even if it is still in development. I have been waiting for something like this for a long time.
    Respectfully,
    Corbin

Leave a Reply to ChrisCancel reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading