Thursday, March 20, 2008
In the previous post, I showed you how to connect your external commands into Revit, ready to be opened from the Tools -> External Tools menu. But what if you want to make a shortcut to it, lets say for example you want to create "HW" as the shortcut for your Hello World application. All you need to do is go to your Revit program directory, and open KeyboardShortcuts.txt, then scroll down to the Tools section, and add: "HW" menu:"Tools-External Tools-Hello World" Where HW is your shortcut, and Hello World is the ECName you added. Then typing HW in revit will open your command, easy!
Wednesday, March 19, 2008
My previous blog post on getting started with the Revit API showed you how to setup a template to start creating the .DLL files needed for revit external commands, but how do you actually get these into revit? Lets say, you have made a simple hello world command, one of which is in the API SDK for you to use as a reference. I mentioned, that the public IExternalCommand.Result Execute method is the start of your command, this is what gets called first, from here you can direct it to do what you would like it to do. For a simple example, import System.Windows.Forms, and add "MessageBox.Show("Hello World")" to your IExternalCommand.Result method, remember, we added try catch into the template, so put it into the try section. Now right click on your assembly, and click properties. Go to the "Build" section, and change the output path to the location you would like to store your .DLL files - I store mine on a network drive so that there only needs to be one copy of them for all users in our workplace, perhaps this isn't the best practice (I have to login to the server and kick others out of it if I want to update it), but it makes sense for my situation. Then go into the "Debug" section, and choose "Start external program:", and choose the Revit.exe on your system. This means that when we start Visual Studio's debugging mode, it will fire up Revit and provide some good debugging features. Now, you're set to start building your file. Go to "Build" at the top of your screen and go to Build *SolutionName* (this will be whatever you called your project). This builds the solution, ready for use. Now is where we get to the icky part, the Revit.Ini file. Autodesk, remembering the glory days of the 90's, have used a .ini text file to tell revit that we have some external commands that we would like to use. There is documentation on this in the Revit SDK, but here is what you need to do. :
- Open your Revit.Ini file
- Find [ExternalCommands] if there is one, if not, create that section.
- Insert the reference to your .DLL external command file, it should look similar to as follows
Sunday, March 9, 2008
I just made the jump to Vista, purely for a 64bit Windows Operating system that has hardware support (There is of course 64bit XP, but it seems most hardware vendors put their hands over their ears and say "la la la I'm not listening" whenever you mention it). The most annoying thing for me, was the theme. I hate it, I hate the visual styles, I hate aero, I hate all of the shadows and transparency effects, in fact, it gives me a headache, literally. I tried to get used to it, tried tweaking it, turning off stuff etc but it didn't help. The main qualm for me was the black two-toned taskbar. The windows classic theme for Vista is a joke, it looks worse than it did in windows 98. I just wanted Vista to look like XP. So, I set about googling, though most of my results returned people wanting XP to look like Vista, it seemed I was one of the few who want it the other way around. I soon found out, that basically, Microsoft has done its best to stop custom themes, to perserve the branding of vista I believe (ie you look at a vista pc and you know its a vista pc), only themes created by Microsoft can be used. One option, is to use Windows blinds or something similar, but I want to increase performance, not reduce it! So that was out. I then stumbled upon Deviant Arts collection of custom themes, and noticed they used a hack to get the standard .theme files to work. I was told that Vista Glazz did the hacking for me and then all I had to do was double click the theme file. This didn't work either - I'm not sure why though. In the end, I used Tune Up Utilities. This allowed me to simply select what theme I want, and apply it, nice and easy. Then, after searching around and downloading a few themes, I discovered that a DeviantART user by the name of 'psychoB' has converted the old XP themes to vista, brilliant! Here they are: Luna Metallic (the theme I am using) Royale (Standard XP theme) and even the Zune theme See his other work at psychoB's deviantART gallery.
Posted by Rod at 5:28 PM