Normal Direction of Specific View

Hello,

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:
https://apidocs.co/apps/revit/2021.1/f93840a2-e22b-937f-a10b-a379ebbb2375.htm

import clr

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

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

#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”.