# Multiple elevation views for multiple walls

**URL:** <https://forum.dynamobim.com/t/multiple-elevation-views-for-multiple-walls/78422>\
**Category:** Developers\
**Tags:** revit, python, dynamo\
**Created:** [July 7, 2022, 7:36am UTC](https://forum.dynamobim.com/t/multiple-elevation-views-for-multiple-walls/78422 "2022-07-07T07:36:43Z")\
**Posts on this page:** 3\
**Page:** 1

<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:36am UTC](https://forum.dynamobim.com/t/multiple-elevation-views-for-multiple-walls/78422/1 "2022-07-07T07:36:44Z")

</div>

Hi experts

I am trying to use a modified learning module script to create multiple elevation views on multiple walls. I’ve searched around the forum for a solution and some people suggested i flatten the list but that didnt work - then i get another error.

Any idea what i can do to fix the script?

Error snapshot and .dyn file attached below

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

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

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [July 7, 2022, 7:29pm UTC](https://forum.dynamobim.com/t/multiple-elevation-views-for-multiple-walls/78422/2 "2022-07-07T19:29:36Z")

</div>

@michelFTJKX ,

better to show your code… 😉

```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"

```

---

<div class="post-metadata">

**Author:** ![Daan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/daan/32/82246_2.png) [@Daan](https://forum.dynamobim.com/u/Daan)\
**Post date:** [July 7, 2022, 8:03pm UTC](https://forum.dynamobim.com/t/multiple-elevation-views-for-multiple-walls/78422/3 "2022-07-07T20:03:10Z")

</div>

Hi @michelFTJKX ,

See if this helps:

> [@.ToXyz() could not convert the Geometry's Units?](https://forum.dynamobim.com/t/toxyz-could-not-convert-the-geometrys-units/19745/2):
>
> try calling ToXyz(true)
