Revit 2017.1 & Dynamo Tutorial – Setting All Rebar Visible and Solid in View

As many of you will already know, controlling the visibility of reinforcement within Revit can be challenging and time consuming as each new rebar modelled needs to have the visibility set, for example, you create a new range of rebar and then are required to click ‘View Visibility States’ and then select the views that you wish to see the rebar unobscured and ‘as solid’.

Link to Video: https://youtu.be/BmDQ02GhtfE

revit-rebar-view-visibility

In this tutorial I will take you through the steps required to write your own app to automatically control the rebar visibility, the tutorial will use Dynamo 1.2.1 and Revit 2017. With this tutorial no external packages are required.

Here is the end result of the tutorial shown in the video clip below.

dynamo-player

  1. Open an existing model that contains a 3D view with Reinforcement and leave the 3D view active.
  2. On the Manage ribbon, click the Dynamo Icon and start a new dynamo session.
  3. Create the following nodes as shown below (Leave the Python Script Node to step 4).

revit-rebar-visibility-dynamo

I have labelled each node so you can understand how each node operates but feel free to watch the short tutorial video if you have never used Dynamo before.

4. In the Search Bar in the Node library search for Python and add the Python Script node as shown below.

python-script-node

Double Click the Python Node in the grey area as shown below to open the ‘Edit Python Script’ dialog box.

python-edit-script-node

Copy and Paste the Python Script below and Accept Changes (to Line 35).


import clr
#Import RevitAPI for Rebar Control
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *

clr.AddReference("System")
from System.Collections.Generic import List

# Import RevitNodes
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

#Assign Inputs and Output
rebarElements = UnwrapElement(IN[0])
views = UnwrapElement(IN[1])

#Change rebar Visibility
TransactionManager.Instance.EnsureInTransaction(doc)
for view in views:
 for rebarElement in rebarElements:
 rebarElement.SetUnobscuredInView(view,1)
 rebarElement.SetSolidInView(view,1)
TransactionManager.Instance.TransactionTaskDone()

OUT = rebarElements

Your Code should now look like the image below.

python-code
Add an additional input to the Python node as shown below and wire the Rebar elements into IN[0] and the view into IN[1]. (Note that even if you are just requiring one view it must be a list for the Python Code to run without errors.)

python-script-node-with-second-input-added

Dynamo Player (Revit 2017.1)

For those of you running Revit 2017.1 you can run this simple tool directly from the Player without having to open Dynamo, this could be very useful for people that want to use these tools without wanting to open Dynamo.

On the Manage Ribbon, select the Dynamo Player Icon as shown below.

dynamo-player-icon

The Dynamo Player will then launch, you need to select the folder icon as shown in the image below and browse to the folder that contains your .dyn files. You can then simply play the script!

dynamo-player-folder

Revit and Dynamo  – Set Rebar Unobscured and solid

Autodesk Revit to Autodesk Robot Structural Analysis – Send Options

Happy New Year and look forward to all the good things planned for 2017! A few Autodesk Revit Releases back (Revit Structure 2015), Autodesk made a change to the integration with Autodesk Robot Structural Analysis to allow the transfer of data via an Intermediate .smxx file (Structural Binary file for transfer). Whilst this new format offers some benefits, the older method did have a few additional features that have not been incorporated within the .smxx export.revit-to-robot

The most useful of these were around offsetting structural members and the use of System panels and mullions.

Here is the process of transferring offsets in Revit to offsets in Autodesk Robot Structural Analysis. The beams have a z Offset Value of -50 set in the Properties Palette.

structural-framing-offset

When the model is ready to be transferred to Robot Structural Analysis, hold down the Ctrl Key whilst clicking the Robot Structural Analysis Link command. You can then click the Send Options and select the ‘Use drawing model offsets as analytical’ check box.

revit-to-robot-options

Here is the result in Robot Structural Analysis.

robot-structural-analysis-offsets

Some of these legacy features can be useful so the Ctrl Key can revert back to the legacy method. Please be aware that results cannot be transferred to Revit using the ‘old’ method.

Hope this helps,

LawrenceH