Instantiate revit families from Rhino Inside

Is there a way to instantiate revit families in the revit doc from Rhino Inside? I could not find a way to access the current revit doc from Rhino inside. Would be really helpful if there was a way to do that.

Hi,

I see you used the tag ‘python’.
You need to do it using Python or is it fine if you can use Grasshopper to do it?

1 Like

If you have that component in grasshopper I can access that in python by importing the gh library if need be.

Hi,

Any updates on this?

Still not.

But It’s in the list at the very top.

3 Likes

Hello,

I solved the issue. Basically made a node in grasshopper following the rhino inside documentation in github. But that led to a more interesting problem. Is it possible to add a node in grasshopper that opens and closes transaction for other changes (mirroring, deleting, moving etc.) to be made in revit doc. Or how to run it from python in grasshopper. I guess as I am running it from grasshopper, the standard way to open transaction: “TransactionManager.Instance.EnsureInTransaction(Revit.ActiveDBDocument)” returns an error. Any hint on this would be really helpful.

Thanks.

I’ve updated the repository with a component to add Family Instances to the Revit document.

Also added support to Revit 2020 for any of you that have already updated your Revit.

About the standard way of starting a transaction in Revit I recommend you to use the code bellow.

  using (var trans = new Transaction(Revit.ActiveDBDocument))
  {
    try
    {
      if (trans.Start("TransactionName") == TransactionStatus.Started)
      {
        // Your Revit document changes here...

        var status = trans.Commit();

        if (status == TransactionStatus.Committed)
        {
          // Your changes are made effective in the Revit document here.
        }
      }
    }
    catch (Exception)
    {
      if (trans.HasStarted())
        trans.RollBack();
    }
  }
2 Likes

Thanks for the updates. Using the above transaction method in grasshopper I am getting the error:

Runtime error (InvalidOperationException): Starting a transaction from an external application running outside of API context is not allowed.

This should be fixed with the last merge I did in the branch autodesk/revit/wip .
Could you please test it and tell me if works in your computer?

Thanks for the update! I will try to report after testing by this week.

Dear Kike,

Firstly, thank you for all the efforts in bringing RiR alive. I am checking almost every day if there are any updates.

I think that it is not possible right now to control some of the parameters of families via grasshopper. For example dimensions.
Am I right? If so, are you maybe working on this functionality?

Hi,

Yes it’s already possible, but you need to do those changes into the family type.

4 Likes

That’s lovely. Thank you Kike.

can you please send an example file ? or add bifocals to the image
i can’t find the components in the new updated version

Icons have changed, and there are some more.

i just make a new column as a new family then I inspect its parameter but no results,
or we have to save it then apply as replacing?

The Add by Location component has successfully ran (black), the only thing missing is the Element into the Element Parameter. Connect the C to the E.

The other possibility is that there isn’t a parameter called Dimensions : b, and you need to get the parameters again via the Inspect component to get the correct parameter.