Tuesday, 14 March 2017

Dynamo scripts portability

It's been my experience that writing scripts that work for different project files can be quite challenging. Writing scripts that work for different offices even more so.

I follow John Pierson on Twitter and recently he was so kind to share a script for renaming rooms. See tweet: John Pierson's tweet

He always makes very good dynamo scripts so I copied his script and had a go at one of my files. Unfortunately it did not work. My file has a couple of additional levels that made it not work and my file had rooms in it that were Not Placed.

To make it work for my file I had to rewrite quite a bit of the script. I had to take out his dictionaries. I didn't get those to work me. That is not criticising John's work. I would merely like to point out that it can be rather tricky to write scripts that work on different project files.   
It's working for this file but there are some file dependencies in it. It's relying on the level names and that is not so good. So let's try and fix that.

it's a bit better.  I should have appended a 0 if the number was smaller than 10 but I didn't bother with that just yet.

In my script I also had to get the level names twice. That feels like I could have done it more efficiently. But it works at this moment.

But what about checking whether no error has slipped in? Maybe the logic is wrong somewhere and you end up renaming rooms a completely different name. It can happen. So I settup this file to export the new and old name to excel. The bottom groups are all for excel.

this is just to create a filename with date for excel and place this file in the same folder as the RVT file. 

I added a Pauze node here just to make sure to capture the changed name. (I am not entirely certain if it's necessary)

Anyways thank you John for the inspiration. Reading other people's script is always a good learning exercise.

Tuesday, 3 January 2017

Infraworks terrain to Revit and back

How can you get an Infraworks terrain model into Revit.

I am bit of a nitpicker when it comes to trying to get models at the exact coordinates. Before you continue I thought I had it figured out. Later I have ran into an issue that I have yet to figure out.

Goals for this blog: 
  1. Infraworks Terrain to Revit 
  2. Revit model into to Infraworks
  3. Civil 3D model and Revit model in Navisworks
  4. Everything in the right location without manually moving anything
Let's start of with Infraworks and I will pick this location as it's one of the few places in the Netherlands that has some elevation.
Notice the elevation differences
Time to export to IMX. This will let me open it in Civil 3D.
  1. This setting might be to big and you might want to make it smaller
  2. Set the right coordinate system (and this turns out later to be a bad idea) Leave the coordinate system to what Infraworks has set it to)(another disclaimer this tip might change again as I still have to try and figure out which conversion is causing the errors)
  3. export to IMX

Goto AutoCAD Civil 3D 2017
Follow the numbers in the images
Here I am not converting the model to RDnew (Dutch national coordinate grid) as I found out later the Revit model does not end up in the right location.

This is what the Civil 3D model looks like!
The tricky part now is to select a point which is going to be the point that you will know where it is in all the different applications you will have to use. 

I have chosen a point and for this point I will create a couple of things:
I have a special AutoCAD block that will read the coordinates of a point and will allow me to snap to something.
For avoiding rounding errors I move this AutoCAD block to a location without decimals.
Copy the xy values to notepad! We need them later in Revit for the Project base point.
I will put another point on top of this AutoCAD block.

Notice the coordinates of this block
Turn this point into a COGO point
Select the point and notice in the bottom left of the image that now you also have the Latitude and Longitude of the point. 
Copy to clipboard
Go to a website that can convert degrees to numbers
I use this one:convert_lat_long/ ( I have to check if this website is the one that is causing me grieve later on)
Be sure to check the letters indicated at number 4 and 2
enter the degrees and copy out the other ones
so for me:
LAT = 50.75485555555556
LON = 6.019808333333334

Don't do paste the values in this screen! (i have left this in for people who have read the previous version)
Revit 2017
Copy paste the lat/long values in like this. The comma is the separator!!!
After you hit search Revit will give you a name, ignore that it's the values in the dialogue box that is good.
New part: the step I have done wrong in the image above is that I selected the internet mapping service. I should have used the default City list. 
but when you enter values in her they will get rounded
these were the values I pasted in and notice the rounding difference. I can't tell if this has a significant impact.
LAT = 50.75485555555556
LON = 6.019808333333334

Back to the AutoCAD file let's create a file that will allow the creation of the topo surface in Revit. Select your TIN surface is. (the topo) Basically I am going to extract height lines from the TIN surface.
Extract objects
uncheck the triangles
Save the file and go back to Revit
Set the units to meters
Copy xy values, the ones in Notepad, into the project base point. (NOT the LAT /LON)
Link the AutoCAD file!
Move the AutoCAD file to the correct location. (this manual moving I can't seem to fix just yet)
Create a topo surface and use the dwg file.
Uncheck all the layers except:
That looks reasonable for Revit. Remember Revit's  topo tools are not at the same level of excellence as the Civil 3D's tools.
Next step let's link the Revit file back in to Infraworks
I have added some walls earlier for checking to see if the surface would end up in the right location. At the moment it is close but not right... (See numbers 1,2,3 it's of by a few meter.) (4,5 and 6 point to the revit topo surface)
Reviewing the data source configuration, I noticed the lat/long coordinates have changed... 
This is what we had set in Revit:
LAT = 50.75485555555556
LON = 6.019808333333334
and this is what Infraworks has read: read before:
Infraworks reads the values I have entered in the location window. Even thought the Revit interface seems to round the numbers, Infraworks reads the values I have entered.
This is was Infraworks reads now:

By now I have eliminated one error I made before and the Revit model is a bit closer to where it should be. It's not correct yet, but reasonable. I did get one other suggestion that I will try.

The problem is that I now have to figure out which mathematical conversion went wrong! None of the conversions are visible. I'll think I'll have a chat with the factory.

The other goal of getting the Revit file and the civil 3D file in the right location in Navisworks did work out. See image below.
  1. is the Revit file,exported to nwc with shared coordinates
  2. is the IMX file from Infraworks loaded into Civil 3D and saves as a DWG.

A couple of the goals achieved but not all. I'll try to update the blog once I have a solution or when I have found the error why the Revit file is not exactly in the right place.

Updated once: 22-02-2017

Google+ Badge