Rhino Inside Revit Plugin Question

Hi team,

So imagine this scenario:

I have a Rhino Plugin, that was loaded when Rhino Inside Revit was launched. Pretty typical so far. Now, is there any way for me to get hold of Revit Application/Document from that plugin? I am interested in obtaining information about what Revit file is being modified by RIR. Thoughts?

Cheers!

1 Like

would that be similar to how Wallacei is using RiR in this video?

Hi,

Do you mean from a user perspective or from a PlugIn developer perspective?

Plugin developer. From Rhino plugin scope, is there any way to tap into RIR’s connection to Revit, so that I can obtain info about current Revit session (Document).

I guess that would be possible if you guys had some sort of public static class that would hold a reference to Revit Document. Thoughts?

Cheers!

Ps. Just to give you some context. I am working on a plugin for Rhino that reports on basic usage stats. One of the things that I would like to do, is report if Rhino was launched from Revit, and if so what Revit file was modified. I can get the info about Rhino getting fired from Revit, via Process.GetCurrentProcess() which returns “Revit” rather than “Rhino”. So if I am in Rhino 7 and process name is “Revit” I know we are in RIR. Now, I would like a little more info about Revit session.

In that case you need to reference RevitAPI.dll, RevitAPIUI.dll, RhinoInside.Revit.dll and us it like this.
Keep in mind that this in WIP so the API may change, but of course you can start playing with it.

using Rhino;
using Rhino.Commands;
using RhinoInside.Revit;

namespace MyPlugIn
{
  public class MyCommand1 : Command
  {
    static MyCommand1 _instance;
    public MyCommand1() => _instance = this;
    public static MyCommand1 Instance => _instance;
    public override string EnglishName => "MyCommand1";

    protected override Result RunCommand(RhinoDoc doc, RunMode mode)
    {
      var documentTitle = Revit.ActiveUIDocument.Document.Title;
      RhinoApp.WriteLine($"Current Revit Document title is '{documentTitle}'");

      return Result.Success;
    }
  }
}
1 Like

Awesome! I will check this out. Thank you.