Caution: Python in the project!

No joke, this post is going to deal a bit with coding, even if I’m currently not a coder at all.

I need to thank cool guys from the Vasari forum that provided in time some help to me, like Andreas Dieckmann or Michael Kirschner. Answers provided were awesome.

The story began with a question from a colleague: how can I get elements from a linked file and have them in my host project?

My first idea was to copy paste things, but things are going to update, so no way. Then the hack of using MEP categories, and copy monitor them. Hack only, I was looking for a more robust solution as the linked models are not always in-house models. So I started gathering thoughts about doing this with Dynamo…and followed this idea.
The final result is not essential, as I learned SO MUCH in doing this. Really.
Find a problem, solve it with Dynamo: best training ever.
In the video and pictures bellow, I will try to explain what I’m doing here.
The definition is available in a link at the bottom, and I have uploaded Dynamo packages for the custom nodes.
I hope you find at least interesting if not useful.

In action:

## DISCLAIMER: this is a Work In Progress, use at your own risk, and always remember I’m not a coder ##

Get linked documentThe first custom node deals with collecting linked projects. The tricky parts is that a link exists in the database as a Revit document, but also as Instances. I have had to deal with that in the Python part. Custom node is pretty simple:

Get link CN

It provides 3 lists: the linked documents (one per linked file), the names of the documents (to choose from), and the instances of links (one or more per link document).

The Python code goes like this:

Get link Python code

I’m still learning, so I don’t want to digress on this code here.  See you on the Vasari forum if needed.

The next step is to collect family instances in the linked documents.

Get family inst from link

This custom nodes allows you to choose for a document (index in the documents list), a category, and gives you the family instances for each instance of links, with the tranform for each, meaning you get the offset to apply to families so that they are at the correct place, no matter where the link instances are in the host. Move them, it updates. See video.

Custom node naked:

Get FI from link CN

and the Python code:

Get FI from link Python code

and the final part, straightforward in Dynamo: create family instances from XYZs.

create family from link

As promised, the definition file is available here, Beware of downloading the packages Get linked documents and Get family instances from Revit link to make it run properly.

I would really like having your thoughts and comments.

Julien

Advertisements

8 thoughts on “Caution: Python in the project!

  1. Paolo Emilio Serra (@PaoloESerra)

    Hi Julien, this is really good stuff and it’s the first step of a long walk I believe 🙂
    I’m not as familiar as C# with Python but it seems fairly simple and powerful enough to achieve amazing things like this one: a copy/monitor for categories that aren’t currently supported by native Revit copy/monitor! Kudos to you and many thanks to the guys that helped you with the coding part. Hoping to see how it develops.
    Cheers,

    -Paolo

    Reply
  2. GMcDowellJr

    What version of Dynamo are you running this under? I don’t see a “Category” selection node in 0.6.2.

    Reply
  3. Pingback: Dynamo + Python + Revit = Success | Dynamo BIM

  4. Eric Rudisaile

    Hi there,
    I just came across this and I’m impressed. just 2 hours ago I was starting down the path of making something like this so seeing your definitions is going to be immensely helpful.

    One question I have is how does this work when you re-run the dynamo script? I hope to use this to keep object locations up to date, but I do not want to be re-creating objects each time I open the model and Dynamo.
    Thanks for you work, I hope to be contributing to the Dynamo community soon!

    Reply
  5. jbenoit44 Post author

    Hi Eric, in the latest release of Dynamo, families should be baked, but you have to check this. It is a frequent topic on the Dynamo forum.Glad you liked it.
    Julien

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s