Archive for the ‘development’ Category

My first Revit plugin

Friday, January 14th, 2011

Update: The post had to be redacted for the sake of our relationship with the customer. They feel some of their exclusive IP was made public so I removed all reference to data/screenshots that is not publicly available elsewhere – in this case mostly at Building Coder blog.

A few months ago I got the opportunity to do some programming for reasons other than curiosity or fun. A bunch of clever guys came up with a few ideas on how to improve their Revit workflow and they asked us to translate those ideas into code.

The problem
Before I explain what the plug-in does I should take a step back and show what problem it is trying to solve. Revit Clinic touches on that in a bit more detail here, but the short version is that the “Referencing Sheet” parameter always references the first view in which the given section appears. If there are dozens or hundreds of views, hiding the section tag in all but the one that you want, may be a very time consuming and tedious task.

The solution
Quite simple really but unfortunately the details are confidential…

The workaround
When I wrote the first version of that plug-in, it all worked great except for one small part. The problem was that the “Referencing Sheet” parameter was not updated automatically as it should happen – clearly a bug in Revit. Fortunately, the guys at ADN were able to suggest a workaround. A simple trick – changing the discipline of the section view and then bringing it back to what it was originally. Everything within the same transaction! I was quite surprised that it worked but it did so that’s what counts. Here’s a snippet of the code that does that.

Shameless plug
I’ve had tons of fun developing that plug-in and I wouldn’t mind repeating that experience. In fact, I have already created a few other Revit plug-ins and looking forward to creating some more in the future. If you or your company has an idea for a Revit plug-in that would make your life easier let us know through the comment in this blog – I won’t publish those comments to keep your inquiries private.

The thanks
Big “Thank you” goes to Jeremy Tammik and the rest of the AEC DevTech team at ADN. The level of support they provide is amazing and that was a very big part of why I enjoyed working on that plug-in.

World’s first F# web browser runs on Linux using Gtk and WebKit

Saturday, July 11th, 2009

After a long break I finally managed to do some programming for fun. This time I decided to see what WebKit has to offer and at the same time create the world’s first browser written in F#. I whipped it up in a couple of hours and the the whole experience was highly enjoyable, thanks to F#’s succinct syntax and WebKit’s and Gtk#’s easy APIs. In fact it got me so positively wound up that I’ve put shampoo on my toothbrush and then I didn’t remember if I washed my hair already. The only thing missing was MonoDevelop with full F# support, but that I guess, will happen sooner or later. I would also love to see MS finally release F# under Ms-PL so that I could use it for something actually useful. Anyway, here’s a screenshot:

Compiled binary is here, but good luck getting it to run. Source code it here.
If you decide to run it, I would recommend doing that on Ubuntu Karmic (9.10 alfa 2). When I run that on 9.04 it crashes and I think that an older version of WebKit is responsible for that.

More fun with Gtk# and Cairo in F#

Wednesday, December 3rd, 2008

This time it has taken me more than I planned but I finally have something to show off.

As usual the compiled exe here and the full code here.

This week I have really struggled to figure out how to mix functional and imperative concpets. After a few days of trying to recursively build an F# list I gave up and resorted to using a ResizeArray<> which is simply an equivalent of C# List<>. I really wonder if a bit more “functional” way of building a list is possible.

Another F# sunday

Sunday, November 23rd, 2008

So, another weekend, another F# excercise. This time I decided have some fun with Cairo inside Gtk# and a port of the old Knockout example from C# seemed like a prefect idea. Here’s what I got:

Compiled executable here, code here. Now, what I’ve done was pretty much a simple “translation” to get it running but I would love to make the code really functional. So, go headed and comment on what I could change to do it.


Another embarrassing udpate: fixed indentation


Update 2: indentation is broken by WordPress editor. Code replaced with a link.

Playing with F#

Sunday, November 16th, 2008

This little pretty window:

is a result of this tiny bit of F# code:

#light

open System
open Gtk

Application.Init()

let window = new Gtk.Window(“F# Gtk”)
let vBox = new Gtk.VBox()
let closeButton = new Gtk.Button()
let label = new Gtk.Label(“Hello World!”)

window.WindowPosition < – Gtk.WindowPosition.Center
window.SetDefaultSize(160, 40)
window.Destroyed.Add(fun _ -> Application.Quit() )

closeButton.Label < – “Close”
closeButton.Clicked.Add(fun _ -> Application.Quit() )

vBox.BorderWidth < – (uint32) 6
vBox.PackStart(label, false, false, (uint32) 6)
vBox.PackStart(closeButton, false, false, (uint32) 6)

window.Add(vBox)
window.ShowAll()

//brown paperbag update: I’ve missed this line during Copy/Paste
Application.Run()

Next step is piece of code that actually does something semi-useful. I’m thinking about implementing a convex hull algorithm which F# seems pretty well suited for.

Get Adobe Flash playerPlugin by wpburn.com wordpress themes