forked from pyrevitlabs/pyRevit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShell_Init.py
More file actions
37 lines (32 loc) · 1018 Bytes
/
Copy pathShell_Init.py
File metadata and controls
37 lines (32 loc) · 1018 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# these commands get executed in the current scope
# of each new shell (but not for canned commands)
#pylint: disable=all
import clr
clr.AddReferenceByPartialName('PresentationCore')
clr.AddReferenceByPartialName('AdWindows')
clr.AddReferenceByPartialName("PresentationFramework")
clr.AddReferenceByPartialName('System')
clr.AddReferenceByPartialName('System.Windows.Forms')
from Autodesk.Revit import DB
from Autodesk.Revit import UI
import Autodesk.Windows as aw
# creates variables for selected elements in global scope
# e1, e2, ...
max_elements = 5
gdict = globals()
uiapp = __revit__
uidoc = uiapp.ActiveUIDocument
if uidoc:
doc = uiapp.ActiveUIDocument.Document
selection = [doc.GetElement(x) for x in uidoc.Selection.GetElementIds()]
for idx, el in enumerate(selection):
if idx < max_elements:
gdict['e{}'.format(idx+1)] = el
else:
break
# alert function
def alert(msg):
TaskDialog.Show('RPS', msg)
# quit function
def quit():
__window__.Close()