# Create elevation view by element

**URL:** <https://forum.dynamobim.com/t/create-elevation-view-by-element/33629>\
**Category:** Uncategorized\
**Created:** [March 18, 2019, 12:39pm UTC](https://forum.dynamobim.com/t/create-elevation-view-by-element/33629 "2019-03-18T12:39:36Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![ramoon.bandeira](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ramoon.bandeira/32/23449_2.png) [@ramoon.bandeira](https://forum.dynamobim.com/u/ramoon.bandeira)\
**Post date:** [March 18, 2019, 12:39pm UTC](https://forum.dynamobim.com/t/create-elevation-view-by-element/33629/1 "2019-03-18T12:39:36Z")

</div>

I’m trying to create a elevation view by element.  
In my specific case, i select a specific element in revit (a wall) and i want to built a elevation view that crops to the extents of this wall.

I’ve seen this article, it teaches how to create elevation view by model curves, i tryed to adapt it to my context but it did not work. Can anybody please help me?

The error i get is the following ![image](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/3X/d/e/de0d22a86d419b7b5e117db59dbbe3c46142163f.png)

[Elevation View Generator.dyn](https://forum.dynamobim.com/uploads/short-url/qTmoafbMDVYEtr820Jr9VpqC3xk.dyn) (39.7 KB)

> **[Module 2 Unwrapped Elevations | Learn Dynamo](http://learndynamo.com/mod2/)**
>
> In this module, learn how to create unwrapped elevations using Dynamo and Python by selecting model lines within your Autodesk Revit project.

Thank you all in advance.

---

<div class="post-metadata">

**Author:** ![Alban\_de\_Chasteigner](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alban_de_chasteigner/32/39650_2.png) [@Alban\_de\_Chasteigner](https://forum.dynamobim.com/u/Alban_de_Chasteigner)\
**Post date:** [March 18, 2019, 1:07pm UTC](https://forum.dynamobim.com/t/create-elevation-view-by-element/33629/2 "2019-03-18T13:07:32Z")

</div>

Hi,

The python script expects a list of Elevation Marker Points and not a single point. (Select multiple walls)

The downloaded .dyn seems to work.  
[LearnDynamo\_Module\_2 (dynamo 2.0).dyn](https://forum.dynamobim.com/uploads/short-url/tl5DxGNQSeupVIOc5cGVb1wnAtJ.dyn) (87.4 KB)

---

<div class="post-metadata">

**Author:** ![ramoon.bandeira](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ramoon.bandeira/32/23449_2.png) [@ramoon.bandeira](https://forum.dynamobim.com/u/ramoon.bandeira)\
**Post date:** [March 18, 2019, 1:11pm UTC](https://forum.dynamobim.com/t/create-elevation-view-by-element/33629/3 "2019-03-18T13:11:23Z")

</div>

Is there a way to adapt that for a single one?

---

<div class="post-metadata">

**Author:** ![Alban\_de\_Chasteigner](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alban_de_chasteigner/32/39650_2.png) [@Alban\_de\_Chasteigner](https://forum.dynamobim.com/u/Alban_de_Chasteigner)\
**Post date:** [March 18, 2019, 1:32pm UTC](https://forum.dynamobim.com/t/create-elevation-view-by-element/33629/4 "2019-03-18T13:32:00Z")

</div>

It works but with one or several walls the result doesn’t seem to be perfect.  
Did you already try the `ViewSection.ByLine` node in Data-Shape or the `Create Element View` node in BIM4Struc ?

```
#Copyright(c) 2016 www.Learndynamo.com 
#Please contact at jeremy@learndynamo.com

import clr
clr.AddReference('RevitAPI')
clr.AddReference("RevitServices")
clr.AddReference("RevitNodes")
import RevitServices
import Revit
import Autodesk
from Autodesk.Revit.DB import *
from math import *

clr.ImportExtensions(Revit.GeometryConversion)

from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

toggle = IN[0]
point = UnwrapElement(IN[1])
modelPoints = UnwrapElement(IN[2])
cropCurves = UnwrapElement(IN[3])
viewType = UnwrapElement(IN[4])

lst = []

#Get Family View Type
vft = 0
collector = FilteredElementCollector(doc).OfClass(ViewFamilyType).ToElements()

#eleViews = []
for i in collector:
	if i.ViewFamily == ViewFamily.Elevation:		
		vft = i.Id
		break
 
if toggle == True:
	
	TransactionManager.Instance.EnsureInTransaction(doc)
	

	
		#Retrieve the mid point of model lines and get X,Y.		
	modelMP = modelPoints.ToXyz()
	modelMPX = modelMP.X
	modelMPY = modelMP.Y
		
		#Retrieve individual lines of crop window.		
	cropLines = cropCurves
	l1 = cropLines[0].ToRevitType()
	l2 = cropLines[1].ToRevitType()
	l3 = cropLines[2].ToRevitType()
	l4 = cropLines[3].ToRevitType()
					
		# Create a line in the z-Axis for elevation marker to rotate around.			
	elevationPT = point.ToXyz()
	elptRotate = XYZ(elevationPT.X, elevationPT.Y, elevationPT.Z+100)
	ln = Line.CreateBound(elevationPT, elptRotate)

		#Calculate the angle between Model Mid Point and Elevation Point.
	elevationPTY = elevationPT.Y
	elevationPTX = elevationPT.X							
	combY = elevationPTY-modelMPY
	combX = elevationPTX-modelMPX			
	ang = atan2(combY, combX)

		#Create elevation marker and elevation in position 0.
	eleMarker = ElevationMarker.CreateElevationMarker(doc, viewType.Id, elevationPT, 100)
	ele = eleMarker.CreateElevation(doc, doc.ActiveView.Id , 0)
		
		#Rotate elevation marker towars model line.
	ElementTransformUtils.RotateElement(doc, eleMarker.Id, ln, ang)
		
		#	
	crManager = ele.GetCropRegionShapeManager()
		#crShape = crManager.GetCropRegionShape()

	newCurveLoop = []
	newCurveLoop.Add(l1)
	newCurveLoop.Add(l2)
	newCurveLoop.Add(l3)
	newCurveLoop.Add(l4)
			
	cLoop = CurveLoop.Create(newCurveLoop)

	try:			
		crManager.SetCropRegionShape(cLoop)
		lst.append("Elevation Created")
		
	except:
		pass
		lst.append("Missed Elevation")

	TransactionManager.Instance.TransactionTaskDone()
	
	OUT = lst
	
else:

	OUT = "Set toggle to TRUE"
```

---

<div class="post-metadata">

**Author:** ![ramoon.bandeira](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ramoon.bandeira/32/23449_2.png) [@ramoon.bandeira](https://forum.dynamobim.com/u/ramoon.bandeira)\
**Post date:** [March 18, 2019, 1:37pm UTC](https://forum.dynamobim.com/t/create-elevation-view-by-element/33629/5 "2019-03-18T13:37:21Z")

</div>

I did, but it creates a section view. In my case, what i really need is an elevation view.  
Thanks for your help!

Edit: I haven’t tryed the one from data-shapes, but looking at it now… it doesnt seems to work

---

<div class="post-metadata">

**Author:** ![ramoon.bandeira](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ramoon.bandeira/32/23449_2.png) [@ramoon.bandeira](https://forum.dynamobim.com/u/ramoon.bandeira)\
**Post date:** [March 18, 2019, 1:52pm UTC](https://forum.dynamobim.com/t/create-elevation-view-by-element/33629/6 "2019-03-18T13:52:21Z")

</div>

I used your code and it doesn’t work with any walls.  
I used the node ElevationMarker.CreateElevation Marker from the Rhythm package and it created a marker with the view. The problem is that i canot update the view crop region through dynamo. Is there a way to do so?

Thanks !

---

<div class="post-metadata">

**Author:** ![Alban\_de\_Chasteigner](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alban_de_chasteigner/32/39650_2.png) [@Alban\_de\_Chasteigner](https://forum.dynamobim.com/u/Alban_de_Chasteigner)\
**Post date:** [March 18, 2019, 1:56pm UTC](https://forum.dynamobim.com/t/create-elevation-view-by-element/33629/7 "2019-03-18T13:56:05Z")

</div>

In this case, use this dyn with the updated python script.

[LearnDynamo\_Module\_2 (dynamo 2.0) V2.dyn](https://forum.dynamobim.com/uploads/short-url/jGPBJ2y9XJ2RCdD5fj9YewGNujr.dyn) (88.2 KB)

---

<div class="post-metadata">

**Author:** ![ramoon.bandeira](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ramoon.bandeira/32/23449_2.png) [@ramoon.bandeira](https://forum.dynamobim.com/u/ramoon.bandeira)\
**Post date:** [March 18, 2019, 2:01pm UTC](https://forum.dynamobim.com/t/create-elevation-view-by-element/33629/8 "2019-03-18T14:01:17Z")

</div>

Thanks for you support man.  
But unfortunately, even this new code keeps returning me the message Missed elevation

---

<div class="post-metadata">

**Author:** ![Alban\_de\_Chasteigner](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alban_de_chasteigner/32/39650_2.png) [@Alban\_de\_Chasteigner](https://forum.dynamobim.com/u/Alban_de_Chasteigner)\
**Post date:** [March 18, 2019, 2:02pm UTC](https://forum.dynamobim.com/t/create-elevation-view-by-element/33629/9 "2019-03-18T14:02:33Z")

</div>

Me too, but the elevation view is still created at the correct location.

---

<div class="post-metadata">

**Author:** ![ramoon.bandeira](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ramoon.bandeira/32/23449_2.png) [@ramoon.bandeira](https://forum.dynamobim.com/u/ramoon.bandeira)\
**Post date:** [March 18, 2019, 2:12pm UTC](https://forum.dynamobim.com/t/create-elevation-view-by-element/33629/10 "2019-03-18T14:12:05Z")

</div>

In some cases it is… in most it is not created. When i use the node ElevationMarker.CreateElevationMarker from the rhythm package it always creates the elevation at the correct spot. There is a node from the clockWork package called ElevationMarker.Views. with him i could get the views associated to the elevation marker. He is not currently working. His code is this one:

```
import clr

```

clr.AddReference(‘RevitAPI’)  
from Autodesk.Revit.DB import \*

clr.AddReference(“RevitNodes”)  
import Revit  
clr.ImportExtensions(Revit.Elements)

def GetElevationMarkerView(item):  
val =   
if hasattr(item, “HasElevations”):  
if item.HasElevations():  
for i in range(item.MaximumViewCount):  
view = item.Document.GetElement(item.GetViewId(i))  
if view: val.append(view)  
return val

items = UnwrapElement(IN[0])

if isinstance(IN[0], list): OUT = [GetElevationMarkerView(x) for x in items]  
else: OUT = GetElevationMarkerView(items)

Any tip on how to fix that?

---

<div class="post-metadata">

**Author:** ![Alban\_de\_Chasteigner](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alban_de_chasteigner/32/39650_2.png) [@Alban\_de\_Chasteigner](https://forum.dynamobim.com/u/Alban_de_Chasteigner)\
**Post date:** [March 18, 2019, 2:21pm UTC](https://forum.dynamobim.com/t/create-elevation-view-by-element/33629/11 "2019-03-18T14:21:10Z")

</div>

I suggest you create a new topic with your new question (ElevationMarker.Views node) and link it to this page.  
The original subject with the error in the python script is resolved even though your elevation creation problem remains the same.  
For now, I do not have time to edit other scripts.

---

<div class="post-metadata">

**Author:** ![ramoon.bandeira](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ramoon.bandeira/32/23449_2.png) [@ramoon.bandeira](https://forum.dynamobim.com/u/ramoon.bandeira)\
**Post date:** [March 18, 2019, 2:24pm UTC](https://forum.dynamobim.com/t/create-elevation-view-by-element/33629/12 "2019-03-18T14:24:06Z")

</div>

Thanks for your support.  
That’s what i’ll do.

---

<div class="post-metadata">

**Author:** ![simoneavellini](https://avatars.discourse-cdn.com/v4/letter/s/ee7513/32.png) [@simoneavellini](https://forum.dynamobim.com/u/simoneavellini)\
**Post date:** [January 2, 2020, 5:17pm UTC](https://forum.dynamobim.com/t/create-elevation-view-by-element/33629/14 "2020-01-02T17:17:57Z")

</div>

Hi, I recreated this in 1.3 but I get this error.  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/d/6dc3c84854ab8410e2d5b56448e0d2fb6d716c23.png)  
Any advice ?  
Cheers

---

<div class="post-metadata">

**Author:** ![m.souza](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/m.souza/32/91018_2.png) [@m.souza](https://forum.dynamobim.com/u/m.souza)\
**Post date:** [March 7, 2020, 9:31pm UTC](https://forum.dynamobim.com/t/create-elevation-view-by-element/33629/15 "2020-03-07T21:31:30Z")

</div>

Hi @simoneavellini , can you show what you have in line 46 and what the inputs look like?  
It seems you need to go one (or more) step deeper into the list, to be able to extract the xyz attribute from the point and not the list of points.

---

<div class="post-metadata">

**Author:** ![oliwer.kulpa](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/oliwer.kulpa/32/105970_2.png) [@oliwer.kulpa](https://forum.dynamobim.com/u/oliwer.kulpa)\
**Post date:** [November 10, 2020, 2:59pm UTC](https://forum.dynamobim.com/t/create-elevation-view-by-element/33629/16 "2020-11-10T14:59:28Z")

</div>

Hi there,  
Thanks for all your work done here. @ramoon.bandeira and @Alban_de_Chasteigner I got curious, why some of the views are not being correctly created, and why on earth the output message was always “Missed Elevation” even though all of them are properly (apart from crop region). I looked into the code and I’ve found out, that since 2016 Revit API has changed in that area. In the ending of the code, when we are trying to set the crop region, _crManager.SetCropShape(loop)_ method should be used instead of _crManager.SetCropRegionShape(loop)_.  
Cheers!

---

<div class="post-metadata">

**Author:** ![kaankrby](https://avatars.discourse-cdn.com/v4/letter/k/3da27b/32.png) [@kaankrby](https://forum.dynamobim.com/u/kaankrby)\
**Post date:** [January 20, 2021, 8:15am UTC](https://forum.dynamobim.com/t/create-elevation-view-by-element/33629/17 "2021-01-20T08:15:00Z")

</div>

Hi,  
İ was trying to use that script @Alban_de_Chasteigner shared.  
Elevation Missed warning reason is changed API method.

```
> try:			
> crManager.SetCropShape(cLoop)
> lst.append("Elevation Created")
> 		
> except:
> pass
> lst.append("Missed Elevation")

```

this part was

> ```
> try:			
> crManager.SetCrop*Region*Shape(cLoop)
> 
> ```

This method is from 2015 API now depracated.

After that change it’s working perfect.  
Cropped Wall elevations generated. 😃

* * *

Same message pervious one ☹

---

<div class="post-metadata">

**Author:** ![oliwer.kulpa](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/oliwer.kulpa/32/105970_2.png) [@oliwer.kulpa](https://forum.dynamobim.com/u/oliwer.kulpa)\
**Post date:** [January 20, 2021, 1:06pm UTC](https://forum.dynamobim.com/t/create-elevation-view-by-element/33629/18 "2021-01-20T13:06:48Z")

</div>

Hi @kaankrby,  
I’m a bit confused. Do you mean you are still getting the same warning message? Cound you share some more details?

---

<div class="post-metadata">

**Author:** ![kaankrby](https://avatars.discourse-cdn.com/v4/letter/k/3da27b/32.png) [@kaankrby](https://forum.dynamobim.com/u/kaankrby)\
**Post date:** [January 24, 2021, 6:10pm UTC](https://forum.dynamobim.com/t/create-elevation-view-by-element/33629/19 "2021-01-24T18:10:44Z")

</div>

No 🙂

i didn’t read your message completly,  
And started to digging script and the api methods  
When i find the solution i writed here

So

after reply i noticed that u writed same thing ☹

---

<div class="post-metadata">

**Author:** ![michelFTJKX](https://avatars.discourse-cdn.com/v4/letter/m/67e7ee/32.png) [@michelFTJKX](https://forum.dynamobim.com/u/michelFTJKX)\
**Post date:** [July 7, 2022, 7:08am UTC](https://forum.dynamobim.com/t/create-elevation-view-by-element/33629/21 "2022-07-07T07:08:44Z")

</div>

Hi all. I get the same error as @simoneavellini even though im using Revit 2022 and Dynamo 2.12.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/b/1b21d4c5b6c232622b4d2e4a930c8376ee3277d6.png)

@m.souza did you ever find a solution?

Im using the dynamo script that @Alban_de_Chasteigner posted - the Module 2 V2 script.  
The python script looks like this.

```auto
import clr
clr.AddReference('RevitAPI')
clr.AddReference("RevitServices")
clr.AddReference("RevitNodes")
import RevitServices
import Revit
import Autodesk
from Autodesk.Revit.DB import *
from math import *

clr.ImportExtensions(Revit.GeometryConversion)

from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

toggle = IN[0]
point = UnwrapElement(IN[1])
modelPoints = UnwrapElement(IN[2])
cropCurves = UnwrapElement(IN[3])
viewType = UnwrapElement(IN[4])

lst = []

#Get Family View Type
vft = 0
collector = FilteredElementCollector(doc).OfClass(ViewFamilyType).ToElements()

#eleViews = []
for i in collector:
	if i.ViewFamily == ViewFamily.Elevation:		
		vft = i.Id
		break
 
if toggle == True:
	
	TransactionManager.Instance.EnsureInTransaction(doc)
	

	
		#Retrieve the mid point of model lines and get X,Y.		
	modelMP = modelPoints.ToXyz()
	modelMPX = modelMP.X
	modelMPY = modelMP.Y
		
		#Retrieve individual lines of crop window.		
	cropLines = cropCurves
	l1 = cropLines[0].ToRevitType()
	l2 = cropLines[1].ToRevitType()
	l3 = cropLines[2].ToRevitType()
	l4 = cropLines[3].ToRevitType()
					
		# Create a line in the z-Axis for elevation marker to rotate around.			
	elevationPT = point.ToXyz()
	elptRotate = XYZ(elevationPT.X, elevationPT.Y, elevationPT.Z+100)
	ln = Line.CreateBound(elevationPT, elptRotate)

		#Calculate the angle between Model Mid Point and Elevation Point.
	elevationPTY = elevationPT.Y
	elevationPTX = elevationPT.X							
	combY = elevationPTY-modelMPY
	combX = elevationPTX-modelMPX			
	ang = atan2(combY, combX)

		#Create elevation marker and elevation in position 0.
	eleMarker = ElevationMarker.CreateElevationMarker(doc, viewType.Id, elevationPT, 100)
	ele = eleMarker.CreateElevation(doc, doc.ActiveView.Id , 0)
		
		#Rotate elevation marker towars model line.
	ElementTransformUtils.RotateElement(doc, eleMarker.Id, ln, ang)
		
		#	
	crManager = ele.GetCropRegionShapeManager()
		#crShape = crManager.GetCropRegionShape()

	newCurveLoop = []
	newCurveLoop.Add(l1)
	newCurveLoop.Add(l2)
	newCurveLoop.Add(l3)
	newCurveLoop.Add(l4)
			
	cLoop = CurveLoop.Create(newCurveLoop)

	try:			
		crManager.SetCropShape(loop)
		lst.append("Elevation Created")
		
	except:
		pass
		lst.append("Missed Elevation")

	TransactionManager.Instance.TransactionTaskDone()
	
	OUT = lst
	
else:

	OUT = "Set toggle to TRUE"

```
