Normal Direction of Specific View


I’d like to create outline curves of a solid depending on the view that I am viewing the object in. I can create a plane at the centroid, but I want the normal to be oriented towards the view I am in. What is the best way to do this?

Essentially, I will want to use the geometry.intersects node with the object and the plane, but I need the plane to be oriented correctly first.

You could play around a bit with the properties of views in the Revit API, if you don’t mind getting your hands “dirty”. :slight_smile:

import clr

from Autodesk.Revit.DB import *

import Revit

#Preparing input from dynamo to revit
view = UnwrapElement(IN[0])

OUT = view.UpDirection.ToVector()

Thanks so much. This is my first time working in Python and it worked ALMOST perfectly. The created plane is not facing the view but is perpendicular to the view. What would be the easiest way to rotate that? I can’t rotate it around a specific axis, because it would be different depending on the view.

If I were you, I’d first find the vector of each image, then I’d use a fixed vector to find the angle between the two vectors using “Vector.Dot”.
Then I would rotate the object I wanted to rotate with “Element.SetRotation”.