Skip to content

Commit c6075e9

Browse files
authored
Merge pull request #74 from architecture-building-systems/feature/cleanups
Project directory cleanups for clarity
2 parents eadf235 + f74db04 commit c6075e9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+3160
-3141
lines changed

RevitPythonShell.sln

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 15
4-
VisualStudioVersion = 15.0.26228.12
4+
VisualStudioVersion = 15.0.27130.2036
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RevitPythonShell", "RevitPythonShell\RevitPythonShell.csproj", "{7E37F14E-D840-42F8-8CA6-90FFC5497972}"
77
ProjectSection(ProjectDependencies) = postProject
@@ -11,13 +11,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RevitPythonShell", "RevitPy
1111
EndProject
1212
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PythonConsoleControl", "PythonConsoleControl\PythonConsoleControl.csproj", "{F1152D68-346B-4F48-8DB7-BE67B5CB1F49}"
1313
EndProject
14-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{84677A26-E049-48B3-AFB0-3B3F99955849}"
15-
ProjectSection(SolutionItems) = preProject
16-
Setup_RevitPythonShell_2014.iss = Setup_RevitPythonShell_2014.iss
17-
Setup_RevitPythonShell_Vasari_Beta1.iss = Setup_RevitPythonShell_Vasari_Beta1.iss
18-
Setup_RevitPythonShell_Vasari_Beta2.iss = Setup_RevitPythonShell_Vasari_Beta2.iss
19-
EndProjectSection
20-
EndProject
2114
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RpsRuntime", "RpsRuntime\RpsRuntime.csproj", "{C8446636-C663-409F-82D0-72C0D55BBA1C}"
2215
EndProject
2316
Global
@@ -63,6 +56,9 @@ Global
6356
GlobalSection(SolutionProperties) = preSolution
6457
HideSolutionNode = FALSE
6558
EndGlobalSection
59+
GlobalSection(ExtensibilityGlobals) = postSolution
60+
SolutionGuid = {8E6A5A3B-CCC1-402D-9D4B-989DE2CEB738}
61+
EndGlobalSection
6662
GlobalSection(SubversionScc) = preSolution
6763
Svn-Managed = True
6864
Manager = AnkhSVN - Subversion Support for Visual Studio
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
<?xml version="1.0" encoding="utf-8" ?>
2-
<RevitPythonShell>
3-
<SearchPaths>
4-
<!-- a list of paths to add to the engines search path -->
5-
</SearchPaths>
6-
<Variables>
7-
<!-- a list of string variables to add to the scope -->
8-
</Variables>
9-
<Commands>
10-
<!-- a list of preconfigured commands -->
11-
</Commands>
12-
<InitScript src="init.py"/>
13-
<StartupScript src="startup.py"/>
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<RevitPythonShell>
3+
<SearchPaths>
4+
<!-- a list of paths to add to the engines search path -->
5+
</SearchPaths>
6+
<Variables>
7+
<!-- a list of string variables to add to the scope -->
8+
</Variables>
9+
<Commands>
10+
<!-- a list of preconfigured commands -->
11+
</Commands>
12+
<InitScript src="init.py"/>
13+
<StartupScript src="startup.py"/>
1414
</RevitPythonShell>
Lines changed: 94 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,94 @@
1-
# these commands get executed in the current scope
2-
# of each new shell (but not for canned commands)
3-
from Autodesk.Revit.DB import *
4-
from Autodesk.Revit.DB.Architecture import *
5-
from Autodesk.Revit.DB.Analysis import *
6-
7-
uidoc = __revit__.ActiveUIDocument
8-
doc = __revit__.ActiveUIDocument.Document
9-
10-
from Autodesk.Revit.UI import TaskDialog
11-
from Autodesk.Revit.UI import UIApplication
12-
13-
14-
def alert(msg):
15-
TaskDialog.Show('RevitPythonShell', msg)
16-
17-
18-
def quit():
19-
__window__.Close()
20-
exit = quit
21-
22-
23-
def get_selected_elements(doc):
24-
"""API change in Revit 2016 makes old method throw an error"""
25-
try:
26-
# Revit 2016
27-
return [doc.GetElement(id)
28-
for id in __revit__.ActiveUIDocument.Selection.GetElementIds()]
29-
except:
30-
# old method
31-
return list(__revit__.ActiveUIDocument.Selection.Elements)
32-
selection = get_selected_elements(doc)
33-
# convenience variable for first element in selection
34-
if len(selection):
35-
s0 = selection[0]
36-
37-
#------------------------------------------------------------------------------
38-
import clr
39-
from Autodesk.Revit.DB import ElementSet, ElementId
40-
41-
class RevitLookup(object):
42-
def __init__(self, uiApplication):
43-
'''
44-
for RevitSnoop to function properly, it needs to be instantiated
45-
with a reference to the Revit Application object.
46-
'''
47-
# find the RevitLookup plugin
48-
try:
49-
rlapp = [app for app in uiApplication.LoadedApplications
50-
if app.GetType().Namespace == 'RevitLookup'
51-
and app.GetType().Name == 'App'][0]
52-
except IndexError:
53-
self.RevitLookup = None
54-
return
55-
# tell IronPython about the assembly of the RevitLookup plugin
56-
clr.AddReference(rlapp.GetType().Assembly)
57-
import RevitLookup
58-
self.RevitLookup = RevitLookup
59-
# See note in CollectorExt.cs in the RevitLookup source:
60-
self.RevitLookup.Snoop.CollectorExts.CollectorExt.m_app = uiApplication
61-
self.revit = uiApplication
62-
63-
def lookup(self, element):
64-
if not self.RevitLookup:
65-
print 'RevitLookup not installed. Visit https://github.com/jeremytammik/RevitLookup to install.'
66-
return
67-
if isinstance(element, int):
68-
element = self.revit.ActiveUIDocument.Document.GetElement(ElementId(element))
69-
if isinstance(element, ElementId):
70-
element = self.revit.ActiveUIDocument.Document.GetElement(element)
71-
if isinstance(element, list):
72-
elementSet = ElementSet()
73-
for e in element:
74-
elementSet.Insert(e)
75-
element = elementSet
76-
form = self.RevitLookup.Snoop.Forms.Objects(element)
77-
form.ShowDialog()
78-
_revitlookup = RevitLookup(__revit__)
79-
def lookup(element):
80-
_revitlookup.lookup(element)
81-
82-
#------------------------------------------------------------------------------
83-
84-
# a fix for the __window__.Close() bug introduced with the non-modal console
85-
class WindowWrapper(object):
86-
def __init__(self, win):
87-
self.win = win
88-
89-
def Close(self):
90-
self.win.Dispatcher.Invoke(lambda *_: self.win.Close())
91-
92-
def __getattr__(self, name):
93-
return getattr(self.win, name)
94-
__window__ = WindowWrapper(__window__)
1+
# these commands get executed in the current scope
2+
# of each new shell (but not for canned commands)
3+
from Autodesk.Revit.DB import *
4+
from Autodesk.Revit.DB.Architecture import *
5+
from Autodesk.Revit.DB.Analysis import *
6+
7+
uidoc = __revit__.ActiveUIDocument
8+
doc = __revit__.ActiveUIDocument.Document
9+
10+
from Autodesk.Revit.UI import TaskDialog
11+
from Autodesk.Revit.UI import UIApplication
12+
13+
14+
def alert(msg):
15+
TaskDialog.Show('RevitPythonShell', msg)
16+
17+
18+
def quit():
19+
__window__.Close()
20+
exit = quit
21+
22+
23+
def get_selected_elements(doc):
24+
"""API change in Revit 2016 makes old method throw an error"""
25+
try:
26+
# Revit 2016
27+
return [doc.GetElement(id)
28+
for id in __revit__.ActiveUIDocument.Selection.GetElementIds()]
29+
except:
30+
# old method
31+
return list(__revit__.ActiveUIDocument.Selection.Elements)
32+
selection = get_selected_elements(doc)
33+
# convenience variable for first element in selection
34+
if len(selection):
35+
s0 = selection[0]
36+
37+
#------------------------------------------------------------------------------
38+
import clr
39+
from Autodesk.Revit.DB import ElementSet, ElementId
40+
41+
class RevitLookup(object):
42+
def __init__(self, uiApplication):
43+
'''
44+
for RevitSnoop to function properly, it needs to be instantiated
45+
with a reference to the Revit Application object.
46+
'''
47+
# find the RevitLookup plugin
48+
try:
49+
rlapp = [app for app in uiApplication.LoadedApplications
50+
if app.GetType().Namespace == 'RevitLookup'
51+
and app.GetType().Name == 'App'][0]
52+
except IndexError:
53+
self.RevitLookup = None
54+
return
55+
# tell IronPython about the assembly of the RevitLookup plugin
56+
clr.AddReference(rlapp.GetType().Assembly)
57+
import RevitLookup
58+
self.RevitLookup = RevitLookup
59+
# See note in CollectorExt.cs in the RevitLookup source:
60+
self.RevitLookup.Snoop.CollectorExts.CollectorExt.m_app = uiApplication
61+
self.revit = uiApplication
62+
63+
def lookup(self, element):
64+
if not self.RevitLookup:
65+
print 'RevitLookup not installed. Visit https://github.com/jeremytammik/RevitLookup to install.'
66+
return
67+
if isinstance(element, int):
68+
element = self.revit.ActiveUIDocument.Document.GetElement(ElementId(element))
69+
if isinstance(element, ElementId):
70+
element = self.revit.ActiveUIDocument.Document.GetElement(element)
71+
if isinstance(element, list):
72+
elementSet = ElementSet()
73+
for e in element:
74+
elementSet.Insert(e)
75+
element = elementSet
76+
form = self.RevitLookup.Snoop.Forms.Objects(element)
77+
form.ShowDialog()
78+
_revitlookup = RevitLookup(__revit__)
79+
def lookup(element):
80+
_revitlookup.lookup(element)
81+
82+
#------------------------------------------------------------------------------
83+
84+
# a fix for the __window__.Close() bug introduced with the non-modal console
85+
class WindowWrapper(object):
86+
def __init__(self, win):
87+
self.win = win
88+
89+
def Close(self):
90+
self.win.Dispatcher.Invoke(lambda *_: self.win.Close())
91+
92+
def __getattr__(self, name):
93+
return getattr(self.win, name)
94+
__window__ = WindowWrapper(__window__)
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# script that is run when Revit starts in the IExternalApplication.Startup event.
2-
try:
3-
# add your code here
4-
# ...
5-
__window__.Close() # closes the window
6-
except:
7-
import traceback # note: add a python27 library to your search path first!
1+
# script that is run when Revit starts in the IExternalApplication.Startup event.
2+
try:
3+
# add your code here
4+
# ...
5+
__window__.Close() # closes the window
6+
except:
7+
import traceback # note: add a python27 library to your search path first!
88
traceback.print_exc() # helps you debug when things go wrong

RevitPythonShell/Images/Thumbs.db

-9 KB
Binary file not shown.

RevitPythonShell/Properties/AssemblyInfo.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
[assembly: AssemblyConfiguration("")]
1111
[assembly: AssemblyCompany("")]
1212
[assembly: AssemblyProduct("RevitPythonShell")]
13-
[assembly: AssemblyCopyright("Copyright © 2009")]
13+
[assembly: AssemblyCopyright("Copyright © 2018")]
1414
[assembly: AssemblyTrademark("")]
1515
[assembly: AssemblyCulture("")]
1616

@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("2017.0.0.0")]
36-
[assembly: AssemblyFileVersion("2017.0.0.0")]
35+
[assembly: AssemblyVersion("2018.1.0.0")]
36+
[assembly: AssemblyFileVersion("2018.1.0.0")]
-631 Bytes
Binary file not shown.
-1.78 KB
Binary file not shown.
-855 Bytes
Binary file not shown.
-1.76 KB
Binary file not shown.

0 commit comments

Comments
 (0)