Create elevation view by element

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

Elevation View Generator.dyn (39.7 KB)

Thank you all in advance.

1 Like


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 (87.4 KB)

1 Like

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

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 
#Please contact at

import clr
import RevitServices
import Revit
import Autodesk
from Autodesk.Revit.DB import *
from math import *


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
if toggle == True:

		#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 = []
	cLoop = CurveLoop.Create(newCurveLoop)

		lst.append("Elevation Created")
		lst.append("Missed Elevation")

	OUT = lst

	OUT = "Set toggle to TRUE"
1 Like

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

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 !

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

LearnDynamo_Module_2 (dynamo 2.0) V2.dyn (88.2 KB)

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

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

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

from Autodesk.Revit.DB import *

import Revit

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?

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.

1 Like

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

Hi, I recreated this in 1.3 but I get this error.
Any advice ?

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.

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).

1 Like

İ 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


This method is from 2015 API now depracated.

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

Same message pervious one :frowning:

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

1 Like

No :slight_smile:

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


after reply i noticed that u writed same thing :frowning:

1 Like