Get Click location in 2D view

Hi all,

I was wondering if it was possible to get the 2D location((x,y) or (x,z) or (y,z)) of a click in a Revit 2D view). It would be wonderful I think !

Does anyone has any idea ?

Thank you so much

Hello @baud.dem

an example with Python, then you can filter coordinates X, Y, Z

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

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

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

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

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

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

TaskDialog.Show("Info", "Pick Point and press Escap to finish")

outPt = []
flag = True
while flag:
	try:
		pt = uidoc.Selection.PickPoint("Pick Point and press Escap to finish")
		outPt.append(pt.ToPoint())
	except:
		flag = False
		break

OUT = outPt
6 Likes

Thank you Cyril !
It works perfectly in plan, it is amazing.

It doesnt look to work in section or elevations. In these views the script doesn’t even wait for the clicks and finish immediatly after closing the “info” window. I will try to figure this out :slight_smile:.

Tell me if you think to know a solution @c.poupin, but really thank you it is so cool and easy. I was trying by downloading Python library into Dyanmo and stuffs but your solution is so easiiiiier !

1 Like

Bad news… Look that it is a Revit exception… The PickPoint function looks to only work on plans… not on section.

But the funny part is that it works in 3D as long as your are not from above. And all the points are oviously on the based plane of the 3D views.

1 Like

To pick points in section views, have a look here.
Is it possible to prompt pickpoint in revit section view from dynamo? :slightly_smiling_face:

1 Like

Thank you Ewan_opie ! Nice tip :slight_smile:
It worked well. Really cool !

1 Like