Filming: Day 2 (22nd Aug)

This article continues on from filming day 1.

The second day of the film course was when we would take our storyboards from the 6th August, have some fun in front of a camera, and turn our ideas into professionally edited short films. The morning was scheduled for filming, and with barely time to eat, the plan was to get the film sent back to Uni and stitch the clips together into something we could be proud of. As if that didn’t sound tight enough, the weather was good and conditions were right for us to record two films. Continue reading Filming: Day 2 (22nd Aug)

Adding a messages function in VBA for Excel

A quick script for debugging in Excel. Works like a “print” command in a command line interface – just add Msg(~) comments in your VBA code where you want to know what it’s thinking, and the script will return a line. Newest comments appear at the top. Much more useful than using message boxes! Continue reading Adding a messages function in VBA for Excel

Create keyboard shortcuts for coding in C# using AutoHotKey

AutoHotKey is a remarkably useful piece of free software which allows you to automate any repetitive keyboard or typing task. It effectively allows you to program any key, or any combination of keys, to any command of your choosing.

Here, I will show how to use AutoHotKey to make writing C# code a little faster and easier.

Continue reading Create keyboard shortcuts for coding in C# using AutoHotKey

Film course day at Bristol, 6th Aug

A great problem for academics and those in highly technical professions is trying to communicate what they actually do in terms that the wider public can understand. Quite often, such people can explain their research in wonderfully deep detail that sounds fascinating to anybody already in the know, but there will always come a time when it is necessary to get somebody non-technically-minded excited about your work.

Continue reading Film course day at Bristol, 6th Aug

Setting up Visual Studio Express 2012 and 2013 to write your own Grasshopper components in C#

A quick guide for setting up Visual Studio Express for developing Grasshopper components for Rhino 5. Continue reading Setting up Visual Studio Express 2012 and 2013 to write your own Grasshopper components in C#

A simple deflection analysis in ANSYS 13

ANSYS is a highly advanced program for performing a wide range of analyses based around a finite element analysis engine. Thanks to its well-developed feature set in static, non-static and CFD problems, it is well-used by mechanical engineers and the like, but less so in structural engineering, where programs such as Robot and GSA are preferred. However, a recent task called for a quick deflection analysis of a prototype building form, which turned into an opportunity to try out this program. Continue reading A simple deflection analysis in ANSYS 13

Data trees and C# in Grasshopper

Understanding how Grasshopper handles data is crucial for taking full advantage of GH’s capabilities. For collections of data, they can either be in the form of lists or trees.

A list is a collection of items of data, in a particular order, but with no hierarchical structure. Here is a list of numbers:

Grasshopper list of numbers with series component

The component in the top-right is the param viewer. Double click it to see this:

Grasshopper series list with param viewer

The ‘N’ denotes a list with N items. A list can be thought of as a tree with a single branch {0}. So here, we are looking at a single list, with address {0}, containing 5 items.

A tree is any data structure in GH with multiple branches. In other words, it’s a data structure with multiple lists. Each list has its own address.

Now, let’s make a grid of points. We can do this with our list of numbers and the ‘construct point’ component.

Grasshopper construct grid of points

Here, we have cleverly grafted the Y input to coerce Grasshopper into giving us 25 points for our list of 5 numbers. But the output looks a little different. Instead of a list of 25 points, we have 5 groups of 5 points each.

What’s happened here is that Grasshopper has created 5 branches. Each branch contains a list of 5 points. Each branch has its own address {0} to {4}, shown in the panel.

We can verify this using the param viewer.

Grasshopper param viewer for trees

Trees in C#

Trees can be created and manipulated in C# components too. When we add data to a tree in C#, we need two pieces of information:

  • The data we are saving, such as a Point3d or an integer
  • The path we are saving to

The path is declared as a list of numbers denoting the sequence of the branches needed to access the list we are interested in. As some examples:

DataTree<Point3d> myTree = new DataTree<Point3d>();
GH_Path pth = new GH_Path(2);
myTree.Add(P, pth);

point P will be written to the list at the end of branch 2.

GH_Path pth = new GH_Path(i,j)

point P will go down branch i, then be added to the list at the end of branch j

Setting up a tree

You can either add to a tree on the fly – if you know that the data in the tree will be in the same order that you’ll be adding to it. But a more flexible way is to create a blank tree of the size you want, and then edit the values later.

Setting up a tree called boolTree (I am creating a tree based upon another tree called pts):

//declare tree
DataTree<bool> boolTree = new DataTree<bool>();
//set up tree
 for(int i = 0; i < pts.BranchCount;i++)
 {
   GH_Path pth = new GH_Path(i);
   for (int j = 0; j < pts.Branch(0).Count;j++)
   {
     boolTree.Add(false, pth);
   }
 }

This has now created a tree filled with ‘false’.

Editing values in the tree

boolTree.Branch(1,2)[5] = true;

This edits the 5th value of the list at the end of branch 1, sub-branch 2 to ‘true’.

My first post

Hello! It looks like I’ve decided to start a blog. I’ll hopefully be writing about what I’m getting up to in my EngD and all the wonderful and interesting things I’ll be learning about, and if I have anything else to babble about, who knows, it may end up on here too.

As for my first post, I should probably give some actual content. Here is a picture of a duck:

Image

(Made in Rhino, a program for modelling with curved surfaces. This was my greatest and proudest achievement in my first week!)

Taking the Trans-Siberian from Moscow to Beijing

This is a throwback to my travels in 2010 when I spent 4 months travelling around Europe and Asia. This is taken word-for-word from my TravelPod blog that I kept at the time, and have just re-discovered.

This post starts as I boarded the Trans-Siberian train for the week-long journey to Beijing.

This slideshow requires JavaScript.

Boarding the Trans-Siberian

Found the train in the station without a problem. Took cheesy photos of ourselves outside the train (catching unsuspecting passengers within the train in the photos). Was a very long train – maybe 15 passenger carriages. Two carriages first class, remainder second. Every one was a sleeper carriage – second was 4 beds to a room, first was 2 beds and a tiny en suite.

Milan and Christine were indeed in the next carriage. They were sharing with Coreen, a very Scottish 27 year old travelling to Mongolia assisting with research for three months. Made for a very entertaining compartment – Milan and Christine have the most amazing love-hate relationship – it’s quite amusing to see them bicker, fall out, make up, and fall out again in the space of half a minute. It’s all in good humour – I don’t think they could ever actually fall out. But I must say nice things – I did give them the address of this blog 🙂

In my compartment was Rita, an extremely friendly lady who, according to Milan, had designated me her adoptive grandson for the length of the journey. She was quite undoubtedly the most sociable person on the train – within a day it seems she had met every person on their train, learnt their names and their story. She is a very talented linguist with knowledge in English, Finnish, Russian, Mandarin and probably more that I can’t remember right now. She had many stories to tell – many of them revolved around her ex-husband – he would only travel 5-star, and she was taking this opportunity to do what she had always wanted to do and rebel – stay in youth hostels, travel the world by train, and meet lots of people – none of which he seemed to want to do. She took a great interest in my plans – she insisted that she takes a copy of my itinerary.

Also in our compartment was an Australian couple who were concluding their tour of Europe, a Polish (I think) couple who were taking the Trans Siberian to Beijing basically for the journey – they only had 2 days in Beijing (Adam doesn’t have much interest in the city) before returning home. There was a group of 4 to the other end of the carriage, 3 guys and a girl. The guys were cycling across Mongolia – not sure exactly what she was doing. There was a Mongolian woman who Rita was very friendly with – her Russian visa had expired by 18 months (she had a Russian husband), but she was trying to return to Mongolia to pick up her papers. Or something like that. Finally (as far as I remember) there were three Swedish girls who had taken three weeks off work so they could take this train, spend a little time in Asia and then return home. They couldn’t quite explain why they wanted to do it though… but then nobody on the train (including myself) could give a definite and concise answer. It’s probably clear that a bit of a community spirit develops when a group of people are held together for such an amount of time! But then, when we had a look at other carriages, none of the others seemed quite as sociable – most of the doors were shut and the passengers kept themselves to themselves. Carriage 6 was the place to be 😀

The carriage itself was comfy enough. The beds were very hard but long enough. The outside temperature was hot from Moscow, got very cold in Siberia, before getting hot towards Beijing. Shame the heating didn’t follow that pattern in the slightest. The Chinese conductors were friendly, though they spoke little English. The lack of a shower or even a good sized basin was a problem – but when everyone on the train is not showering at the same time, nobody minds 🙂 The toilet was the crude dumping-on-tracks job – the ‘flush’ was simply the hole in the bottom of the toilet opening up, revealing the track below. I was thinking of marking on the map each point when I’d gone to the toilet… or not 🙂 So yea… basically no hygiene facilities.

No food was provided, although we could help ourselves to hot water. We’d all brought a stash of noodles and biscuits. Thankfully, the train stopped for 20 minutes at a station every 4 hours or so, and if it was working hours the platform would be buzzing with hawkers selling all sorts of food, drink and other bits and pieces. The food often seemed to be home cooked Russian food and was fairly priced. At various points, I bought a chicken and potato ready meal thing (delicious and no food poisoning :D), crispy toffee tube things, and a litre can of beer!

Russia

For the first few days, the scenery was relatively uninteresting. Trees, grass, few hills but largely flat, Russian shack villages, the odd chimney stack, piles of logs. Passed through many of the Russian cities along the way – lots of concrete socialist style tower blocks (even if the area was sparsely populated, tower blocks seemed the favoured way of housing people). Weather was good the first day, but by the second night it had turned cold (they forgot the heating and the blankets were hardly warm – lots of grumbling in the morning).

It was surprising how quickly time goes on the train. You spend so much time generally chatting with everyone that it doesn’t take much reading, sudoku and noodle making for the day to end. At no point did I feel bored and that I had nothing to do. Had a lot of fun on the third evening when the whiskey came out (thanks Coreen!), playing cards (none of us could remember a comprehensive set of rules for any card game – we improvised a game of Uno then some bizarre variant of Go Fish).

Into Siberia

As we approached Lake Baikal the scenery got more mountainous. We were also getting more remote – the chimneys and makeshift landfill sites in western Russia became less common. Lake Baikal itself was a truly amazing sight. The train approached it from the mountain tops – glimpses of the lake appeared every so often between the mountains. The track descended as it followed the perimeter of the lake until we were by the water’s edge. The lake was still half thawed from the winter – large sheets of ice remained. The morning was windless, so where there was water, the mountains reflected in it beautifully. The mountains themselves had also part thawed – veins of snow remained, giving me the impression that the black mountains were being illuminated from within… maybe. The scale of the ‘lake’ is hard to comprehend – I took many photos but I doubt that a single one of them will do the lake justice.

Crossing the border into Mongolia

Passing into customs from Russia to Mongolia, it unfolded that the Mongolian woman was not permitted to leave Russia due to having an invalid visa – yet of course she was not technically allowed to stay. Apparently she was aware that she would have difficulties – she attempted to bribe the customs official (this is Russia – it’s not that unusual) but unfortunately for her it didn’t work. She was led off the train by the Russians and never seen again.

Moving into Mongolia (customs took 6 hours! Horrible time!) the foresty scenery soon disappeared, giving way to tall rolling grassy hills. Most of the train got off at Ulan Bator (me, Rita, the Australian couple and the Polish couple remained) and we got a new shipment of passengers. They seemed all nice, but it wasn’t the same as before – there wasn’t quite the same community spirit. We were due to arrive in Beijing in little over a day anyway.

After Ulan Bator the greenery disappeared – we were now travelling through the Gobi Desert. Very dry, hot and sandy – such a contrast to what we’d seen just a day before.

Arriving in China

Northern China on the way to Beijing is a natural wonder. The train travels down a valley of steep tall mountains, giving glimpses down the river as we travelled between tunnels. One of the reasons I took the Trans Mongolian rather than the route avoiding Mongolia was that I’d heard the scenery is something not to be missed – I would certainly agree.

The mountains levelled off as we approached Beijing. Not an attractive introduction to the city – lots of rubbish everywhere, slums, factories. China might be on its way to becoming a developed nation but this sight demonstrated that there’s still a lot to do before China’s new found wealth becomes more universally distributed.

After 6 days of travelling, I’m sure you’ll be pleased to know that we somehow made it to the station to the minute on time – 14:04 this afternoon (that’s GMT+8, no summer time). Made our farewells, took a few last photos, and that was it. All alone in Beijing.. eep!