Happy Birthday to The Building Coder
Hooray! This is the hundredth posting to The Building Coder. I am celebrating by having a wonderful cup of chai and a muesli with my dear friend Andreas in the middle of a snowstorm way out in the Swiss countryside. I hope you are happy as well. I am looking forward to feedback, suggestions, and questions to fuel future topics. Please be aware that I do not want to do any of your work for you, but I love supporting you in doing it yourself. Here is a prime example of such a process coming to full fruition.
A couple of weeks ago, Dan Levesque of Stantec approached me asking for support in rapidly implementing a complex process for managing elements in a large structural Revit project. We decide to handle this step by step and on a do-it-yourself basis, and the end result is really pretty spectacular. Dan made extremely effective use of a number of pre-existing Revit SDK and ADN samples that address similar issues, asking brief questions on how to adapt them for his own use and with minimal further guidance.
For this special issue, I asked Dan to describe his project as a perfect example of making use of the large base of existing sample code to create a complex and professional customer solution. Here is Dan's project description:
Company
Stantec provides professional consulting services in planning, engineering, architecture, interior design, landscape architecture, surveying, environmental sciences, project management, and project economics for infrastructure and facilities projects. Stantec supports public and private sector clients in a diverse range of markets, at every stage, from initial concept and financial feasibility to project completion and beyond. There services are offered through over 10,000 employees operating out of more than 150 locations in North America.
Contact
Dan Levesque is a Senior Structural Technologist at Stantec in Scarborough, Maine. He has over 13 years of experience in the use of 3D modelling software, programming, network administration and web development. At Stantec Scarborough office, Mr. Levesque is responsible for Revit Structure integration, file exchange, training, programming and software evaluation.
Software
Revit Structure 2009 SP2, Add-in Manager, Visual Studio 2008 Express, Navisworks.
Main Project
This is an overview of the project requiring additional Revit customization:
- Industrial power steel structure, new & existing phased.
- Composed of 14,000 tons of structural steel.
- Created in Revit Structure 2009.
- Divided into 4 projects.
- Analytical analysis performed with 3rd party software.
- Visualization, collision, and construction sequencing performed with Navisworks.
Revit Customization
These are the goals and requirements of the project specific Revit extension through coding and customization:
- Create and apply new shared parameters to specified structural category elements automatically.
- Export new shared parameters and required predefined parameters to a database based on Revit Element ID.
- Export XYZ analytical coordinates from all structural elements to a database.
- Quickly and accurately number all Revit structural elements utilizing the Mark parameter based on z elevation and category.
- Import and return new parameter data values to respective Revit project elements.
Process Overview
Here is an overview of the general process steps and some comments:
Our real-time Revit project consists of a total 14,000 elements divided in 4 projects. With the expertise, help and guidance of Jeremy Tammik and SDK examples, I was able to create a Structural_ID program based on the SDK FireRating example and a Revit_XYZ_Export program based upon the RstLinkRevitClient sample.
1a. Structural_ID Module 1: Apply Parameters – derived from FireRating:
- Create and apply new shared parameter data per category to Framing & Columns: Structural_ID_Frame, Structural_ID_Column, and Sequence Number. Defined as user entry text fields.
- Revit designer isolates all structural framing per project and enters 'Projno.F'. All framing elements are assigned.
- Revit designer isolates all structural Columns per project and enters 'Projno.C'. All columns elements are assigned.
- Revit designer isolates all structural framing and columns per project and enters 'Sequence no.' per PM assignment. All selected structural elements are assigned.
1b. Structural_ID Module 2: Export Parameters – derived from FireRating:
- Export Structural_ID_Frame and Structural_ID_Column shared parameters. As noted before, these parameters hold a value to define the project category identification such as 'Proj-1F' or 'Proj-1C'. From this we can tell its project origin. You could have duplication of the Revit Element ID amongst the 4 separate projects, so using Structural_ID’s and Element ID as dual validation will effectively provide data integrity.
- Export Sequence Number shared parameter. This user entered value is utilized for establishing a grouping of structural elements for construction sequence which is later interpreted in Navisworks and used for sorting purposes.
- Export predefined parameters Element ID, Mark, and Level.
- End result is Database1, a tabulated spreadsheet defining each row by Revit Element ID, Level, Mark, and Structural ID.
2. The Revit projects are then analytically checked and the vertical projection property of the horizontal elements are assigned to the correct T.O.S. level to ensure accuracy on Z. Columns are set to Top and Bottom analytically.
3. RST_XYZ_Export – derived from RstLinkRevitClient:
- RST_XYZ_Export, a second individual program exports all the XYZ, Type, Element ID and other various parameters. The resulting xml data is opened, converted and saved as Database2.
- The Structural ID Database1 and RST_XYZ_Export Database2 are then combined and transferred per project through Revit Element ID validation to a Master Database.
4. A separate analytical model that has been manually kept in sync is exported to Database3 with its beam numbers and XYZ coordinates.
5. A VBA Excel program designed by our structural engineers compares analytical Database3 XYZ values and the Master Database XYZ Revit values and determines the match. This results in the analytical beam numbers placed in a row along with the Revit Element ID and related parameters. Engineering Team coordinates loads and connection data as well in Master Database.
6. All data in the Master Database is complete with the exception of the Mark field. Project Supervisor will assign a number sequence to the Mark field that is incremented based upon the Z coordinate of the members. This results in lower levels having smaller values and higher levels high numbers. This is a quick way to number 3,600 plus elements per project. Due to the fact that the Mark parameter is utilized, we can also detect duplicates when importing data brought back into Revit or if the Designer enters a number twice.
7. From the Master Database file the Revit Element ID and Mark values are validated and transferred back to the first Database1 file.
8. Structural_ID Module 3: Import Parameters – derived from FireRating:
- The Import application is executed to return the Mark number values to each Revit project from each per project updated Database1 file.
9. Revit project tags are modified to depict Mark values and represent element numbering in each project.
10. The remainder and continuation of the project is a manual input for number coordination. All numbers forward are incremented higher and previous numbers are not to be re-used. Schedules are created based on ascending mark number listing to ensure next number used.
Summary
There is obviously a lot going on here, but if kept regimented it works well. Time as always, will dictate how much effort is put in making a program practical, clean, accurate, and deliver the scope intended. Within one weeks time (We stopped counting the hours) we were able to complete this overall team effort. As I look in hind sight, I am grateful that I had the required information and support by Autodesk and its professional staff. Without it, it would have been a grave disappointment. I am now aware of my available resources to further our development and utilization of the Revit API. It’s amazing how much you can learn from the various samples provided in the SDK with supported documentation. Just imagine the possibilities for the upcoming future. I intend to bring this program example to a more consolidated level and transform it to an internal Revit Auto Mark Numbering validation program with various user select export options ranging from shared parameters, predefined parameters, and XYZ coordinates.
Thanks to Jeremy Tammik of Autodesk and Elizabeth Shulok of Structural Integrators for all your help and sharing the knowledge.
Back to Jeremy
Thank you very much Dan, for this contribution. I would like to express my appreciation and respect for your hard work and enthusiasm, and gratitude for documenting and sharing the end result, hopefully as an inspiration for others as well. It was an honour and a pleasure to work with Dan and see with him make such efficient use of every little snippet of information provided.
It's hard to believe you've already hit a 100 posts (and what great posts)!
Here's to many hundred more! :-)
Kean
Posted by: Kean Walmsley | February 17, 2009 at 06:05
Hi Kean,
Thank you very much, and yes, I find it hard to believe myself. I plan to go on vacation in March; maybe I can cool off and calm down a little then :-)
Cheers, Jeremy.
Posted by: Jeremy Tammik | February 17, 2009 at 06:23
Hi Jeremy,
Congratulations, good job man!
And thx a lot for helping...
Tcho!
Posted by: pnavarra | February 17, 2009 at 08:01
Thanks for the excelent posts, they are incredible helpful and complements the great examples in the SDK perfectly.
Happy 100th.
/Hakan
Posted by: Hakan Wikemar | February 18, 2009 at 14:25
Hejsan Håkan,
kul att du tycker om dom! Glad you like them!
Best regards, Jeremy.
Posted by: Jeremy Tammik | February 18, 2009 at 18:52
I read your posts with the intent on coming back and really diving into them. Thanks for your guidance and your hard work. I really appreciate the examples and your clear writing style. It really helps a rookie like me see exactly whats going on.
"Here's what we want to do." "Heres the code" "Heres the outcome."
Thanks and cheers!
Posted by: Sage | February 19, 2009 at 11:30
Dear Sage,
Thank you very much for the appreciation and encouragement, it is very supportive, and I will be glad to continue in the same or improved veins, insha'Allah. If you have any suggestions or specific issues and questions, they are always welcome as well, of course.
Cheers, Jeremy.
Posted by: Jeremy Tammik | February 21, 2009 at 09:52
Dear Jeremy,
I studying in Revit API to make 4D visualization in Revit Structure. But I have a big trouble, I can not change the phase property of element (Phase Created and Phase Demolished). Can we change these properties?
Thanks for your help!
Posted by: Account Deleted | March 11, 2009 at 06:23
Hi TanDung,
There are two built-in properties: PHASE_CREATED and PHASE_DEMOLISHED. Both require an ElementId and supposed to be writable.
Did you already try setting these?
Cheers,
Adam
Posted by: Adam Nagy | March 17, 2009 at 08:30
Dear TanDung,
I hope that Adam's suggestion solved your problem. For completelness sake, I would also like to point out this post:
http://thebuildingcoder.typepad.com/blog/2009/03/create-room-on-level-in-phase.html
Cheers, Jeremy.
Posted by: Jeremy Tammik | March 27, 2009 at 06:46
Hello Jeremy. I read your blog with a lot of interest. I am developing some extensions for Revit myself in Visual Basic. So far so good. The SDK and the samples, and your site help me a lot. Now, I am trying to develop an extension that should do the following. Define on base of 3 points in space a new ViewSection. I am struggling with the Transform. The only thing that seems to work is the BoundingBox, but that one is using only 2 points....Do you have any ideas?
Thanks in advance, Renzo
Posted by: Renzo | July 23, 2009 at 15:49
Dear Renzo,
Thank you for your interest, I am glad about that.
You do not specify exactly how the transform you require is defined by the three points. Do you need a transformation of the XY plane into a plane in 3D space spanned by the three points?
Cheers, Jeremy.
Posted by: Jeremy Tammik | July 27, 2009 at 12:37
Very interesting article. Thank you for sharing.
Posted by: Bygningsentreprise | October 15, 2009 at 03:26
Dear Chris,
Thank you for your appreciation, and many thanks again to Dan!
Cheers, Jeremy.
Posted by: Jeremy Tammik | October 15, 2009 at 04:52
Dear Jeremy,
Please let me know what is the best way to send You my API Macro which I would like to get some help with. My e-mail - [email protected]
Thanx a lot !!!!!
Posted by: Marcin Klocek | January 11, 2010 at 03:24
Dear Marcin,
I am sorry to say that I have absolutely no time left over to look at individual macros. Sorry about that.
Cheers, Jeremy.
Posted by: Jeremy Tammik | January 11, 2010 at 11:24
In general ,my idea was just selecting a face on an object....
Untill now, I did not have any success and very very little time
Renzo
Posted by: Renzo | February 08, 2010 at 15:11
Dear Renzo,
Yes, sorry, the selection facilities in the Revit API are currently rather limited. We are working on this, though, so you can expect some significant future improvement there.
Cheers, Jeremy.
Posted by: Jeremy Tammik | February 12, 2010 at 00:00