Learn to Program

Hey guys,

some of you have no clue where to start learning to program. I don’t know if you are familiar with basics like datatypes and control structures or if you are a very beginner, but let me tell you, where and how I began to program.

I started to program in school and learned all the necessary basics. In my bachelor studies I had only one programming course (which was a Java course) but this semester I have two more advanced courses. One again one with Java and the other one with C++.

Anyway, there is no real obstacle to learn different languages, if you get the ideas behind control structures, data types, data structures and object-oriented programming. In the end, you just change some keywords, and so it doesn’t really matter with which language you start. I think Python is a good language to start because it is an object-oriented language and you can utilize your skills instantly and program some fancy IronPython scripts in Dynamo.

I can provide you some useful links, but it depends what type of learning you like the most. If you want to learn it in a really interactive way, you should sign into codeacademy and start the Python course, but be careful. Codeacademy will reward you really fast and often. Programming is the very opposite of it.

That’s why I suggest to learn it in a more traditional way. Maybe go through some free accessible books like: Dive into Python 3.

If you are a student please check your library. Most of them have eBook contracts and you can download really expensive stuff for free. The same holds for lynda. Lynda is a great online course-platform and many universities have a contract with them. For example my university made an unlimited contract, so that I have access to every course on lynda. That’s really awesome.

So the last thing I recommend you is one specific lynda course. It will introduce you basic ideas of datatypes, control structures and object oriented programming. Additionally all examples are shown with Dynamo/RevitAPI. So you will get the basics of Python and you’ll do some cool stuff with AEC software! Click here: Dynamo for Revit: Python Scripting.

Let me know which way you choose and feel free to contact me anytime. Maybe I have some additional and more helpful resources for you.

24dgq2

The mighty Dynamo Forum

Don’t reinvent the wheel. If you are trying to solve a problem, which can occur in multiple disciplines then it may be usefull to search through the Dynamo forum. Here is an example:

At my office we use SOFiSTiK Reinforcement add-in for Revit, because it automises many tasks. However, schedule all the rebars and fabric sheets can be quite difficult. The schedule function gathers all rebars which are assigned to one sheet. Therefore if you want to group all the rebars of level 1,.. into one schedule (because of estimation reasons), then you will probably loose the overview of all the rebar marks and compenents where they are part of.

So I searched Google for a solution to this and I found this link which is worth a mint: Dynamo forum link. This Dynamo graph will apply to all of your elements the sheet, where they are included. This. is. huge.

You can use this workflow to filter elements by GetParameterBy… afterwards. You can request it for example if all the rebars contains at least two sheets (one sheet where the whole level is shown, one for the component where they are part of).

Refurbishment projects with focus in structural engineering. Visualization of column’s load-bearing capacity

Sometimes it is all about to presenting data in an easily understandable way. Especially when the project hasn’t started yet and you have to present the advantages offered by your office. So my boss came up to me and asked me if I can accomplish a visualization task.
We have a refurbishment project (no digital data available like BIM models, plans,..) and I modeled every column with it’s belonging load-bearing capacity. The load-bearing capacity is the entry of the “comments” property of each object.

column

At first, I thought about to draw isolines of a capacity-surface but it takes too long to compute the surface. I asked Jostein Berger Olsen (http://jbdynamo.blogspot.de/) for his help and he came up with a much smarter idea. He edited my script in a way that circles would be drawn and the properties (like radius and color) depends on the load-bearing capacity. Let’s break down the whole task into some specific subtasks.

  1. Extract all the “comments” data out of each column
  2. As you can see, we have this weird way in Germany to express a decimal digit. Therefore I have to extract the string, erase the last 3 letters (whitespace+”MN”), change the “,” to a “.” and parse the string to a float/double type.
  3. If there is no entry, set the capacity to almost zero.
  4. Creating circles, where the middle points are the middle point of each column and the radius is the capacity of each column.
  5. Create a color range where the range is the normed range of our capacity (use of the Math.RemapRange)
  6. Overwrite the visibility of the circles with the belonging color-range-list.

So that’s it!
Here we have the result:

dynamo graph

The python script:

dynamo python

And finally the result:

resultresult2