tirsdag 15. desember 2015

Happy Holidays! The Story of Concrete Santa.

So I'm gonna wrap up this year by taking you along for a pretty useless software trip. First of all a big shoutout to Magne Ganz over at Multiconsult for inspiration and introducing me to Meshlab which is an opensource 3d mesh software. Quite neat little thing! Magne has used meshlab for both making a mesh from images via recap 360 and also for importing .pts files to topography in Revit via Dynamo.

Check out his Youtube videos here: https://www.youtube.com/user/MrGanzM/videos

But enough serious stuff. Ever wanted to import your daughter's Santa Claus into Revit as a generic family? Yes? Well, look no further:

First off, take a lot of pictures. Minimum recommended is 20, but preferably even more. In this example I took about 40ish.

Recap 360
Then when all the pictures are transferred safely to your hard drive, go to https://recap360.autodesk.com/ , log in and upload your photos. then let Recap do the magic for you. Which images Recap uses are dependent on the quality of your photos and even your lighting. If some photos are not usable you are given the option to manually stitch them together with the rest.

the result:

Go back to your dashboard and you get the option to download a .obj file amongst others.

On to Meshlab, open it up and open your obj file, you'll get the mesh and the textures as well

Then I did the following:
1. Clean up. There are many ways to select vertices and faces in meshlab, but the brush is probably my favorite for now. When you have selected the faces you don't want, just press delete.
2. Filter. After cleaning I reduced the number of faces from about 160000 to just 4500 using one of the many filters in Meshlab called Quadric Edge Collapse Decimation. Don't know if it's the best, but it worked quite nicely.
3. Close any holes and make the mesh watertight.

In wireframe, good ol' Santa now looks like this:

Save the mesh as an .obj file once again, and spark up:

First of all you have to download the package called MeshToolkit from the package manager, Then all you have to do is this:
The reason for mirroring is just because my Santa was upside down..

Santa no longer got any textures, though. So I thought I would give him some by doing a little slope analysis on him.
(Mind you that the Mesh.Triangles node below WILL slow down your script pretty much. And that's why it was necessary to reduce the number of faces originally outputted by Recap.)

Well, then there is just one more thing to do, convert to solid and import to Revit as a generic family:

To Revit:

Change the material and you got yourself a concrete Santa! (A little different scale, but what the heck..)

Now, if I just had a concrete 3d printer..

Happy Holidays!

onsdag 2. desember 2015

Follow up: Cutting Objects to Topography: 3D water

I got a comment on my last post from the great landarchBIM stating that water volumes would be a great area of use for the "FamilyInstance.ByGeometry" node from "Spring nodes" package. So I naturally wanted to try that out. In addition I wanted to try out the "Elk"-package which enables Dynamo to read OSM and topography data into Dynamo. So why not combine?

For an introduction to the Elk-package have a look here:
Dynamo and OSM: https://vimeo.com/143623515
Dynamo and Topography: https://vimeo.com/143624038

I went with a small area of the Grand Canyon as the test site and downloaded a tiff file according to Timothy Logans videos above.

This is from http://earthexplorer.usgs.gov/ and you have to make an account, but it's free!

It's accurately described in the videos above, but this is the Dynamo script for making a Revit topography from the SRTM-data provided form the earthexplorer site:

Quite simple, eh?

In the next part I've added a nearly identical node layout as my last script, but with some modifications. For example cutting the solid at a certain waterlevel. The script is quick and dirty and more of a proof of concept than anything else. I guess it could be automated to select the correct solid to be imported, but it worked as is for me.

Depending on which way you draw the model lines used for defining the extent of water, you will have to switch between the first and last item in the solid operations and also switch between +/- for the offsets. Someone will improve on this for certain! ;) As I said, quick and dirty, but it works.

Depending on Revit's cooperation you must sometimes also place the imported family yourself, but just select the correct import level and place the family in the project base point.

Next I gave the family a material parameter and changed it to water, and voila!

Even a smooth bottom surface!

The Topo in Revit is triangulated and you can choose whether you want to use this triangulated model for modeling the water. You can just as well use the surface directly (as I did) to get a smooth edge at the bottom, but then it mismatches a little bit with the generated topo in Revit, no big deal as far as I'm concerned.

Come to think of it, why not import the surface as a solid family itself, all shiny and chrome? ;)

onsdag 18. november 2015

Ammo: Cutting Objects to Topography

I've worked with Revit as a modeling tool for quite some time now and every now and then I face the need to cut objects with a topography. This is typically dam constructions or other objects that need to fit to a rock surface.

I haven't been very thorough in my research online within the native Revit enviroment but as far as I can tell there aren't that many options, if any.

So naturally I have been searching for a solution with Dynamo, but so far it has been to no avail.

Until now that is.

Enter Dimitar Venkov's spring nodes.

Dimitar wonderful collection of nodes has been extended with a particularly useful node, the "FamilyInstance.ByGeometry"

By providing a family template file, category, name and the geometry itself it generates a family of whatever geometry you fancy. (With the disclaimer that his node is in beta. And Dynamo is beta.. and.. just try it.)

Couldn't quite get it to work with generating the family as a void, but that's a quick fix and nothing compared to the advantages this tool gives us.

The result in Revit:

And a quick youtube video, Enjoy!

mandag 26. oktober 2015

Ammo: Replication Guides for (semi-)Dummies

I'll for one admit it. These replication guides are useable, but not very understandable.. I get the basics they teach you over at Dynamo primer and in the designscript manual, but I see Dynamites use these for much more complicated things all the time and I wonder how they figure it out..

Well, this has got to end, right?

So the post today is mostly for my own sake. Hopefully, though, someothers can also pick it up and use it to get what these suckers is all about. I will also update the post as time goes by and additional knowledge is acquired.

Just some terminology I'm gonne use first of all. I'm going to name my list levels tier 1, tier 2, tier 3 etc. this corresponds with the number inside the replication guides. If I want a object to get in the tier 2 of a list, then I would have to use the <2> guide.
Secondly just by using replication guides it means that I will pair all of the values of the lists I'm providing, like crosslacing with ordinary nodes, but now I can choose how to group them as well!

EDIT: It has just been brought to my attention that one can use an "L" inside the angle brackets to make the replication guide utilize the "longest" lacing option. Like this: Point.ByCoordinates(x<1L>,y<1L,0)

Let's start with an example:

The Points:

So here we want to draw some points based on simple one dimensional lists for X, Y and Z-values. That will be lists that got only items in Tier 1.

This is the standard result without any replication guides added.

Observe that this works just like a standard Point.ByCoordinates node with lacing set to short where the point function takes the first item in each list, creates a point, then the second item in each list, creates a point and so on.

Now, if we add a <1> behind the x in our codeblock it means that the list of X's will be put in the Tier 1 of our resulting list. But there is not entered any replication guides for Y and Z so Dynamo can't quite figure out what to do. In other words it threats Y and Z values with lacing set to short, it only takes the first item in the Y and Z lists and pair it with each of the X-values.

If we now want all the the Y-values to be in the resulting list as well, considering the Tier 1 is already composed of all the X-values, we chose to put all the Y-values in Tier 2 using the <2> guide.
Observe that we now have a grid, since we've paired all of the X and Y-values. Since Dynamo still isn't told what to do with the Z-values, it takes only the first Z-value into consideration.
If we now want all the Z-values to be included, and Tier 1 and Tier 2 is taken, we say to Dynamo that we want the Z-values at Tier 3, using the <3> guide.

I think many people comes this far and find it ok(ish), but what about when we start to use this on other lists containing not only numbers but different kinds of data?

We'll have a look at another example:

The Translated Points:
Ok, so I start off with a list of three lines. I want to produce two points on each line, at parameter 0.2 and at parameter 0.8.

Just a digression:
The PointAtParameter node is an action node, so I can't type
Curve.PointAtParameter(curvevariable, parametervariable)
the "curvevariable" is put to the front as the object I'm doing something with. Like this:

This applies to most action nodes! If I where to explain the DS syntax of most action nodes , this is my best go:

Digression End.

Now I have to choose how I will Tier my resulting list. In this example Tier 1 will be my lines (Use <1> behind the crv) and Tier 2 will be my parameters (Use <2> behind the param). Observe that this is like grouping! Will I group by lines or group by parameters?

And here is just an example of where I've grouped the list by parameters instead. Notice I switched the guides.

Now lets make this even worse. I want to use the points I've created and translate each of them two times i Z-direction. Of course I could have just duplicated the translate node with different vector input in each, but with replication guides you don't have to.


Dynamo won't know what to do here cause my points are grouped by lines (nested list) and my vectors is also in lists.
I we want to conserve the grouping by curves and points we have to "pay homage" to its list structure by including its Tiers in the replication guides. The variable geom has to be followed by <1><2>, this way the result list starts with the points list original Tiers. If we then guide the translation vectors into Tier 3, we're all set.

See? Now we have maintained the grouping of data from the beginning until the end. If I pick index 0 from our first list of lines, then picking index 0 of the last codeblock corresponds to that! I will get the 4 translated points for the first curve.

Next up I want to add the first points I created to the list with the translated points. List.Create? No, sir!

(First of all, notice that the most of the List action nodes is not like the rest. Here you have the arguments inside the paranthesis like an ordinary create node.)

Now, what do I want to do here? I want to take each of the first list's Tier 2 and add it to the second list's Tier 2. Take the input lists structure into account, and you'll get this:

So pretty neat this replication guide, eh?

There is still many mysteries to me how replication guides works, but the above summarize what my simple mind think when I use them. If it sometimes doesn't work, I start with the above and just try various combination until it works. It obviously helps a lot if you know what your output list should look like.
 Be careful with replication guides and Revit nodes, though.. If you mess it up, you're going to have RAM-issues pretty quickly, you are hereby warned...
Hopefully, someday, someone can explain the logic in full detail and so simple that anybody can understand it! And please let me know if some of the logic above is utterly wrong.

lørdag 10. oktober 2015

Ammo: Sheet piles with Revit and Dynamo

I'm gonna show you a quite useful workflow in this post that utilize Revit and Dynamo to produce a sheet pile wall extended to a toposurface with a variable top level.

There are of course many ways to approach this, the workflow I'll show you is this:

1. Top of sheet piling is drawn by model lines in the project.(Clockwise or Anticlockwise)
2. A topography for reference top terrain
3. A topography that will drive the bottom of the sheet pile.
3. Select the model lines and lowest surface.
4. Dynamo magic! (and replication guides... lots and lots of them..)

The family I'm using here is a hosted adaptive component.

The hosted component: 2pt adaptive component
1. Create two AC-points underneath eachother in a new family.
2. Draw a sheet pile profile on the first point's horizontal plane.
3. Select the two points and create a spline.
4. Change the spline and change it to a reference line in the properties.
5. Select the reference line and the closed profile and hit create form.
6. Check that the point number two change the depth of the form.
7. Load in to the next family.

The rig: 3pt adaptive component
1. Create two adaptive points on the same level in a new family
2. Select the two points and create a spline between them, later changing it to a reference line.
3. Make the first point's vertical plane the active workplane and place a point on the first adaptive point.
4. Drag the point downwards a bit and make it adaptive. (So it becomes the third adaptive point.)
5. Set workplane to the reference line's horizontal plane.
6. Click Create>Component and place the component's first point so that it snaps to the workplane of the referenceplane. (you may have to tab a little bit..)
7. the second point of the component you snap to the Rig's third point. (are you still following??)
8. Observe that by changing the Rig's second point's position, you rotate the hosted component.
9. select "Always Vertical" in the properties.
10. If you want to report the height of the family you can create a reporting parameter between the first and third point.
11. Load into project

The Script: Replication guides heaven
I chose to show a condensed version of this script this time, and the reason are the powerful replication guides. I feel like I'm starting to get hold of these buggers and maybe I will create a blogpost about them in near future. Shortly put, if you ever need to use List.Combine or multiple List.Map nodes, you're easier of, in terms of screen estate, using replication guides.

Often, Sheet piles will close of a building site and to keep things simple I suggest that you draw all your model lines either clockwise or anti-clockwise. this way you will not have to worry about which way the sheet piles are turned. (I'm sure, however, that this is doable given some time and some imperative code). I'v included a simple -1 or 1 for direction in the script depending on whether you drawn them clockwise/anti-clockwise

Count on your PC having to work a bit with this. in the example provided, it took about 7 minutes to create all 1230 generic models.

A particular useful thing about this script is that you can split the model lines where you observe that it is to low compared to the terrain and then change the workplane so that the lines are optimal. I guess a further study would include projecting the lines to the top terrain as well with an offset.

A little youtube video showing a more uncondensed version: Youtube

torsdag 17. september 2015

Firefly, Arduino and Dynamo

Firefly has been around for a while for Grasshopper but now it's all set for Dynamo as well! Now, the world of Arduino is coming to the Dynamites again!

- Download the Arduino software here: https://www.arduino.cc/en/Main/Software
- Download the Firefly Firmata (Arduino sketch) here: http://www.fireflyexperiments.com/download/
- Open Arduino software and find the Firefly Firmata sketch (will be in your sketch folder) and upload to the Arduino board itself. Please note which serial port your board are connected to!
-Download the Firefly package from Dynamo package manager
- Run the node "Arduino.OpenPort" with the serial port number as an integer input. Don't worry 'bout the Baud-rate, it is set to match the Firefly Firmata sketch.

Aaaand fire it up! Just test the different nodes and use your imagination!

Since my library of Arduino tools, potentiometers and LED's is not that big yet, I'll just post a video where you can see my first test in Dynamo: https://www.youtube.com/watch?v=FHZoNjrdW6I

Should have been called Fireflynamo, though..

torsdag 20. august 2015

Dynamo and Network Arch bridges

Dynamo and network arch bridges goes together like.. uhh. well, like Dynamo and network arch bridges!

Network Arch bridges is known for being pretty optimal when it comes to material usage due to its elements being mainly subjected to axial forces. To add to the awesomeness it was developed by a Norwegian engineer called Per Tveit during the 50s!

Not going to share the script unfortunately, it's way too messy and therefore not very educational.
Still I want to show all bridge designers that Dynamo is a force to be reckoned with. Move the geometry over in Robot as well and run Optimo to find optimal hanger placement, width top vs bottom. Tempted to say it's revolutionary!

In Revit:
(not yet a optimal hanger placement it seems..)

Spaghetti-Script overview:

Tested it quickly in Infraworks as well:

Gif of flexing in real time:

So long.

fredag 7. august 2015

Ammo: Which sheets are my elements on?

Thanks to Magne Ganz at Multiconsult which brought up the following challenge: "When showing an IFC-model on site is it possible to click an element and see what sheets it is on?" (Freely translated..)

Well, the first and most obvious answer is: Use Navisworks. They got functionality which can let you do this, and it works pretty well I must say. Check it out here

But, what if we want this as a parameter in the Revit elements themselves, to be exported to IFC?

Dynamo on the shining knight comes riding again.

First of all create a project parameter (or use a shared parameter) of your choice and select the element categories for which you want to generate a "OnSheet" parameter.

This is not the prettiest of scripts, but it will do the trick. (Also, other than the mere practical use of a definition like this, you get a study in list management..) I've got a feeling this can be consolidated some more, and I'll make a edit to the post if I find out. I'll probably go ask the community.

EDIT: Again thanks to Dimitar Venkov we have a more concise method using a code block definition. It is worth paying attention to how this useful script iterates over the sheets and accumulate the text parameter as it goes. Beautiful designscripting from the bulgarian Dynamo master! :)

Result in Revit: 

The only hitch here is that it will be processing all elements in all the views you select, so it may be a bit slow. Tests I've done indicate that it can deal with a rather large number of elements a fairly short amount of time, but still no guaranties on my part if you run it on your largest project!!
The final SetParameter node will also go yellow as it threats all elements in view, but only the elements in the categories we selected for the project parameter will be written to.

The custom packages necessary:
- Clockwork by Andreas Dieckmann
- Elements in view(s) by Marc Tavenier
- Archi-lab by Konrad Sobon

Here is the script: SCRIPT

Suggestions for tweaks will be met with gratitude!

tirsdag 7. juli 2015

Dynamo 0.8.1 released, Summer vacation next..

So two things are up, summer vacation and Dynamo 0.8.1. Both are equally colorful and awesome. At least the last one mentioned. With 0.8.1, Dynamo gets some new features, read all about it here, among them the ability to give color to geometry. So why not use Dynamo for what it was meant to be: A colorized thermometer?

The idea came from the one and only Håvard Vasshaug. So a big shout out goes to him for getting me hooked on things that are somewhat.. unpragmatic. If you want, bookmark it under the "Because-we-can"-category..

But as Norwegians we're not always blessed with the best water temperatures and therefore we should be warned in our native software when water temperatures will peak the next few days, obviously..

So what do we need?
1. A meteorological institute with open data API: http://api.met.no/
2. Dynamo (goes without saying)
3. Three additional packages from the package manager: "Luncbox" and its XML parsers from Nathan Miller and Case,  the "UI ++" from Adam Sheather. (You don't actually need the UI++, but it's awesome!) and optionally the "Dynamo text" package from the father himself, Ian Keough.


And the rather messy definition:
Should probably have cleaned it up a bit, but ain't got the time, it's off for summer..

So long!

mandag 22. juni 2015

Dynamite: Analyzing topography slope with Dynamo

This time around we're going to look at an useful aspect of the new colorization tools in Dynamo. Namely, colorization of topographies in Dynamo. It still demands the conversion from Revit topography to surfaces in dynamo, but still, it's quite efficient.

The need for a tool that can give a visual representation of slopes in revit was asked for by Shrikant Heerekar in this thread over at the Dynamo forum. And both me and Vikram Subbaiah responded with quite similar methods, although Subbaiah developed a far more concise and stringent definition by using designscript. Be sure to check out his website here.

I'm gonna show you a little bit of both.

First up is a node based definition. (It includes the Mesh.FaceVertices node from the Clockwork package.)

As we can see, it's quite simple, and we can edit the colors to our own liking. Notice that the sensitivity slider adjust how little slope a single surface must have to "qualify" as green.

EDIT! I forgot to mention that you will have to turn of preview of the original surfaces for the colors to be visible. It's a known bug and they will fix this in future releases.

The next one is a codeblock/designscript based version which is based, or rather directly ripped of, Vikram Subbaiah's version except I have pulled out some parameters.

Last, a version that sends all the surfaces into Revit and override the elements color in a specific Revit view. This has to be used with great caution otherwise the head BIM manager in the project will cut off your head as the script generate one import instance pr surface. That's a lot of instances! But at least then you're able to put it on sheets etc.

so that's basically it. Here is a screencast for anyone into bad english pronounciation. 

If anyone have other great ideas for using this, let me know!

Building positioning by using Optimo, anyone? :)

tirsdag 16. juni 2015

Ammo: Some tips and tricks

So this time I'm more of a curator rather than creative innovator. As I've ever been such.. Just a small number of odd tips and tricks I've picked up lately from the forum or elsewhere.

Getting shared coordinates for further use in Dynamo
The easisest way to get coordinates for use in Dynamo is to access the project base point. Then you can add it to an Element.Location or whatever.

 Improved Object to String
Python strikes again in this python version of Object to String. The advantage you ask? You don't get as many trailing zeroes.

Calling functions with multiple outputs in codeblocks:
Now, this one has buggered me for some time, how do you call a function that have two outputs in Dynamo? Take the List.FilterByBooleanMask for instance. Once again Dimitar Venkov provides the solution.

Speaking of Dimitar, I wanna mention the awesome forum that we are so privileged to be a part of. There are many pioneers and helpful souls on the forum, but there are two who deserves particular mentioning for the shear number of replies. Thanks once again for the incredible work you're doing, Dimitar and Andreas!

So, ending in a rather unpragmatic way. Here's how to check Dimitar's and Andreas' replies and topics stats on the forum! :) set the definition to run periodically and you'll always be up to date.. 

lørdag 23. mai 2015

Everyday Dynamo - Linear Interpolation with Three Variables

It's been a long time since school..

As an engineer I feel like I'm putting my head on the block here, but it's been a while since I interpolated between values, even with two variables. And when a situation at work demanded linear interpolation with three variables, I must admit that my mathematical memory failed me..

But why think long and hard, when you can solve it with geometry and Dynamo?

Case: I was given four allowed ground pressure values by a geotechnician by two variables: Foundation depth and foundation base width

So three variables can be represented in 3d-space: X=Base width, Y=Depth and Z=Allowed ground pressure. And if the values are linear they should form a plane, right?
Now if I create a X-coordinate and an Y-coordinate (My wanted values) and project it vertically onto the plane it gives me a point which represents an interpolated value of all the three variables.
Extract the Z-Value and you got your allowed ground pressure!

the simple definition:

So 177.5 it is.. no sweat.

torsdag 7. mai 2015

Ammo: Volume between toposurfaces

Much has been said about the topo tools in Revit, and I for one vote for Civil 3D any day. But once in a while (or rather often) we want to keep things internally in Revit.

An operation that I've always wanted to do in Revit is to calculate the volume between two seperate toposurfaces in Revit. Yes, you can use graded region and phases, and yes, it is cumbersome at best.. What often is the case is that the existing terrain is measured and modeled up early in the project and then the data for the excavated site are delivered later in the project phases. Equally often the data has different outreach in plan and therefore it is sometimes difficult to make any sense of the cut/fill values in Revit.

A similar challenge arises with differences in topos when you have sheet piling.

What I found myself looking for is a method for how to find the volume between two seperate surfaces within a polygon that I've drawn myself.

So here is a simple definition that will do exactly that:

The number input must be large enough to cover both top and bottom topo from where the model lines are drawn.

And the results, with the imported geometry in revit:

Hope it can can be used for something good. Definition here

The next step would be to use different model curves for top/bottom topos for sloped volumes, but that is a whole other story..

Dislaimer: The Topography.Surface node can struggle when used on large topos. modifications soon to come based on Dimitar Venkovs excellent response adn research in this thread

fredag 24. april 2015

Dynamo and XML: the Sidetracked Reviteer

I read Nathan Millers blog post today about the new release of Lunchbox including XML parsing and exporting and naturally I wanted to try it out.

What ended up being not so natural was the data I used to test the nodes on.. As the title says I got sidetracked.

I googled "xml open data api"  showing only norwegian results and after a couple of minutes looking through the results I was looking at a XML of all the representatives of the norwegian parliament.

And after some fiddling around: Voila! All the representatives sorted by age in excel. The real question is what can't Dynamo do?

Hopefully I'll be utilizing these nodes for something better in the future. (And also not setting up lists of norwegian representatives on a friday night.. Jeez..) But one of my goals for this blog is to show people that you can do virtually anything with Dynamo, and I guess this falls into that category.

Now, off to more sensible stuff.