Tag Archives: main

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

 

3DS Max – Floor Generator Plugins

Today I present something must have for all interior/exterior visualizers and not only.

CG Source released 3 plugins/scripts for 3DS Max up to version 2013:

  • FloorGenerator is a script for 3dsmax which generates floor objects consisting of individual boards which can easily be textured using MultiTexture.
  • MultiTexture Map is a plugin for 3dsmax that loads multiple textures and assigns them randomly, either by object or by material ID. With controls to randomly adjust the gamma, hue and saturation.
  • UniqueMaterialID is a small script for 3dsmax to assign unique material ID to each element inside an object.

Here you can find detailed tutorial by Bertrand Benoit about Using Floor Generator Script .

From Here you can download some free sets of textures to use with the Floor Generator kindly shared by Mário Nogueira.

floor generator