Get elevation marker from elevation view

Is there a way to get the view marker from a elevation view?

I need to get this in order to rotate the elevation view associated to it. As mentioned in this topic

That’s where i am right now

Thanks

Something like this?

1 Like

No. I don’t think that would suit my problem.

Here’s what i’m trying to do.

1 - Create a Elevation Marker at a given point
2 - Create a elevation view in this marker
3 - After the creating of the view, i want to rotate the elevation marker for a given angle
4 - Set the crop box of the view

the steps 1, 2 and 4 i already created and it worked perfectly…
But in order to complete the step three, i need to get the elevation marker associated to the created elevation view.

Well, to get the elevation marker is easy, isn’t? You just created in step 1, it’s simply the output of ElevationMarker.CreateElevationMarker.

If you want to rotate it, there is a method in the API, I tried to find a node but I didn’t, so this is the python:
http://www.revitapidocs.com/2018.1/3968f4e8-759c-f975-6c1f-7de42be633ed.htm

ElevationMarkerRotate

import clr


clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *

clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *

clr.AddReference('System')
from System.Collections.Generic import List

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

element = UnwrapElement(IN[0])
angle = IN[1]

p = XYZ(0,0,0)
q = XYZ(0,0,1)

line = Line.CreateBound(p,q)

TransactionManager.Instance.EnsureInTransaction(doc)

rot = ElementTransformUtils.RotateElement(doc,element.Id,line,angle)

TransactionManager.Instance.TransactionTaskDone()

OUT = element

Of course you need to change inputs, using your elevation marker and the degrees you want.

1 Like

Thanks for your support
But it didn’t work. It does not rotates the element. And it moves the Marker to another point

Your Response was really helpfull @lucamanzoni but it was not complete.
I mixed the concepts of your code with the code of @Alban_de_Chasteigner and it finally worked.

Here it is for further references

import clr


clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *

clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *

clr.AddReference('System')
from System.Collections.Generic import List

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

angle = IN[0]
point = IN[1]
viewType = UnwrapElement(IN[2])

point = point.ToXyz()

Px = point.X
Py = point.Y
Pz = point.Z

p = XYZ(Px, Py, Pz)
q = XYZ(Px, Py, Pz + 1)

line = Line.CreateBound(p,q)

TransactionManager.Instance.EnsureInTransaction(doc)

#Create elevation marker and elevation in position 0.
eleMarker = ElevationMarker.CreateElevationMarker(doc, viewType.Id, point, 100)
ele = eleMarker.CreateElevation(doc, doc.ActiveView.Id , 0)
		
#Rotate elevation marker towars model line.
rot = ElementTransformUtils.RotateElement(doc, eleMarker.Id, line, angle)


TransactionManager.Instance.TransactionTaskDone()

OUT = ele
1 Like

Like I said, I showed you the way to rotate the element, but you needed to change the inputs, it was just a generic case with axis of rotation at the origin.

And this was not even what you asked in the topic: get elevation marker from elevation view.
If you want to split your problem in smaller topics it’s great, but keep them separated.

It’s like if I ask: How much is 2+2?
Someone replies: 4
And I say: no, sorry, this is wrong, because I need to do 2+2 -3, so the solution is 1.

However glad you found the solution, feel free to mark it as your solution as always :wink:

1 Like

The merit of the solution of this problem is all yours and @Alban_de_Chasteigner

I have near zero knowledge on the Revit API.
I marked my post as the solution because it goes straight to the point. So, if someone is looking in the forum for the answer of this problem. He will find it more directly,

Once again, you helped me a lot @lucamanzoni.
I owe you and this forum a lot

Thanks

1 Like

Hi, I am trying to use this script but I get the following
image
Would you be able to help, kindly?
Thanks

I think that your current view is not a plan view.
In order to run this code you must close the dynamo script, change to a plan view, open dynamo and run the script.

Am on a plan view.