# Get Click Location in 2D Views

**URL:** <https://forum.dynamobim.com/t/get-click-location-in-2d-views/84621>\
**Category:** Uncategorized\
**Created:** [January 4, 2023, 3:20am UTC](https://forum.dynamobim.com/t/get-click-location-in-2d-views/84621 "2023-01-04T03:20:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jin](https://avatars.discourse-cdn.com/v4/letter/j/4af34b/32.png) [@Jin](https://forum.dynamobim.com/u/Jin)\
**Post date:** [January 4, 2023, 3:20am UTC](https://forum.dynamobim.com/t/get-click-location-in-2d-views/84621/1 "2023-01-04T03:20:20Z")

</div>

> [@Get Click location in 2D view](https://forum.dynamobim.com/t/get-click-location-in-2d-view/54749):
>
> 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

In another post, I found that “uidoc.Selection.PickPoint” just works on Floor plan view.  
Is there anyway to get point in RCP, Elevation, Section?

---

<div class="post-metadata">

**Author:** ![Mark.Ackerley](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mark.ackerley/32/79310_2.png) [@Mark.Ackerley](https://forum.dynamobim.com/u/Mark.Ackerley)\
**Post date:** [January 4, 2023, 9:12am UTC](https://forum.dynamobim.com/t/get-click-location-in-2d-views/84621/2 "2023-01-04T09:12:25Z")

</div>

Hey,

There’s a link to a work around where you generate a workplane from a sketchplane created from the section / elevation view…

> [@Is it possible to prompt pickpoint in revit section view from dynamo?](https://forum.dynamobim.com/t/is-it-possible-to-prompt-pickpoint-in-revit-section-view-from-dynamo/19620/3):
>
> Use the :snowflake:\_Set Sketchplane By View node and then the :snowflake:\_Pick Points on Workplane from the Sastrugi package, as it uses the same Pickpoint method with a reset function. Setting the sketchplane when the Active view is the sheet before picking the points should do the trick wink You can use the Passthrough node from the Clockwork package to force the run order.

I presume that doesn’t work for you? Could you give a little detail 🙂 ?

Kind regards,

Mark

---

<div class="post-metadata">

**Author:** ![Jin](https://avatars.discourse-cdn.com/v4/letter/j/4af34b/32.png) [@Jin](https://forum.dynamobim.com/u/Jin)\
**Post date:** [January 4, 2023, 9:19am UTC](https://forum.dynamobim.com/t/get-click-location-in-2d-views/84621/3 "2023-01-04T09:19:19Z")

</div>

Can we create a workplane by current active view itself?  
And is there any function in python to Pickpoint on workplane?  
I’m so afraid of using external packages. It often gets errors, conflicts,…

---

<div class="post-metadata">

**Author:** ![Mark.Ackerley](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mark.ackerley/32/79310_2.png) [@Mark.Ackerley](https://forum.dynamobim.com/u/Mark.Ackerley)\
**Post date:** [January 4, 2023, 9:29am UTC](https://forum.dynamobim.com/t/get-click-location-in-2d-views/84621/4 "2023-01-04T09:29:37Z")

</div>

Hey,

You can dig around in @Ewan_Opie’s code and have a look if you don’t want to use the package directly.

Here’s kind of what the code would look like, I haven’t tested it, but hopefully it gives you an idea…

Hope that helps,

Mark

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

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

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

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

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application 

origin = doc.ActiveView.Origin
normal = doc.ActiveView.ViewDirection

TransactionManager.Instance.EnsureInTransaction(doc)

plane = Autodesk.Revit.DB.Plane.CreateByNormalAndOrigin(normal,origin)
doc.ActiveView.SketchPlane = sp
pickPoint = doc.Selection.PickPoint()

TransactionManager.Instance.TransactionTaskDone()

OUT = sp

```

---

<div class="post-metadata">

**Author:** ![Jin](https://avatars.discourse-cdn.com/v4/letter/j/4af34b/32.png) [@Jin](https://forum.dynamobim.com/u/Jin)\
**Post date:** [January 5, 2023, 1:38am UTC](https://forum.dynamobim.com/t/get-click-location-in-2d-views/84621/5 "2023-01-05T01:38:51Z")

</div>

> [@Mark.Ackerley](#):
>
> Mark

Thank you very much! I got your idea. I try it now!

---

<div class="post-metadata">

**Author:** ![Jin](https://avatars.discourse-cdn.com/v4/letter/j/4af34b/32.png) [@Jin](https://forum.dynamobim.com/u/Jin)\
**Post date:** [January 5, 2023, 2:23am UTC](https://forum.dynamobim.com/t/get-click-location-in-2d-views/84621/6 "2023-01-05T02:23:44Z")

</div>

Some edited line:  
Add uidoc  
Add sp creating  
Selection.PickPoint work with uidoc  
Thank you very much!

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

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

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

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

doc = DocumentManager.Instance.CurrentDBDocument
# --------------add Active UI Document
uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application 

origin = doc.ActiveView.Origin
normal = doc.ActiveView.ViewDirection

TransactionManager.Instance.EnsureInTransaction(doc)

plane = Autodesk.Revit.DB.Plane.CreateByNormalAndOrigin(normal,origin)
# ------------Add sp creating
sp = SketchPlane.Create(doc,plane)
doc.ActiveView.SketchPlane = sp
# ------------Selection Pickpoint workwith 'uidoc'
pickPoint = uidoc.Selection.PickPoint()

TransactionManager.Instance.TransactionTaskDone()

OUT = sp

```
