Category Archives: Revit

Revit/Dynamo – crate location points ordered in columns and rows for list elements

Long I was gone but now I’m back and in GRIMSHAW. Youhoo! 🙂

Partly for the office but mainly after hours I created this simple Dynamo script to orginise elements into columns and rows. Original task was to place views on sheets. Sometime there was one view other time 3 or 5. We wanted to make them not overlap. Although, they would need to be manually corrected later.

Presented her solution is doing just a part of this task. It creates points arranged in maximum number of columns and as many rows as there are objects for each similar string inputs on a list.

(In our office exercise this list contained ordered sheet numbers for corresponding list but with views. A node to “place views on sheets” takes a view, a point with coordinates and is placing it on a provided sheet. List of views, points and sheets must be the same length.)

This Dynamo script is creating this list of points. You have an option to specify the insertion/start point coordinates, max number of columns and a distance between columns and rows. But see it by yourself.

If I orginise points by z coordinate the output looks like this:

Levels would represent sheets or could be Revit Levels used to order other objects.

Python code looks like this:

startX = IN[0]
startY = IN[1] 

offsetX = IN[2]
offsetY = IN[3]

no_of_col = IN[4]

list = IN[5]

pointsX = []
pointsY = []


compare = ""
col_no = 1
row_no = 1

for l in list:
	if compare == l:
		if col_no <= no_of_col:
			pointsX.append(startX + offsetX*(col_no-1))
			pointsY.append(startY - offsetY*(row_no-1))
			compare = l
			col_no +=1
		else:
			col_no =2
			pointsX.append(startX)
			row_no +=1
			pointsY.append(startY - offsetY*(row_no-1))
			compare = l
	else:
		pointsX.append(startX)
		pointsY.append(startY)
		col_no =2
		row_no =1
		compare = l

OUT = pointsX, pointsY

You can download the Dynamo file from here.

Revit – Door threshold behavior

I would like to present in the below images a weird door threshold behavior in Revit.

I discovered it when I was trying to annotate a level of the door threshold in structural wall.

What I discovered is that door threshold is not visible by default at the level where doors are placed or below it and only when doors are raised by more than 0.159 mm it appears in plan.

Please notice the Sill Height set to 0.159mm. From 0. 160mm sill becomes visible.

In the image below I could only place an elevation mark because of the floor.

In project on which I was working I end up moving all doors up by 0.16mm to be able to place elevation mark on the thresholds.

I believe it would be better to make a parameter which would switch door threshold visibility instead of implementing this weird behavior.

Revit – Setting Parameters Values in Macro Programming (with VB.Net)

Back in the old days, it was easy to set any parameter value in macro. This was the code I was using in Revit 2014:

 

element.parameter("Any Parameter Name").set("value")

This was working for Build-in Parameters, Sheared Parameters and Project Parameters. When I migrated some macros to Revit 2017 this formula wasn’t working any more. After some search I found a solution. Unfortunately for every parameter type it’s different.

Build-in Parameters:

Build-in Parameters can be set by referencing to parameter Definition name.

in VB.Net

element.parameter(BuiltInParameter.DEFINITION_NAME).[set]("value")

in Python for Windows Comments parameter:

element.get_Parameter(BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS).Set("value")

Parameter Definition Name one can find using Revit Lookup or in API help.

Example in VB.Net from my amended macro for sheet parameters: Drawn By, Checked By and Sheet Issue Date:

m_vs.parameter(BuiltInParameter.SHEET_DRAWN_BY).[set](curSheet.sheetDrawn)
 m_vs.parameter(BuiltInParameter.SHEET_CHECKED_BY).[set](curSheet.sheetChecked)
m_vs.parameter(BuiltInParameter.SHEET_ISSUE_DATE).[Set](curSheet.sheetDate)

Shared Parameters:

Shared Parameters can be set by referencing their GUID number.

in VB.Net:

element.parameter(New Guid("guid-wierd-number").[set]("value")

in Python in Dynamo it DOESN’T WORK:

from System import Guid

NewGuid = Guid("7839a188-7b93-457a-9c33-0a4940183f18")
element.Parameter[NewGuid].Set("value")

Guid Number for Shared Parameters can be found in Shared Parameter file i.e

Code example in VB.Net from my amended macro:

 m_vs.parameter(New Guid("3c5aa4ef-99ff-4a51-abfe-7f7129b9fed4")).[Set](curSheet.documentType)

Project Parameters:

Project Parameters can be set by referencing in the formula parameter’s Definition by itself.

in VB.Net:

 Dim ParameterList As IList(Of Parameter)
 Parameterlist = element.GetParameters("Parameter Name")
 Dim Parameter As Parameter
 Parameter = ParameterList(0)
   element.parameter(Parameter.Definition).[set]("value")

in Python in Dynamo it DOESN’T WORK:

ParameterList = element.GetParameters("Parameter Name")
Parameter = ParameterList[0]
element.get_Parameter[Parameter.Definition].Set("value")

Is unsubscriptable  with get_Parameter or expects BuiltInParamter.

Any one knows how to make it work in Python in Dynamo?

 

Revit – VB.Net Macro to make Print (Sheet) Sets from Sheet’s parameter.

Back in 2015 when I started learning  programing macros in SharpDevelop in Revit to change  different parameter’s value like Sheet names, Room numbers or custom Parameters, I decided to find a time saving solution to something more serious.

In our office there was a need to create about 35 Sheet Sets for printing purposes from few hundreds of drawings in our project. Sheets created in our project were divided to series.  Because we wanted to have more descriptive information in project browser then just a simple Sheet number we added a custom Project Parameter to Sheets called “Drawing Sheet Series”. (i.e. Sheets begging with number 20 had this parameter set to “(20) General Arrangment”)

This way all the sheets in our project were divided.

As a beginner to start with this task I needed some help. I didn’t know how to alter Revit print settings. It wasn’t easy to understand Revit API help file but I found a useful macro at Boos Your BIM web page (link is hear) which is creating a Sheet Set from Sheets containing in their number specific letters.  In my case I needed to do it for all Sheets therefor changes were required. Additionally because it was written in C# and I was more fluent in VB.Net I decided to translate it.

Below you can find a final macro prepared for Revit 2015:

Continue reading Revit – VB.Net Macro to make Print (Sheet) Sets from Sheet’s parameter.

Revit – Installing Revit Lookup 2016

I encountered some problems while trying to compile Revit Lookup 2016  using the procedure described on the archi-lab.net page for Revit 2014. It didn’t work. SharpDevelop couldn’t build solution.

This was the output information:Error Output SharpDevelop at start

 

Instead of reading it I tried to download the compiled version 2016 from the Internet.  Kindly Troy Gates  shares it on his blog – Revit Coaster. But it didn’t work either. I received this error.Error Revit Lookup 2016

(here is also a compiled Revit Lookup 2015 at Revit Coaster)

Then I tried again to compile it using SharopDevelop but his time I had read the Output window which was showing what is wrong. Error Output SharpDevelop

The problem of course was with the path so I tried to locate this path. I found it under Properties by clicking at Revit Lookup in Project Panel.Error SharpDevelop 1

It can also be accessed through the top menu Project > Project Options..

The wrong path was under Compiling tab in Output Path here:Error SharpDevelop 2

I changed it to the existing folder in …bin\Debug\ and all went fine.

SharpDevelope nicely compiled the project and put two files RevitLookup.addin and RevitLookup.dll automatically in: C:\Users\UserName\AppData\Roaming\Autodesk\Revit\Addins\2016

Revit started with Revit lookup 2016 already installed.


The complete procedure to Install Revit Lookup 2016 looks like this:

  1. Download the latest Revit Lookup 2016 from https://github.com/jeremytammik/RevitLookup/releases
  2. Open SharpDevelop. It should be installed automatically with revit 2016. You can find the SharpDevelop.exe file in here: C:\Program Files\Autodesk\Revit 2016\SDA\bin
  3. Drag and drop RevitLookup.csproj to the Projects Panel.
  4. Remove existing References from Projects Panel to RevitAPI and RevitAPIUI.Error SharpDevelop 3
  5. Add references to the RevitAPI.dll and RevitAPIUI.dll that can be found in the main Revit folder at: C:\Program Files\Autodesk\Revit 2016
    Right click on References:02Go to .NET Assembly Browser and click on the Browse… button.03Go to the C:\Program Files\Autodesk\Revit 2016 location and add the RevitAPI.dll and RevitAPIUI.dll file.
  6. Amend the Output Path in menu Project >Project Options.. > Compiling to any existing folderif you have an error like me.
  7. Hit  Build Solutions button and watch for errors. If it says that it was Build Successfully then you are good to go.The RevitLookup.addin and RevitLookup.dll will be saved in: C:\Users\Name\AppData\Roaming\Autodesk\Revit\Addins\2016
    If you get bunch of warnings with it, its OK as long as its compiled successfully. I didn’t have any.
    If you want to use ProgramData instead, copy RevitLookup.addin and RevitLookup.dll to:
    C:\ProgramData\Autodesk\Revit\Addins\2016 and remove them from:
    %appdata%\Autodesk\Revit\Addins\2016
  8. Open Revit and check if Lookup 2016 is in the  Add-Ins tab.

I hope I helped.

Revit API – Why to learn programming and where to start?

I have recently started my adventure with Revit API.

Main reason – Revit sucks*.

My main question was:
How much I can improve Revit by learning programming in it?

I’m not an expert yet like Jeremy Tammik but I can answer to this question like this: You can do only as much as developers of Revit API allows you to do. Unfortunately they won’t allow you to change Revit core functionality and introduce new features or objects. (It’s not Sketchup 😉 )

API allows an access to the same commands which are used during normal operation of Revit but still not to all of them. API is improved with every new Revit edition and then new commands are made available.

Learning programming with API can allow you to automate tedious tasks, can allow you to build visual interface to commands (i.e Dynamo is one of them) you can save sequences of these commands as Revit Macros or Add-ins and what most important you can join these commands in thousands of different ways.

Remember:
“Any step that cannot be solved through the user interface can almost certainly not be automated either.”   Jeremy Tammik


So where to start?

I gathered  below the most important links which should answer your questions. Read them. Additionally I will try to help.

First you will need to decide which programming language you should start to learn. It’s not an easy answer. There are 4 of them:

  • C# (sharp)
  • VB.Net
  • Python
  • Ruby

There is plenty of Macros in C# and VB.Net in the Internet.
This is a huge advantage for these languages.  Vast number of commands and a complexity of  relations between them make it nearly impossible to learn programming without examples.

I talked with some IT friends and they advices me to learn Python as the most friendly language still with many resources.
VB.Net is little more friendly then C#.
Ruby is the less popular. I didn’t consider to learn it.

And then came the reality.  I planed to learn Python but when I encountered a problem in my work I could only find a similar Macro in VB.Net. I decided not to translate it to Python (which I didn’t know too well) but only to slightly amend it to my particular problem. This way I end up amending many Macros and learning VB.Net (and a little C#)

Some time passed and the Dynamo which is based on Python got a lot of improvements and become more stable then before. Increase in implementation of API commands made it really functional.
Interface allows to easily build command structures and amend relations between then. Code Blocks of Python code or the whole Nodes can be used regardless of the predefined Dynamo objects.

I would advice everyone now to learn programming in Dynamo using Python but at the same time understanding of C# and VB.Net may be very useful for solving complex problems. At some point it may also be useful to convert code to Add-in and make a desired functionality a permanent element of the Revit user interface.


Additional very useful tools:

  • Revit Lookup  – This tool allows to investigate how Revit is build, check what parameters have objects and what is the relation between them.

How to install Revit Lookup:

Link to download Revit lookup:
  • API help file – RevitAPI.chm – This a library of all the commands available in the current Revit API version along with some examples. If you can’t find a command in there it doesn’t exist.

RevitAPI.chm is a part of  Revit SDK which can be downloaded from the Revit Developer Center.


Additional very useful links:

Jeremy Tammik introduction to  Revit API:
Getting Started

The Building Coder webpage by Jeremy Tammik

Michael Kilkelly introdution to Revit API:

ArchSmarter  webpage by Michael Kilkelly

Boost Your BIM introduction to  Revit API:
Learn to program the Revit API by Boost Your BIM 

Boost Your BIM webpage.

Start with Python:
http://blog.productspec.net/2015/02/03/beginners-guide-to-python-in-autodesk-revit/

PDF about Scripting with RevitPythonShell:
http://thebuildingcoder.typepad.com/files/cp3837-l_scripting_revitpythonshell_handout.pdf

Another link with PFD about:
Scripting Autodesk Revit with RevitPythonShell

About Python and Ruby:
http://thebuildingcoder.typepad.com/blog/2013/06/python-and-ruby-scripting-resources-and-the-sharp-glyph.html

Link to download Revit Python Shell:
https://github.com/architecture-building-systems/revitpythonshell

Links to learn programming in Python:
The Python Tutorial — Python 2.7.10 documentation
docs.python.org – newer versions of Python
http://www.diveintopython.net/

Python Macro template:
http://wiki.theprovingground.org/revit-api-py-setup

About Revit Macros:
https://www.augi.com/library/getting-started-with-revit-macros
https://www.augi.com/library/introduction-to-revit-macros

What’s the difference between macro and Add-in:
https://boostyourbim.wordpress.com/2012/12/05/macros-vs-add-ins-whats-the-difference/

My First Plug-in Training – Learn how to create  add-in with C# in Microsoft® Visual C# Express

http://help.autodesk.com/ – There is a part devoted to developers like you.

DevTV movie introduction to the Revit 2015 API

API – Application Program Interface
SDK – Software Development Kit

 * Still Revit is the best BIM software I know.

Good luck and have fun.

Dynamo – parametric design for Revit

Time to make mind blowing designs responsible to variable parameters, easily adjustable and flexible.

What Grasshoper is for Rhino this Dynamo is for Revit.

DYNAMO its a generative design plug-in for REVIT/VASARI, which make possible the creation of new possibilities in parametric design, beyond the products from-the-box. Its a open source initiative, this means that any one that knows something about programming can access the code and make improvements, create components, etc.. AUTODESK made their collaboration adding new nodes, functionalities and relaunching it as DYNAMO FOR VASARI, allowing visual programming in a platform that already support integrated analysis and performance based design. Right now it runs on REVIT 2013 and VASARI.

It´s important to be aware that DYNAMO is a BETA product, so you have to be patient to it and know it can crash sometimes, as any on-development product would do.” PANELBIM

Functionality of the plugin is expanded very often. The way of building relations is nearly similar to the Grasshoper. If you would like to download it check the links below for the latest version:

If you would like to learn Dynamo go here: Learn Dynamo or check the great blog by Zach Kron – buildz.

sructural

 

Revit – Cut Line Styles override

Short lesson for everyone learning Revit about how to change graphical appearance of walls, floor and roofs in plan and section.

Imagine that for structural engineer you want to emphasize the structural core of your building. What you need to do?

Go to Properties panel of your view and open Visibility/Graphics Override window. It should look like on the image below. Walls by default have thick outline.
Lines - no override
Notice that there is a tick box called Cut Line Styles in an area named Override Host layers. Check that box and hit Edit… button. New window will appear where you can adjust line styles individually for all functional elements of your wall, floors and roof.

For purpose of our task we need to make thicker only the structure [1] – the core elements.

Images below will explain you differences between options for Core layer clean-up.
By default there is no line between core elements of the same kind.
Lines - no edge

Change to Use Function to see thick line between all structural elements.
Lines - Use Function

Change to Use Common Edge style to see connection and be able to adjust it by changing Common Edges style.
Lines - USe common edge style

You can change Common Edges style in Object Styles window on Manage tab
Lines - common lines style
or override it in your view in Visibility/Graphics Override window.
Lines - common lines override

Thank you for learning with PabLab 🙂

Revit – elevator plug-in

Check that guys – ElevatorArchitect free plug-in for Revit.

“DigiPara Elevatorarchitect provides free optimized Revit families to easily create elevator models inside Autodesk Revit software. Start the plug-in directly inside Revit and find the correct size and number of required elevators within seconds.”

It helps a lot. Watch the tutorial on Digipara website.
You can choose manufacturer real existing lift and easily implement into the model.

ElevatorArchitectElevators3D

ElevatorArchitectElevators3D window

AutoCAD & Revit – Free Hatches

I have a present for all of you – two patterns (hatches):
Sitework Earth 45 – rotated by 45 deg.
Rhombus
I created them by myself to use them in Revit.
Earth 45 – because there is no way to rotate a pattern in a section.
Rhombus – to use as a hatch representing insulation.
Later I change the scale by 100 to use them in AutoCAD.

You can use them free of charge even for commercial use.

You can download them here (zipped):
Patterns

Hatches