Wednesday, November 19, 2014

I was asked recently how to embed and retrieve bmp file into your dll file. I’d like to take credit for figuring it out but I’m sure I originally saw it on Jeremy’s site somewhere.  Here is how I do it:


Add the image as a resource to the project
From the project menu select properties


On the resource tab select add resource


 Browse and find the image.

Once selected it should be listed in the solution explorer under the resources folder



Set the image property to embed
In the solution explorer find the image and right click and go to properties


 Set the build action to embed



Add a reference to  PresentationCore.dll




Once this is done you can use this code to retrieve the image.


Tuesday, April 8, 2014

Crop View To Element

Revit provides tools for isolating elements which is very useful. However often I find that I am also interested in seeing how an element interacts with the elements around it. I have found the best way to do this is to open a 3D view and turn on the views section box. I can then drag around it's edges to show only what I'am interested in. Works pretty well but the manual process is pretty painful.

To create a tool to do this  was fairly simple:

My first crack at the tool works quite well but could be improved by adding a buffer to the bounding box to eliminate the manual manipulation of the section box at the end.



Monday, March 24, 2014

Naming Conventions

Standards I love them! Keeps everything neat, tidy and easy to understand. When it comes to writing code you have a million and one choices to make on how things are done and it is not always easy to decide on a standard way. When it comes to naming though, I follow a few rules:

Class names use PascalCase.




Method names use PascalCase.





Objects use camelCase





Use human readable names. ie. name something using its real name!







Use meaningful descriptive names




These aren't my rules, most come from msdn website here:
http://msdn.microsoft.com/en-us/library/ms229043.aspx