Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Automate Room Elevations using Revit API

12 REPLIES 12
SOLVED
Reply
Message 1 of 13
grahamcook
5419 Views, 12 Replies

Automate Room Elevations using Revit API

Hi

I have been asked if it’s possible to automate the creation of over 1000 room elevation sheets using the Revit API.  But rather frustratingly there is no NewViewElevation method (why this method has been omitted is a mystery).  So I have used the NewViewSection method and placed 4 views in each of the rooms and set the bounds of the section box to the extents of the room.  This creates the elevations (or sections) in the Details View node.  I then set about creating the sheets, and placing the 4 elevations for the room within the sheet.  So in principle this approach works.

 

The problem is that the graphics on the plan are not acceptable as there are 4 detail section tags in each of the rooms which combined with all the other rooms makes for a far to cluttered plan.  So for us, despite the hard work already put in, its back to square one.  I’ve only been using the Revit API for about 4 months now so am still learning but is there any way of getting the default or custom elevation tag placed in the centre of each room and switching on each quadrant using the API?  If we can we will turn months of work into a few days.

 

I’m using 2012 and was half expecting 2013 to include the missing NewViewElevation method but was disappointed!

 

Any help much appreciated.

 

12 REPLIES 12
Message 2 of 13
jeremytammik
in reply to: grahamcook

Dear Graham,

 

Afaik the Revit 2013 API provides all the support yopu need for this. Look at

 

http://thebuildingcoder.typepad.com/blog/2012/06/create-structural-plan-view.html

 

http://thebuildingcoder.typepad.com/blog/2012/06/create-section-view-parallel-to-wall.html

 

Best regards,

Jeremy
--
Jeremy Tammik
Autodesk Developer Network -- http://www.autodesk.com/joinadn
The Building Coder -- http://thebuildingcoder.typepad.com




Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 13
grahamcook
in reply to: jeremytammik

Thank you Jeremy.  Your links were very useful.  I used the:

 

viewSection.get_Parameter( BuiltInParameter.SECTION_COARSER_SCALE_PULLDOWN_METRIC ).Set( 1 );

 

to hide the detail section nodes from the plan view as detailed in your links below (section views) and dealt with the drawing coordination and cross referencing another way.

 

I am consulting for a rather large engineering firm who won't be upgrading to 2013 any time soon so will not be able to take advantage of the new View API tools 😞  But these enhancements still don't provide the functions to mimic the Elevation view available through the user interface, is that right?  Rather, it is assumed that we can use section views to accomplish the same result.  This is OK and is indeed the approach i have taken, but for drawing coordination purposes a simple elevation tag placed in the centre of each room is the way to go rather than 4 separate section tags.

Message 4 of 13
jeremytammik
in reply to: grahamcook

Dear Graham,

 

I forwarded your question to the development team, and they respond: "Sorry, but I don't understand the question. What is the developer trying to do that they cannot do? Is there a code sample?"

 

Best regards,

Jeremy
--
Jeremy Tammik
Autodesk Developer Network -- http://www.autodesk.com/joinadn
The Building Coder -- http://thebuildingcoder.typepad.com




Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 5 of 13
grahamcook
in reply to: jeremytammik

Hi Jeremy

 

I attach a plan image from one of the sample models.  My addin produced all the section tags (and subsequent sections) in the top plan.  Basically the user selects the rooms, clicks a button and one elevation sheet is produced for each room showing 4 elevations each all confined to the bounds of their respective rooms.  There's some way to go in completing the addin, like giving the user options for scale, linking to our drawing number database etc.  but in principle it works.  The following post helped me out alot:

 

http://thebuildingcoder.typepad.com/blog/2011/07/section-view-creation.html

 

The bottom image in the attached file was created manually using the View - Elevation tags in the user interface and is where i would rather be but produced through the API.  This method is much clearer and less cluttered when cross referencing and coordinating the drawing sets.  As you can imagine, on a plan with several hundred rooms the section tag approach becomes unreadable.

 

I hope that clarifies my original question.

 

Regards

 

Graham Cook

Message 6 of 13
jeremytammik
in reply to: grahamcook

hi graham,

 

IT APPEARS THAT YOU want elevation views but ARE creating section views instead. Is this true?

 

If so, why ARE YOU NOT using ElevationMarker.CreateElevationMarker and ElevationMarker.CreateElevation?

 

cheers

 

jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 7 of 13
grahamcook
in reply to: jeremytammik

Jeremy

 

That is exactly what I'm trying to do but have not been able to find any documented articles on ElevationMarker.CreateElevation.  Is this new for 2013 or part of 2012.  Can't find anything in the object browser either for ElevationMarker.  Do you have any examples?

 

Regards

 

Graham

Message 8 of 13
jeremytammik
in reply to: grahamcook

Dear Graham,

 

It is all part of the new 2013 view API. It all described on the blog, more or less:

 

http://thebuildingcoder.typepad.com/blog/2012/06/create-section-view-parallel-to-wall.html

 

http://thebuildingcoder.typepad.com/blog/2012/06/create-structural-plan-view.html

 

CreateElevation is similar to ViewPlan.Create and ViewSection.CreateSection.

 

Hope this helps.

 

Best regards,

Jeremy
--
Jeremy Tammik
Autodesk Developer Network -- http://www.autodesk.com/joinadn
The Building Coder -- http://thebuildingcoder.typepad.com



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 9 of 13
grahamcook
in reply to: grahamcook

Good stuff.  I'll start looking into the 2013 API then.  Thank you for your help Jeremy.

 

Regards

 

Graham Cook

Message 10 of 13
jeremytammik
in reply to: grahamcook

Buena suerte 🙂 j.


Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 11 of 13
grahamcook
in reply to: grahamcook

Hi Jeremy

I have got the room elevation add-in working using the new ElevationMarker class in 2013.  It works great with Orthogonal rooms.  Problem is with rotated rooms where the markers don't orientate themselves to the room as they do if placing manually using the UI.  Perhaps i'm missing something here, i've looked through the properties and methods of the elevationMarker element and can't see anything there that will enable me to rotate the marker.  The code so far is as follows and if you see any deliberate mistakes or got any pointers on how to orientate the markers that would be great.

 

        public static void elevateRoom(Document doc, Element room, int scale)
        {

            // get the viewPlan the room is located on
            ViewPlan viewPlan = null;

            FilteredElementIterator viewPlanItr = new FilteredElementCollector(doc).OfClass(typeof(ViewPlan)).GetElementIterator();

            while (viewPlanItr.MoveNext())
            {
                ViewPlan vp = viewPlanItr.Current as ViewPlan;

                if (vp.GenLevel.Name.Equals(room.Level.Name))
                {
                    viewPlan = vp;
                    break;
                }
            }
            //----------------------------------------------------

            if (viewPlan != null)
            {
                // get the centre of the room
                BoundingBoxXYZ oBBox = room.get_BoundingBox(null);

                double oX = oBBox.Min.X + ((oBBox.Max.X - oBBox.Min.X) / 2);
                double oY = oBBox.Min.Y + ((oBBox.Max.Y - oBBox.Min.Y) / 2);
                double oZ = oBBox.Min.Z;

                XYZ roomCenter = new XYZ(oX, oY, oZ);
                //-------------------------------------------------------

                // place elevation marker and create the four views
                ViewFamilyType vft = new FilteredElementCollector(doc).OfClass(typeof(ViewFamilyType))
                    .Cast<ViewFamilyType>().FirstOrDefault<ViewFamilyType>(x => ViewFamily.Elevation == x.ViewFamily);

                ElevationMarker elevMarker = ElevationMarker.CreateElevationMarker(doc, vft.Id, roomCenter, scale);
                elevMarker.CreateElevation(doc, viewPlan.Id, 0);
                elevMarker.CreateElevation(doc, viewPlan.Id, 1);
                elevMarker.CreateElevation(doc, viewPlan.Id, 2);
                elevMarker.CreateElevation(doc, viewPlan.Id, 3);
                //-------------------------------------------------------

            }
        }

 

Message 12 of 13
jeremytammik
in reply to: grahamcook

Dear Graham,

 

Another reply from the development team, and we both are obviously not doing our homework:

 

The documentation for the ElevationMarker class explains how it can be rotated:

 

ElevationMarkers store the ViewFamilyType which will be used by all elevations hosted on the ElevationMarker. The orientation of an ElevationMarker is determined by the orientation of the views it hosts. You can check the orientation of any view by getting View.ViewDirection. To reorient the ElevationMarker and all of the views it hosts, call ElementTransformUtils.RotateElement with the ElevationMarker as an argument.

 

Cheers, Jeremy.



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 13 of 13
aricke59
in reply to: jeremytammik

It's worth noting that you can only rotate the elevation marker once an elevation index has been activated. Also if you then delete the only activated elevation, the marker reverts to its unrotated form.

 

I eventually worked out that I needed to create one of the elevations (index 3), rotate the marker, create elevation indexes 0, 1, & 2, and then delete 3, and then recreate 3.

 

What? Why? By using this approach the extents of the elevations are set correctly, i.e, extend to surrounding walls.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community