Extract position coordinates (XYZ) of door/window by Clicking on it

200 views
Skip to first unread message

Dr Ilyas Meo

unread,
Aug 14, 2020, 2:17:00 AM8/14/20
to RevitPythonShell
Hi Developers!
I,m using revitPythonShell to extract position of doors using this script:

"  from Autodesk.Revit.DB import FilteredElementCollector as Fec

   from Autodesk.Revit.DB import BuiltInCategory as Bic

  doors = Fec(doc).OfCategory(Bic.OST_Doors).\
           WhereElementIsNotElementType().ToElements()
  print(doors)
  for door in doors:
       print(15*"-")
       print(door.Id)
       print(door.Location.Point)   
".

Now i,m curious how I can get these coordinates JUST BY CLICKING on a door in Revit?

any help?

regards!

ILYAS ( my whatsApp: +6590564435)

Steve Marentette

unread,
Oct 13, 2020, 4:42:21 PM10/13/20
to RevitPythonShell
Select doors or any other elements first then run the script below in RPS. 

import Autodesk

doc = __revit__.ActiveUIDocument.Document
uidoc = __revit__.ActiveUIDocument

#picked_doors = uidoc.Selection.PickObjects(Autodesk.Revit.UI.Selection.ObjectType.Element)
picked_doors = uidoc.Selection.GetElementIds() 
doors=[] 
for p in picked_doors:
    door= doc.GetElement(p)
    if door:
        doors.append(door)

for door in doors:
    print(15*"-")
    print(door.Id)
    print(door.Location.Point)

Reply all
Reply to author
Forward
0 new messages