AU Alert! – The Business Proposition for Developing Custom Tools

If you are going to AU and are interested in using the API to make Revit better, start your Thursday at this class by my friends at Stantec.

BO3158 – The Business Proposition for Developing Custom Tools

 In the era of 2D CAD, many firms invested in custom tools and development staff to write and maintain them. A firm’s overall experience varied in terms of the success of this investment and just about everyone has a story to tell about being “burned” from spending money developing custom tools. However a number of market forces are coming into play that continue to drive the need to customize the Autodesk® Revit® software platform, and the question is, “Do you rely entirely on third-party software or go back down the road of customization?” This class explores the benefits of investing in the development of custom tools for your firm, and shows how Revit is really “different this time” for those who have a horror story to tell. This class looks at the tools Stantec has developed in the last year and the return on investment we have already seen. We also examine our overall strategy and approach to development.

Thursday, Dec 5, 8:00 AM – 9:30 AM– Murano 3302

Room performance work-around – Export/Delete & Import

Are rooms making it too slow to modify walls in your Revit model? An advanced Revit user recently contacted me to ask what could be done about it taking 10 seconds to move a wall because of Revit’s room calculations.

This demonstration shows how data about all rooms in the model can saved to file and the rooms deleted so that you can work without the room-associated performance penalty. Then when you want the rooms back, run the Import command to re-create the rooms based on the data that was saved to file.

Getting an element from a string ID

The Revit API has two similar seeming versions of GetElement

  • Document.GetElement Method (String)
  • Document.GetElement Method (ElementId)

To use the string version, you must have a Element.UniqueId. This is not the same as the ElementID. The UniqueID is a hexadecimal GUID such as 4f2cb6f4-bd46-4877-8bd9-3dae7acfdfae-0002d7f3. Its usefulness is that it is stable across upgrades and workset operations such as Save To Central, while the ElementId property may change.

But what if you have an element ID stored as a string? Perhaps you read the ID as a string from a text file or the user entered the ID value in a text box of your user interface. As a human you would look at the number and see an integer. But if it is stored as a string in your code, then the computer will see a string and if you try to use it with GetElement then it will expect it to be a UniqueID GUID. You can’t use an element ID value as a string in Document.GetElement Method (String).

In this case, you will need to convert the id value from a string to an integer, use ElementId Constructor (Int32), and then use this element ID with GetElement. Here’s a bit of code showing how to do this conversion.

// Find the first wall in the project for testing
Element e = new FilteredElementCollector(doc).OfClass(typeof(Wall)).First();

string uniqueIDstring = e.UniqueId;
// a GUID such as 4f2cb6f4-bd46-4877-8bd9-3dae7acfdfae-0002d7f3

Element eFromString = doc.GetElement(uniqueIDstring);

string idFromString = e.Id.ToString();
// a string storing a value such as 186354

int idInt = Convert.ToInt32(idFromString);
ElementId id = new ElementId(idInt);
Element eFromId = doc.GetElement(id);

TaskDialog.Show("Elements", eFromString.Id + "\n" + eFromId.Id);

“Sneak Peek” File Version Check install

Still debating if you should check out my great Revit API course at udemy.com?

Can’t wait to try the File Version Check tool that I wrote yesterday?

I’ve uploaded a special “sneak peek” installer for Revit 2013 and 2014 to the course at http://bit.ly/1dbiK5D. Please give it a try and let me know what you think.

Granting Steve’s “Project Version Wish”

Steve recently noted that “waiting for a Revit project to upgrade unnecessarily because I don’t know what version it was created in is a drag”. He mentioned two wishes:

“I’ve got a couple wishes. First I’d love it if Revit would store a value in the file properties that indicates Revit version. Second I’d love for Revit to ask first, “Do You WANT to UPGRADE? and a “NO, NOOOO, please on all things holy NOOOO” button.”

Sean rightfully suggested this would be a great opportunity for the Revit API to come to the rescue.

You know I love to grant a good wish!

Comments welcome as always… The install is available in my Revit API course at https://www.udemy.com/revitapi/?couponCode=149

What would you like me to teach at RTC NA 2014?

I’ve had a great time speaking at two Revit Technology Conferences in 2013 and look forward to doing so again next year. The application deadline is December 16, and I’d love to know what format and content would interest you? A hands-on lab? A lecture? More technical or less technical?