diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 000000000..e69de29bb
diff --git a/.github/issue_template.md b/.github/issue_template.md
new file mode 100644
index 000000000..f2faf42c5
--- /dev/null
+++ b/.github/issue_template.md
@@ -0,0 +1,9 @@
+### Issue Description
+
+Replace these lines with your description. Be as specific as possible and list steps to reproduce the issue. If you have any suggestions for the solution please list that as well.
+
+### Environment
+
+Open a command prompt and run the command below. Replace these lines with the results. Take a look at this markdown guide and wrap the command results in ``` when pasting here for correct formatting.
+
+`pyrevit env`
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
new file mode 100644
index 000000000..683557030
--- /dev/null
+++ b/CODE_OF_CONDUCT.md
@@ -0,0 +1,76 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as
+contributors and maintainers pledge to making participation in our project and
+our community a harassment-free experience for everyone, regardless of age, body
+size, disability, ethnicity, sex characteristics, gender identity and expression,
+level of experience, education, socio-economic status, nationality, personal
+appearance, race, religion, or sexual identity and orientation.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment
+include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or
+ advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic
+ address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+ professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable
+behavior and are expected to take appropriate and fair corrective action in
+response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or
+reject comments, commits, code, wiki edits, issues, and other contributions
+that are not aligned to this Code of Conduct, or to ban temporarily or
+permanently any contributor for other behaviors that they deem inappropriate,
+threatening, offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies both within project spaces and in public spaces
+when an individual is representing the project or its community. Examples of
+representing a project or community include using an official project e-mail
+address, posting via an official social media account, or acting as an appointed
+representative at an online or offline event. Representation of a project may be
+further defined and clarified by project maintainers.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported by contacting the project team at eirannejad@gmail.com. All
+complaints will be reviewed and investigated and will result in a response that
+is deemed necessary and appropriate to the circumstances. The project team is
+obligated to maintain confidentiality with regard to the reporter of an incident.
+Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good
+faith may face temporary or permanent repercussions as determined by other
+members of the project's leadership.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
+available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
+
+[homepage]: https://www.contributor-covenant.org
+
+For answers to common questions about this code of conduct, see
+https://www.contributor-covenant.org/faq
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 000000000..e69de29bb
diff --git a/CREDITS.txt b/CREDITS.txt
new file mode 100644
index 000000000..e69de29bb
diff --git a/bin/NLog.dll b/bin/NLog.dll
index 2e6ba44fc..89afd0c5f 100644
Binary files a/bin/NLog.dll and b/bin/NLog.dll differ
diff --git a/bin/pyRevitLabs.Common.dll b/bin/pyRevitLabs.Common.dll
index 23198e5e9..22a37ea98 100644
Binary files a/bin/pyRevitLabs.Common.dll and b/bin/pyRevitLabs.Common.dll differ
diff --git a/bin/pyRevitLabs.Common.pdb b/bin/pyRevitLabs.Common.pdb
index 8bb935f68..032adeb65 100644
Binary files a/bin/pyRevitLabs.Common.pdb and b/bin/pyRevitLabs.Common.pdb differ
diff --git a/bin/pyRevitLabs.CommonCLI.dll b/bin/pyRevitLabs.CommonCLI.dll
index 308587ec0..d832a1f22 100644
Binary files a/bin/pyRevitLabs.CommonCLI.dll and b/bin/pyRevitLabs.CommonCLI.dll differ
diff --git a/bin/pyRevitLabs.CommonCLI.pdb b/bin/pyRevitLabs.CommonCLI.pdb
index 41025006d..b20eb4052 100644
Binary files a/bin/pyRevitLabs.CommonCLI.pdb and b/bin/pyRevitLabs.CommonCLI.pdb differ
diff --git a/bin/pyRevitLabs.CommonWPF.dll b/bin/pyRevitLabs.CommonWPF.dll
index 1ececfa11..72636fc0a 100644
Binary files a/bin/pyRevitLabs.CommonWPF.dll and b/bin/pyRevitLabs.CommonWPF.dll differ
diff --git a/bin/pyRevitLabs.CommonWPF.pdb b/bin/pyRevitLabs.CommonWPF.pdb
index 722192faa..c8c8cd194 100644
Binary files a/bin/pyRevitLabs.CommonWPF.pdb and b/bin/pyRevitLabs.CommonWPF.pdb differ
diff --git a/bin/pyRevitLabs.Language.dll b/bin/pyRevitLabs.Language.dll
index 0b39d62c2..1739bdf20 100644
Binary files a/bin/pyRevitLabs.Language.dll and b/bin/pyRevitLabs.Language.dll differ
diff --git a/bin/pyRevitLabs.Language.pdb b/bin/pyRevitLabs.Language.pdb
index 2e5405801..ce6a77332 100644
Binary files a/bin/pyRevitLabs.Language.pdb and b/bin/pyRevitLabs.Language.pdb differ
diff --git a/bin/pyRevitLabs.TargetApps.Revit.dll b/bin/pyRevitLabs.TargetApps.Revit.dll
index 2877fbd87..47f7c3cef 100644
Binary files a/bin/pyRevitLabs.TargetApps.Revit.dll and b/bin/pyRevitLabs.TargetApps.Revit.dll differ
diff --git a/bin/pyRevitLabs.TargetApps.Revit.pdb b/bin/pyRevitLabs.TargetApps.Revit.pdb
index 207232f43..83ec29888 100644
Binary files a/bin/pyRevitLabs.TargetApps.Revit.pdb and b/bin/pyRevitLabs.TargetApps.Revit.pdb differ
diff --git a/bin/pyRevitUpdater.exe b/bin/pyRevitUpdater.exe
index 6cbd72de1..d2589750d 100644
Binary files a/bin/pyRevitUpdater.exe and b/bin/pyRevitUpdater.exe differ
diff --git a/bin/pyrevit.exe b/bin/pyrevit.exe
index 0ba602350..22aa35b0e 100644
Binary files a/bin/pyrevit.exe and b/bin/pyrevit.exe differ
diff --git a/bin/pyrevit.pdb b/bin/pyrevit.pdb
index fe7fdc5c6..c9ba213ab 100644
Binary files a/bin/pyrevit.pdb and b/bin/pyrevit.pdb differ
diff --git a/dev/WPFEdit/WPFEdit/WPFEdit.csproj b/dev/WPFEdit/WPFEdit/WPFEdit.csproj
index a173567d9..222fd0b01 100644
--- a/dev/WPFEdit/WPFEdit/WPFEdit.csproj
+++ b/dev/WPFEdit/WPFEdit/WPFEdit.csproj
@@ -172,6 +172,16 @@
MSBuild:Compile
Designer
+
+ Forms\ImageListContainerStyle.xaml
+ MSBuild:Compile
+ Designer
+
+
+ Forms\ImageListPanelStyle.xaml
+ MSBuild:Compile
+ Designer
+
Forms\ProgressBar.xaml
MSBuild:Compile
@@ -187,6 +197,11 @@
MSBuild:Compile
Designer
+
+ Forms\SwatchContainerStyle.xaml
+ MSBuild:Compile
+ Designer
+
Forms\TemplatePromptBar.xaml
MSBuild:Compile
diff --git a/extensions/pyRevitCore.extension/pyRevit.tab/pyRevit.panel/tools.stack3/Spy.pulldown/List Elements.pushbutton/script.py b/extensions/pyRevitCore.extension/pyRevit.tab/pyRevit.panel/tools.stack3/Spy.pulldown/List Elements.pushbutton/script.py
index 8ff2e1233..7d9ca748b 100644
--- a/extensions/pyRevitCore.extension/pyRevit.tab/pyRevit.panel/tools.stack3/Spy.pulldown/List Elements.pushbutton/script.py
+++ b/extensions/pyRevitCore.extension/pyRevit.tab/pyRevit.panel/tools.stack3/Spy.pulldown/List Elements.pushbutton/script.py
@@ -2,6 +2,7 @@
#pylint: disable=C0103,E0401,W0703
from collections import defaultdict
+from pyrevit import HOST_APP
from pyrevit.framework import List
from pyrevit import coreutils
from pyrevit import revit, DB, UI
@@ -244,8 +245,8 @@
'AREA ID: {2} '
'LEVEL: {3} '
'AREA: {4}'
- .format(el.LookupParameter('Name').AsString().ljust(30),
- el.LookupParameter('Number').AsString().ljust(10),
+ .format(el.Parameter[DB.BuiltInParameter.ROOM_NAME].AsString().ljust(30),
+ el.Parameter[DB.BuiltInParameter.ROOM_NUMBER].AsString().ljust(10),
el.Id,
str(el.Level.Name).ljust(50),
el.Area))
@@ -261,8 +262,8 @@
print('ROOM NAME: {0} '
'ROOM NUMBER: {1} '
'ROOM ID: {2}'
- .format(el.LookupParameter('Name').AsString().ljust(30),
- el.LookupParameter('Number').AsString().ljust(20),
+ .format(el.Parameter[DB.BuiltInParameter.ROOM_NAME].AsString().ljust(30),
+ el.Parameter[DB.BuiltInParameter.ROOM_NUMBER].AsString().ljust(20),
el.Id))
print('\n\nTOTAL ROOMS FOUND: {0}'.format(len(roomlist)))
@@ -302,8 +303,8 @@
for s in sheets:
print('NUMBER: {0} '
'NAME:{1}'
- .format(s.LookupParameter('Sheet Number').AsString().rjust(10),
- s.LookupParameter('Sheet Name').AsString().ljust(50)))
+ .format(s.Parameter[DB.BuiltInParameter.SHEET_NUMBER].AsString().rjust(10),
+ s.Parameter[DB.BuiltInParameter.SHEET_NAME].AsString().ljust(50)))
elif selected_switch == 'System Categories':
for cat in revit.doc.Settings.Categories:
@@ -337,22 +338,34 @@
views.append(el)
for v in views:
- phasep = v.LookupParameter('Phase')
- underlayp = v.LookupParameter('Underlay')
- print('TYPE: {1}'
- 'ID: {2}'
- 'TEMPLATE: {3}'
- 'PHASE:{4} '
- 'UNDERLAY:{5} '
- '{0}'
- .format(v.ViewName,
- str(v.ViewType).ljust(20),
- str(v.Id).ljust(10),
- str(v.IsTemplate).ljust(10),
- phasep.AsValueString().ljust(25)
- if phasep else '---'.ljust(25),
- underlayp.AsValueString().ljust(25)
- if underlayp else '---'.ljust(25)))
+ phasep = v.Parameter[DB.BuiltInParameter.VIEW_PHASE]
+ if HOST_APP.is_older_than(2016):
+ underlayp = v.Parameter[DB.BuiltInParameter.VIEW_UNDERLAY_ID]
+ print('TYPE: {1} ID: {2} TEMPLATE: {3} PHASE:{4} UNDERLAY:{5} {0}'
+ .format(v.ViewName,
+ str(v.ViewType).ljust(20),
+ str(v.Id).ljust(10),
+ str(v.IsTemplate).ljust(10),
+ phasep.AsValueString().ljust(25)
+ if phasep else '---'.ljust(25),
+ underlayp.AsValueString().ljust(25)
+ if underlayp else '---'.ljust(25)))
+ else:
+ underlaytp = v.Parameter[DB.BuiltInParameter.VIEW_UNDERLAY_TOP_ID]
+ underlaybp = \
+ v.Parameter[DB.BuiltInParameter.VIEW_UNDERLAY_BOTTOM_ID]
+ print('TYPE: {1} ID: {2} TEMPLATE: {3} PHASE:{4} '
+ 'UNDERLAY TOP:{5} UNDERLAY BOTTOM:{6} {0}'
+ .format(v.ViewName,
+ str(v.ViewType).ljust(20),
+ str(v.Id).ljust(10),
+ str(v.IsTemplate).ljust(10),
+ phasep.AsValueString().ljust(25)
+ if phasep else '---'.ljust(25),
+ underlaytp.AsValueString().ljust(25)
+ if underlaytp else '---'.ljust(25),
+ underlaybp.AsValueString().ljust(25)
+ if underlaybp else '---'.ljust(25)))
elif selected_switch == 'View Templates':
cl_views = DB.FilteredElementCollector(revit.doc)
@@ -472,10 +485,8 @@ def isline(line):
elif selected_switch == 'Point Cloud Instances':
for pc in revit.query.get_pointclouds(doc=revit.doc):
- print('Name: {}\tWorkset:{}'.format(
- pc.Name,
- pc.LookupParameter('Workset').AsValueString())
- )
+ ws = revit.doc.GetElement(pc.WorksetId)
+ print('Name: {}\tWorkset:{}'.format(pc.Name, ws.Name if ws else '---'))
elif selected_switch == 'Sheets with Hidden Characters':
for sheet in revit.query.get_sheets(doc=revit.doc):
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Appdata Module Tests.pushbutton/icon.png b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Appdata Module Tests.pushbutton/icon.png
new file mode 100644
index 000000000..1729ae3ac
Binary files /dev/null and b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Appdata Module Tests.pushbutton/icon.png differ
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Appdata Module Tests.pushbutton/script.py b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Appdata Module Tests.pushbutton/script.py
new file mode 100644
index 000000000..77bd71d30
--- /dev/null
+++ b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Appdata Module Tests.pushbutton/script.py
@@ -0,0 +1,59 @@
+"""Unit Tests for pyrevit.coreutils.appdata module."""
+#pylint: disable=E0401
+import re
+
+import pyrevit
+from pyrevit.coreutils import appdata
+
+
+__context__ = 'zerodoc'
+
+
+TEST_STRINGS = ['pyRevit_some-randomename',
+ 'pyRevit_2018_some-randomename',
+ 'pyRevit_2018_14422_some-randomname',
+ 'pyRevit_eirannejad_some-randomename',
+ 'pyRevit_2018_eirannejad_some-randomename',
+ 'pyRevit_2018_eirannejad_14422_some-randomename']
+
+for tstring in TEST_STRINGS:
+ print('Testing: "{}"'.format(tstring))
+
+ # e.g. pyRevit_2018_eirannejad_14422_
+ m = re.match(pyrevit.PYREVIT_FILE_PREFIX_STAMPED_USER_REGEX, tstring)
+ if m:
+ print('\tMatched: {}'.format(
+ pyrevit.PYREVIT_FILE_PREFIX_STAMPED_USER_REGEX))
+ print('\t' + str(m.groupdict()))
+
+ # e.g. pyRevit_2018_14422_
+ m = re.match(pyrevit.PYREVIT_FILE_PREFIX_STAMPED_REGEX, tstring)
+ if m:
+ print('\tMatched: {}'.format(pyrevit.PYREVIT_FILE_PREFIX_STAMPED_REGEX))
+ print('\t' + str(m.groupdict()))
+
+ # e.g. pyRevit_2018_eirannejad_
+ m = re.match(pyrevit.PYREVIT_FILE_PREFIX_USER_REGEX, tstring)
+ if m:
+ print('\tMatched: {}'.format(pyrevit.PYREVIT_FILE_PREFIX_USER_REGEX))
+ print('\t' + str(m.groupdict()))
+
+ # e.g. pyRevit_2018_
+ m = re.match(pyrevit.PYREVIT_FILE_PREFIX_REGEX, tstring)
+ if m:
+ print('\tMatched: {}'.format(pyrevit.PYREVIT_FILE_PREFIX_REGEX))
+ print('\t' + str(m.groupdict()))
+
+ # e.g. pyRevit_eirannejad_
+ m = re.match(pyrevit.PYREVIT_FILE_PREFIX_UNIVERSAL_USER_REGEX, tstring)
+ if m:
+ print('\tMatched: {}'.format(
+ pyrevit.PYREVIT_FILE_PREFIX_UNIVERSAL_USER_REGEX))
+ print('\t' + str(m.groupdict()))
+
+ # e.g. pyRevit_
+ m = re.match(pyrevit.PYREVIT_FILE_PREFIX_UNIVERSAL_REGEX, tstring)
+ if m:
+ print('\tMatched: {}'.format(
+ pyrevit.PYREVIT_FILE_PREFIX_UNIVERSAL_REGEX))
+ print('\t' + str(m.groupdict()))
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/a360.png b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/a360.png
new file mode 100644
index 000000000..8cecfea69
Binary files /dev/null and b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/a360.png differ
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/ajera.png b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/ajera.png
new file mode 100644
index 000000000..c5d2d31f5
Binary files /dev/null and b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/ajera.png differ
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/autodeks2.png b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/autodeks2.png
new file mode 100644
index 000000000..55d6ad007
Binary files /dev/null and b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/autodeks2.png differ
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/autodesk.png b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/autodesk.png
new file mode 100644
index 000000000..3be28170b
Binary files /dev/null and b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/autodesk.png differ
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/bim360.png b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/bim360.png
new file mode 100644
index 000000000..79272170a
Binary files /dev/null and b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/bim360.png differ
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/box.png b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/box.png
new file mode 100644
index 000000000..a121d7a1d
Binary files /dev/null and b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/box.png differ
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/checklists.png b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/checklists.png
new file mode 100644
index 000000000..9e7a11285
Binary files /dev/null and b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/checklists.png differ
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/confluence.png b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/confluence.png
new file mode 100644
index 000000000..6721e9a69
Binary files /dev/null and b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/confluence.png differ
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/contacts.png b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/contacts.png
new file mode 100644
index 000000000..cc0a6f1fb
Binary files /dev/null and b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/contacts.png differ
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/docker.png b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/docker.png
new file mode 100644
index 000000000..59f3bb184
Binary files /dev/null and b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/docker.png differ
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/forge.png b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/forge.png
new file mode 100644
index 000000000..8c49eb5da
Binary files /dev/null and b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/forge.png differ
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/github.png b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/github.png
new file mode 100644
index 000000000..228b09acd
Binary files /dev/null and b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/github.png differ
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/gitlab.png b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/gitlab.png
new file mode 100644
index 000000000..55eb137c9
Binary files /dev/null and b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/gitlab.png differ
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/googlegroups.png b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/googlegroups.png
new file mode 100644
index 000000000..ce9f79528
Binary files /dev/null and b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/googlegroups.png differ
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/joinme.png b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/joinme.png
new file mode 100644
index 000000000..cbf7d93a9
Binary files /dev/null and b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/joinme.png differ
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/jupyterhub.png b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/jupyterhub.png
new file mode 100644
index 000000000..c013435c4
Binary files /dev/null and b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/jupyterhub.png differ
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/kiosk.png b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/kiosk.png
new file mode 100644
index 000000000..e1107fe4e
Binary files /dev/null and b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/kiosk.png differ
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/logmein.png b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/logmein.png
new file mode 100644
index 000000000..d2f6131fd
Binary files /dev/null and b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/logmein.png differ
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/lynda.png b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/lynda.png
new file mode 100644
index 000000000..325ae777c
Binary files /dev/null and b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/lynda.png differ
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/mailchimp.png b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/mailchimp.png
new file mode 100644
index 000000000..0aa1639c4
Binary files /dev/null and b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/mailchimp.png differ
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/mbase.png b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/mbase.png
new file mode 100644
index 000000000..43baa21e3
Binary files /dev/null and b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/mbase.png differ
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/mimecast.png b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/mimecast.png
new file mode 100644
index 000000000..fa1b6cc25
Binary files /dev/null and b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/mimecast.png differ
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/msstream.png b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/msstream.png
new file mode 100644
index 000000000..0239036e6
Binary files /dev/null and b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/msstream.png differ
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/outlookwa.png b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/outlookwa.png
new file mode 100644
index 000000000..b8e454ee8
Binary files /dev/null and b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/outlookwa.png differ
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/printer.png b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/printer.png
new file mode 100644
index 000000000..0f103ed52
Binary files /dev/null and b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/printer.png differ
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/projects.png b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/projects.png
new file mode 100644
index 000000000..09b87ae0a
Binary files /dev/null and b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/projects.png differ
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/rhino.png b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/rhino.png
new file mode 100644
index 000000000..520d0c81f
Binary files /dev/null and b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/rhino.png differ
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/slack.png b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/slack.png
new file mode 100644
index 000000000..c3f546959
Binary files /dev/null and b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/slack.png differ
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/smartsheet.png b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/smartsheet.png
new file mode 100644
index 000000000..a840513d6
Binary files /dev/null and b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/smartsheet.png differ
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/ultimaker.png b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/ultimaker.png
new file mode 100644
index 000000000..ffb797915
Binary files /dev/null and b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/ultimaker.png differ
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/unifi.png b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/unifi.png
new file mode 100644
index 000000000..dd26ffdb2
Binary files /dev/null and b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/unifi.png differ
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/vsphere.png b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/vsphere.png
new file mode 100644
index 000000000..4c10c143c
Binary files /dev/null and b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/vsphere.png differ
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/xwiki.png b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/xwiki.png
new file mode 100644
index 000000000..ea513b631
Binary files /dev/null and b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/xwiki.png differ
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/zoom.png b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/zoom.png
new file mode 100644
index 000000000..2fca8d9f6
Binary files /dev/null and b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/images/zoom.png differ
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/script.py b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/script.py
index 611713ad5..5467a0943 100644
--- a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/script.py
+++ b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/Forms Module Tests.pushbutton/script.py
@@ -1,12 +1,12 @@
"""Unit Tests for pyrevit.forms module."""
+#pylint: disable=E0401
+from pyrevit import script
+from pyrevit import forms
__context__ = 'zerodoc'
-from pyrevit import forms
-
-
def test_forms(forms_func, test_title, filterfuncstr='', *args, **kwargs):
print('\n\n' + test_title)
test_title += '({}):'
@@ -100,3 +100,8 @@ def test_forms(forms_func, test_title, filterfuncstr='', *args, **kwargs):
group_selector_title='Select Integer Range:',
multiselect=True
))
+
+
+print(
+ forms.select_image(script.get_bundle_files('images/'))
+ )
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/_layout b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/_layout
index ee5a64ea6..4dc5b0d1c 100644
--- a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/_layout
+++ b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/_layout
@@ -3,6 +3,7 @@ Run All Tests
Engine Tests
pyRevitLabs Module Tests
Output Window Tests
+Appdata Module Tests
Forms Module Tests
Revit Module Tests
Script Module Tests
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Developer Tools.panel/WIP Tools.pulldown/CalculatePlenumSpaceAboveSelectedCeiling.pushbutton/script.py b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Developer Tools.panel/WIP Tools.pulldown/CalculatePlenumSpaceAboveSelectedCeiling.pushbutton/script.py
index 444fa18dd..4c60943f3 100644
--- a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Developer Tools.panel/WIP Tools.pulldown/CalculatePlenumSpaceAboveSelectedCeiling.pushbutton/script.py
+++ b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Developer Tools.panel/WIP Tools.pulldown/CalculatePlenumSpaceAboveSelectedCeiling.pushbutton/script.py
@@ -1,34 +1,18 @@
-'''
-Copyright (c) 2014-2016 Ehsan Iran-Nejad
-Python scripts for Autodesk Revit
+"""Calculated plenum space between selected ceiling and floor or roof above."""
-This file is part of pyRevit repository at https://github.com/eirannejad/pyRevit
+from pyrevit import revit, DB
+from pyrevit import forms
+from pyrevit import script
-pyRevit is a free set of scripts for Autodesk Revit: you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 3, as published by
-the Free Software Foundation.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+from System import Math
-See this link for a copy of the GNU General Public License protecting this package.
-https://github.com/eirannejad/pyRevit/blob/master/LICENSE
-'''
-__doc__ = 'Calculated plenum space between selected ceiling and floor or roof above.'
+logger = script.get_logger()
+output = script.get_output()
-__window__.Close()
-from Autodesk.Revit.DB import UnitUtils, UnitFormatUtils, UnitType, DisplayUnitType, FilteredElementCollector, BuiltInCategory, FormatOptions, RoundingMethod, UnitSymbolType
-from Autodesk.Revit.DB import FootPrintRoof, Ceiling, Floor, ElementId
-from Autodesk.Revit.UI import TaskDialog
-from System import Math
-doc = __revit__.ActiveUIDocument.Document
-selection = [ doc.GetElement( elId ) for elId in __revit__.ActiveUIDocument.Selection.GetElementIds() ]
-list = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Levels).WhereElementIsNotElementType()
+list = DB.FilteredElementCollector(revit.doc).OfCategory(DB.BuiltInCategory.OST_Levels).WhereElementIsNotElementType()
levels = {}
bottomOfRoof = 0
@@ -37,54 +21,58 @@
totalCeilValue = 0
# sort elements by level+offset
-for el in selection:
- if isinstance(el, FootPrintRoof):
- offset = el.LookupParameter('Base Offset From Level').AsDouble()
- levelElev = doc.GetElement(el.LevelId).Elevation
+for el in revit.get_selection():
+ if isinstance(el, DB.FootPrintRoof):
+ offset = el.Parameter[DB.BuiltInParameter.ROOF_LEVEL_OFFSET_PARAM].AsDouble()
+ levelElev = revit.doc.GetElement(el.LevelId).Elevation
elev = levelElev + offset
levels[elev] = el.Id.IntegerValue
- elif isinstance(el, Floor) or isinstance(el, Ceiling):
- offset = el.LookupParameter('Height Offset From Level').AsDouble()
- levelElev = doc.GetElement(el.LevelId).Elevation
+ elif isinstance(el, DB.Floor) or isinstance(el, DB.Ceiling):
+ if isinstance(el, DB.Ceiling):
+ param_type = DB.BuiltInParameter.CEILING_HEIGHTABOVELEVEL_PARAM
+ elif isinstance(el, DB.Floor):
+ param_type = DB.BuiltInParameter.FLOOR_HEIGHTABOVELEVEL_PARAM
+ offset = el.Parameter[param_type].AsDouble()
+ levelElev = revit.doc.GetElement(el.LevelId).Elevation
elev = levelElev + offset
levels[elev] = el.Id.IntegerValue
# get element thinknesses and update the elevs
for elev in sorted(levels.keys()):
elid = levels[elev]
- el = doc.GetElement(ElementId(elid))
- if isinstance(el, FootPrintRoof):
- # roofType = doc.GetElement(el.GetTypeId())
+ el = revit.doc.GetElement(DB.ElementId(elid))
+ if isinstance(el, DB.FootPrintRoof):
+ # roofType = revit.doc.GetElement(el.GetTypeId())
# cs = roofType.GetCompoundStructure()
# roofThickness = cs.GetWidth()
bottomOfRoof = elev
- if isinstance(el, Floor):
- floorType = doc.GetElement(el.GetTypeId())
+ if isinstance(el, DB.Floor):
+ floorType = revit.doc.GetElement(el.GetTypeId())
cs = floorType.GetCompoundStructure()
floorThickness = cs.GetWidth()
bottomOfFloor = elev - floorThickness
- elif isinstance(el, Ceiling) and totalCeilValue == 0:
- ceilType = doc.GetElement(el.GetTypeId())
+ elif isinstance(el, DB.Ceiling) and totalCeilValue == 0:
+ ceilType = revit.doc.GetElement(el.GetTypeId())
cs = ceilType.GetCompoundStructure()
ceilThickness = cs.GetWidth()
totalCeilValue = elev + ceilThickness
- elif isinstance(el, Ceiling):
+ elif isinstance(el, DB.Ceiling):
bottomOfRatedLid = elev
-unts = doc.GetUnits()
+unts = revit.doc.GetUnits()
fo = FormatOptions()
fo.UseDefault = False
-fo.DisplayUnits = DisplayUnitType.DUT_FRACTIONAL_INCHES
+fo.DisplayUnits = DB.DisplayUnitType.DUT_FRACTIONAL_INCHES
fo.Accuracy = 0.5
-unts.SetFormatOptions(UnitType.UT_Length, fo)
+unts.SetFormatOptions(DB.UnitType.UT_Length, fo)
if bottomOfRoof > 0:
- result = UnitFormatUtils.Format(unts, UnitType.UT_Length, bottomOfRoof - totalCeilValue, False, False)
- TaskDialog.Show('pyRevit', 'Ceiling/Roof plenum space depth is:\n{0}'.format(result))
+ result = DB.UnitFormatUtils.Format(unts, DB.UnitType.UT_Length, bottomOfRoof - totalCeilValue, False, False)
+ forms.alert('pyRevit', 'DB.Ceiling/Roof plenum space depth is:\n{0}'.format(result))
elif bottomOfFloor > 0:
- result = UnitFormatUtils.Format(unts, UnitType.UT_Length, bottomOfFloor - totalCeilValue, False, False)
- TaskDialog.Show('pyRevit', 'Floor/Roof plenum space depth is:\n{0}'.format(result))
+ result = DB.UnitFormatUtils.Format(unts, DB.UnitType.UT_Length, bottomOfFloor - totalCeilValue, False, False)
+ forms.alert('pyRevit', 'DB.Floor/Roof plenum space depth is:\n{0}'.format(result))
elif bottomOfRatedLid > 0:
- result = UnitFormatUtils.Format(unts, UnitType.UT_Length, abs(bottomOfRatedLid - totalCeilValue), False, False)
- TaskDialog.Show('pyRevit', 'Floor/Roof plenum space depth is:\n{0}'.format(result))
-# UnitUtils.ConvertFromInternalUnits(cs.GetWidth(), DisplayUnitType.DUT_DECIMAL_INCHES)
\ No newline at end of file
+ result = DB.UnitFormatUtils.Format(unts, DB.UnitType.UT_Length, abs(bottomOfRatedLid - totalCeilValue), False, False)
+ forms.alert('pyRevit', 'DB.Floor/Roof plenum space depth is:\n{0}'.format(result))
+# DB.UnitUtils.ConvertFromInternalUnits(cs.GetWidth(), DB.DisplayUnitType.DUT_DECIMAL_INCHES)
\ No newline at end of file
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Developer Tools.panel/WIP Tools.pulldown/Convert View Types.pushbutton/script.py b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Developer Tools.panel/WIP Tools.pulldown/Convert View Types.pushbutton/script.py
index 810eac02a..bb4635258 100644
--- a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Developer Tools.panel/WIP Tools.pulldown/Convert View Types.pushbutton/script.py
+++ b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Developer Tools.panel/WIP Tools.pulldown/Convert View Types.pushbutton/script.py
@@ -121,14 +121,14 @@ def create_dest_view(view_type, view_name, view_scale):
trans_identity.BasisZ = XYZ.BasisY # view direction
view_direction.Transform = trans_identity
dest_view = ViewSection.CreateSection(doc, view_fam_typeid, view_direction)
- scale_param = dest_view.LookupParameter('Hide at scales coarser than')
+ scale_param = dest_view.Parameter[DB.BuiltInParameter.SECTION_COARSER_SCALE_PULLDOWN_IMPERIAL]
scale_param.Set(1)
elif view_type == 'Elevation':
view_fam_typeid = doc.GetDefaultElementTypeId(ElementTypeGroup.ViewTypeElevation)
elev_marker = ElevationMarker.CreateElevationMarker(doc, view_fam_typeid, XYZ(0,0,0), 1)
default_floor_plan = find_first_floorplan()
dest_view = elev_marker.CreateElevation(doc, default_floor_plan.Id, 0)
- scale_param = dest_view.LookupParameter('Hide at scales coarser than')
+ scale_param = dest_view.Parameter[DB.BuiltInParameter.SECTION_COARSER_SCALE_PULLDOWN_IMPERIAL]
scale_param.Set(1)
elif view_type == 'Drafting':
view_fam_typeid = doc.GetDefaultElementTypeId(ElementTypeGroup.ViewTypeDrafting)
@@ -136,7 +136,7 @@ def create_dest_view(view_type, view_name, view_scale):
dest_view.ViewName = view_name
dest_view.Scale = view_scale
- model_visib_param = dest_view.LookupParameter('Display Model')
+ model_visib_param = dest_view.Parameter[DB.BuiltInParameter.VIEW_MODEL_DISPLAY_MODE]
if model_visib_param:
model_visib_param.Set(2)
dest_view.CropBoxActive = False
diff --git a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Developer Tools.panel/WIP Tools.pulldown/Graph Area Types.pushbutton/script.py b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Developer Tools.panel/WIP Tools.pulldown/Graph Area Types.pushbutton/script.py
index 9e0a7709b..f980f5168 100644
--- a/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Developer Tools.panel/WIP Tools.pulldown/Graph Area Types.pushbutton/script.py
+++ b/extensions/pyRevitDevTools.extension/pyRevitDev.tab/Developer Tools.panel/WIP Tools.pulldown/Graph Area Types.pushbutton/script.py
@@ -15,7 +15,7 @@
total = {}
for area in areas:
try:
- area_type = area.LookupParameter('Area Type').AsValueString()
+ area_type = area.Parameter[DB.BuiltInParameter.AREA_TYPE].AsValueString()
if area_type.lower() != '(none)':
if area_type in total:
total[area_type] += area.Area
diff --git a/extensions/pyRevitTags.extension/pyRevit.tab/Packages & Tags.panel/Manage Packages.pushbutton/script.py b/extensions/pyRevitTags.extension/pyRevit.tab/Packages & Tags.panel/Manage Packages.pushbutton/script.py
index 1cb822362..6251ef15c 100644
--- a/extensions/pyRevitTags.extension/pyRevit.tab/Packages & Tags.panel/Manage Packages.pushbutton/script.py
+++ b/extensions/pyRevitTags.extension/pyRevit.tab/Packages & Tags.panel/Manage Packages.pushbutton/script.py
@@ -279,7 +279,7 @@ def _ask_for_commit_type(self, sheet_item, commit_pt, commit):
button_name='Apply Change Type',
width=400,
height=300,
- item_container_template=self.committype_template
+ item_template=self.committype_template
)
if ctype_commit_op:
return ctype_commit_op.ctype
diff --git a/extensions/pyRevitTags.extension/pyRevit.tab/Packages & Tags.panel/Manage Tags.pushbutton/script.py b/extensions/pyRevitTags.extension/pyRevit.tab/Packages & Tags.panel/Manage Tags.pushbutton/script.py
index 48173aedd..75e27c5ae 100644
--- a/extensions/pyRevitTags.extension/pyRevit.tab/Packages & Tags.panel/Manage Tags.pushbutton/script.py
+++ b/extensions/pyRevitTags.extension/pyRevit.tab/Packages & Tags.panel/Manage Tags.pushbutton/script.py
@@ -161,7 +161,7 @@ def add_modifier(self, sender, args):
button_name='Select Modifier',
width=400,
height=300,
- item_container_template=self.tagmodif_template
+ item_template=self.tagmodif_template
)
if modifiers:
self.Close()
@@ -186,7 +186,7 @@ def remove_modifier(self, sender, args):
button_name='Select Modifier',
width=400,
height=300,
- item_container_template=self.tagmodif_template
+ item_template=self.tagmodif_template
)
if modifiers:
self.Close()
diff --git a/extensions/pyRevitTools.extension/pyRevit.tab/Analysis.panel/Tools.stack2/Analyse.pulldown/Calculate Average Area.pushbutton/script.py b/extensions/pyRevitTools.extension/pyRevit.tab/Analysis.panel/Tools.stack2/Analyse.pulldown/Calculate Average Area.pushbutton/script.py
index 9178ea0ec..9b2ef3e94 100644
--- a/extensions/pyRevitTools.extension/pyRevit.tab/Analysis.panel/Tools.stack2/Analyse.pulldown/Calculate Average Area.pushbutton/script.py
+++ b/extensions/pyRevitTools.extension/pyRevit.tab/Analysis.panel/Tools.stack2/Analyse.pulldown/Calculate Average Area.pushbutton/script.py
@@ -1,3 +1,4 @@
+#pylint: disable=E0401,C0103
from pyrevit import revit, DB
@@ -33,36 +34,42 @@
total = 0.0
average = 0.0
if isinstance(el, DB.Area):
- selareaname = el.LookupParameter('Name').AsString()
+ selareaname = el.Parameter[DB.BuiltInParameter.ROOM_NAME].AsString()
if selareaname not in processed_items[DB.Area]:
print("AREA TYPE IS: {}".format(selareaname))
for area in areas:
- areaname = area.LookupParameter('Name').AsString()
+ areaname = \
+ area.Parameter[DB.BuiltInParameter.ROOM_NAME].AsString()
if area.AreaScheme.Name == el.AreaScheme.Name\
and selareaname == areaname:
- total += area.LookupParameter('Area').AsDouble()
+ area_param = area.Parameter[DB.BuiltInParameter.ROOM_AREA]
+ total += area_param.AsDouble()
count += 1
print("TOTAL OF {} AREAS WERE FOUND.".format(count))
processed_items[DB.Area].append(selareaname)
elif isinstance(el, DB.Architecture.Room):
- selroomname = el.LookupParameter('Name').AsString()
+ selroomname = el.Parameter[DB.BuiltInParameter.ROOM_NAME].AsString()
if selroomname not in processed_items[DB.Architecture.Room]:
print("ROOM TYPE IS: {}".format(selroomname))
for room in rms:
- roomname = room.LookupParameter('Name').AsString()
+ roomname = \
+ room.Parameter[DB.BuiltInParameter.ROOM_NAME].AsString()
if selroomname == roomname:
- total += room.LookupParameter('Area').AsDouble()
+ area_param = room.Parameter[DB.BuiltInParameter.ROOM_AREA]
+ total += area_param.AsDouble()
count += 1
print("TOTAL OF {} ROOMS WERE FOUND.".format(count))
processed_items[DB.Architecture.Room].append(selroomname)
elif isinstance(el, DB.Mechanical.Space):
- selspacename = el.LookupParameter('Name').AsString()
+ selspacename = el.Parameter[DB.BuiltInParameter.ROOM_NAME].AsString()
if selspacename not in processed_items[DB.Mechanical.Space]:
print("SPACE TYPE IS: {}".format(selspacename))
for space in spaces:
- spacename = space.LookupParameter('Name').AsString()
+ spacename = \
+ space.Parameter[DB.BuiltInParameter.ROOM_NAME].AsString()
if selspacename == spacename:
- total += space.LookupParameter('Area').AsDouble()
+ area_param = space.Parameter[DB.BuiltInParameter.ROOM_AREA]
+ total += area_param.AsDouble()
count += 1
print("TOTAL OF {} SPACES WERE FOUND.".format(count))
processed_items[DB.Mechanical.Space].append(selspacename)
diff --git a/extensions/pyRevitTools.extension/pyRevit.tab/Analysis.panel/Tools.stack2/Analyse.pulldown/Find Range Of Roof Slopes.pushbutton/script.py b/extensions/pyRevitTools.extension/pyRevit.tab/Analysis.panel/Tools.stack2/Analyse.pulldown/Find Range Of Roof Slopes.pushbutton/script.py
index 26eed96ce..85465f7e2 100644
--- a/extensions/pyRevitTools.extension/pyRevit.tab/Analysis.panel/Tools.stack2/Analyse.pulldown/Find Range Of Roof Slopes.pushbutton/script.py
+++ b/extensions/pyRevitTools.extension/pyRevit.tab/Analysis.panel/Tools.stack2/Analyse.pulldown/Find Range Of Roof Slopes.pushbutton/script.py
@@ -1,5 +1,4 @@
"""Lists all roof slopes in the model."""
-
from pyrevit import script
from pyrevit import revit, DB
@@ -16,13 +15,13 @@
for el in rooflist:
- p = el.LookupParameter('Slope')
- if p:
- s = p.AsValueString()
- if s in slopes.keys():
- slopes[s].append(el.Id)
+ slope_param = el.Parameter[DB.BuiltInParameter.ROOF_SLOPE]
+ if slope_param:
+ slope_value = slope_param.AsValueString()
+ if slope_value in slopes.keys():
+ slopes[slope_value].append(el.Id)
else:
- slopes[s] = [el.Id]
+ slopes[slope_value] = [el.Id]
for sl, elids in slopes.items():
print('SLOPE: {0}'.format(sl))
diff --git a/extensions/pyRevitTools.extension/pyRevit.tab/Analysis.panel/Tools.stack2/Inspect.pulldown/Find Identical Room Numbers.pushbutton/script.py b/extensions/pyRevitTools.extension/pyRevit.tab/Analysis.panel/Tools.stack2/Inspect.pulldown/Find Identical Room Numbers.pushbutton/script.py
index 636e94d21..93494135b 100644
--- a/extensions/pyRevitTools.extension/pyRevit.tab/Analysis.panel/Tools.stack2/Inspect.pulldown/Find Identical Room Numbers.pushbutton/script.py
+++ b/extensions/pyRevitTools.extension/pyRevit.tab/Analysis.panel/Tools.stack2/Inspect.pulldown/Find Identical Room Numbers.pushbutton/script.py
@@ -23,7 +23,7 @@
rm = revit.doc.GetElement(rmid)
if rm.Number == rn:
print('\tROOM NAME: {} LEVEL: {}'
- .format(rm.LookupParameter('Name').AsString().ljust(30),
+ .format(rm.Parameter[DB.BuiltInParameter.ROOM_NAME].AsString().ljust(30),
rm.Level.Name))
print('\n')
else:
diff --git a/extensions/pyRevitTools.extension/pyRevit.tab/Analysis.panel/Tools.stack2/Inspect.pulldown/Find Referenced Views By Selected Elevation Tag.pushbutton/script.py b/extensions/pyRevitTools.extension/pyRevit.tab/Analysis.panel/Tools.stack2/Inspect.pulldown/Find Referenced Views By Selected Elevation Tag.pushbutton/script.py
index 00c3200bc..18ead594b 100644
--- a/extensions/pyRevitTools.extension/pyRevit.tab/Analysis.panel/Tools.stack2/Inspect.pulldown/Find Referenced Views By Selected Elevation Tag.pushbutton/script.py
+++ b/extensions/pyRevitTools.extension/pyRevit.tab/Analysis.panel/Tools.stack2/Inspect.pulldown/Find Referenced Views By Selected Elevation Tag.pushbutton/script.py
@@ -19,4 +19,4 @@
str(v.ViewType).ljust(15),
str(v.Id).ljust(10),
str(v.IsTemplate).ljust(10),
- v.LookupParameter('Detail Number').AsString()))
+ v.Parameter[DB.BuiltInParameter.VIEWER_DETAIL_NUMBER].AsString()))
diff --git a/extensions/pyRevitTools.extension/pyRevit.tab/Analysis.panel/Tools.stack2/Inspect.pulldown/Find Referencing Sheets.pushbutton/script.py b/extensions/pyRevitTools.extension/pyRevit.tab/Analysis.panel/Tools.stack2/Inspect.pulldown/Find Referencing Sheets.pushbutton/script.py
index dc3b16c38..5cc2079c1 100644
--- a/extensions/pyRevitTools.extension/pyRevit.tab/Analysis.panel/Tools.stack2/Inspect.pulldown/Find Referencing Sheets.pushbutton/script.py
+++ b/extensions/pyRevitTools.extension/pyRevit.tab/Analysis.panel/Tools.stack2/Inspect.pulldown/Find Referencing Sheets.pushbutton/script.py
@@ -30,7 +30,7 @@
if curview.Id in vpsIds:
count += 1
print('NUMBER: {0} NAME:{1}'
- .format(s.LookupParameter('Sheet Number').AsString().rjust(10),
- s.LookupParameter('Sheet Name').AsString().ljust(50)))
+ .format(s.Parameter[DB.BuiltInParameter.SHEET_NUMBER].AsString().rjust(10),
+ s.Parameter[DB.BuiltInParameter.SHEET_NAME].AsString().ljust(50)))
print('\n\nView is referenced on {0} sheets.'.format(count))
diff --git a/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/Revision.pulldown/Find All Sheets Missing Revision Number.pushbutton/script.py b/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/Revision.pulldown/Find All Sheets Missing Revision Number.pushbutton/script.py
index a367231a7..df8266ef5 100644
--- a/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/Revision.pulldown/Find All Sheets Missing Revision Number.pushbutton/script.py
+++ b/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/Revision.pulldown/Find All Sheets Missing Revision Number.pushbutton/script.py
@@ -64,8 +64,8 @@
atleastonecrazysheetwasfound = True
if len(missedrevids) > 0:
print('SHEET: {0}\t{1}\nDOES NOT LIST THESE REVISIONS:\n'
- .format(sheet.LookupParameter('Sheet Number').AsString(),
- sheet.LookupParameter('Sheet Name').AsString()))
+ .format(sheet.Parameter[DB.BuiltInParameter.SHEET_NUMBER].AsString(),
+ sheet.Parameter[DB.BuiltInParameter.SHEET_NAME].AsString()))
for revid in missedrevids:
if revid not in listedrevids:
diff --git a/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/Revision.pulldown/Find All Sheets With Selected Revision.pushbutton/script.py b/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/Revision.pulldown/Find All Sheets With Selected Revision.pushbutton/script.py
index a2e8b09d2..d62148b54 100644
--- a/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/Revision.pulldown/Find All Sheets With Selected Revision.pushbutton/script.py
+++ b/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/Revision.pulldown/Find All Sheets With Selected Revision.pushbutton/script.py
@@ -34,8 +34,8 @@
if sr in revids:
hasSelectedRevision = True
if hasSelectedRevision:
- print('{0}\t{1}'.format(s.LookupParameter('Sheet Number').AsString(),
- s.LookupParameter('Sheet Name').AsString()))
+ print('{0}\t{1}'.format(s.Parameter[DB.BuiltInParameter.SHEET_NUMBER].AsString(),
+ s.Parameter[DB.BuiltInParameter.SHEET_NAME].AsString()))
if multipleRevs:
for revid in revision_ids:
diff --git a/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/Revision.pulldown/Find Rev Clouded Legends.pushbutton/ListRevCloudedLegends_script.py b/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/Revision.pulldown/Find Rev Clouded Legends.pushbutton/ListRevCloudedLegends_script.py
index f15c3d4c8..b6934d68b 100644
--- a/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/Revision.pulldown/Find Rev Clouded Legends.pushbutton/ListRevCloudedLegends_script.py
+++ b/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/Revision.pulldown/Find Rev Clouded Legends.pushbutton/ListRevCloudedLegends_script.py
@@ -50,8 +50,10 @@
rev_creator = \
DB.WorksharingUtils.GetWorksharingTooltipInfo(revit.doc,
rev_cloud.Id).Creator
- if rev_cloud.LookupParameter("Comments").HasValue:
- rev_comments = rev_cloud.LookupParameter("Comments").AsString()
+ commet_param = \
+ rev_cloud.Parameter[DB.BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS]
+ if commet_param.HasValue:
+ rev_comments = commet_param.AsString()
else:
rev_comments = ""
diff --git a/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/Revision.pulldown/Generate Revision Report.pushbutton/script.py b/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/Revision.pulldown/Generate Revision Report.pushbutton/script.py
index 60dc817e7..b6b586f2a 100644
--- a/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/Revision.pulldown/Generate Revision Report.pushbutton/script.py
+++ b/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/Revision.pulldown/Generate Revision Report.pushbutton/script.py
@@ -109,7 +109,9 @@ def get_clouds(self):
def get_comments(self):
all_comments = set()
for cloud in self._clouds:
- comment = cloud.LookupParameter('Comments').AsString()
+ cparam = \
+ cloud.Parameter[DB.BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS]
+ comment = cparam.AsString()
if not coreutils.is_blank(comment):
all_comments.add(comment)
return all_comments
diff --git a/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/Sheets.pulldown/Decrement Selected Sheet Numbers.pushbutton/script.py b/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/Sheets.pulldown/Decrement Selected Sheet Numbers.pushbutton/script.py
index 23bcaeb8c..2d624fb78 100644
--- a/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/Sheets.pulldown/Decrement Selected Sheet Numbers.pushbutton/script.py
+++ b/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/Sheets.pulldown/Decrement Selected Sheet Numbers.pushbutton/script.py
@@ -28,7 +28,7 @@
for sheet in sorted_sheet_list:
try:
cur_sheet_num = sheet.SheetNumber
- sheet_num_param = sheet.LookupParameter('Sheet Number')
+ sheet_num_param = sheet.Parameter[DB.BuiltInParameter.SHEET_NUMBER]
sheet_num_param.Set(
coreutils.decrement_str(sheet.SheetNumber, shift)
)
diff --git a/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/Sheets.pulldown/Increment Selected Sheet Numbers.pushbutton/script.py b/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/Sheets.pulldown/Increment Selected Sheet Numbers.pushbutton/script.py
index da51a279c..e13254121 100644
--- a/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/Sheets.pulldown/Increment Selected Sheet Numbers.pushbutton/script.py
+++ b/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/Sheets.pulldown/Increment Selected Sheet Numbers.pushbutton/script.py
@@ -29,7 +29,7 @@
for sheet in sorted_sheet_list:
try:
cur_sheet_num = sheet.SheetNumber
- sheet_num_param = sheet.LookupParameter('Sheet Number')
+ sheet_num_param = sheet.Parameter[DB.BuiltInParameter.SHEET_NUMBER]
sheet_num_param.Set(coreutils.increment_str(sheet.SheetNumber,
shift))
new_sheet_num = sheet.SheetNumber
diff --git a/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/Sheets.pulldown/Rename Selected Sheets.pushbutton/script.py b/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/Sheets.pulldown/Rename Selected Sheets.pushbutton/script.py
index 1ffbba826..5aca94d84 100644
--- a/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/Sheets.pulldown/Rename Selected Sheets.pushbutton/script.py
+++ b/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/Sheets.pulldown/Rename Selected Sheets.pushbutton/script.py
@@ -7,7 +7,7 @@
def change_case(sheetlist, upper=True, verbose=False):
with revit.Transaction('Rename Sheets to Upper'):
for el in sheetlist:
- sheetnameparam = el.LookupParameter('Sheet Name')
+ sheetnameparam = el.Parameter[DB.BuiltInParameter.SHEET_NAME]
orig_name = sheetnameparam.AsString()
new_name = orig_name.upper() if upper else orig_name.lower()
if verbose:
diff --git a/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/Sheets.pulldown/View Ordering Tool.pushbutton/script.py b/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/Sheets.pulldown/View Ordering Tool.pushbutton/script.py
index 3f74b54fa..8f27377a7 100644
--- a/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/Sheets.pulldown/View Ordering Tool.pushbutton/script.py
+++ b/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/Sheets.pulldown/View Ordering Tool.pushbutton/script.py
@@ -20,7 +20,7 @@
# find max count for sheet_vports
vports = {}
for vp in sheet_vports:
- detnum_param = vp.LookupParameter('Detail Number')
+ detnum_param = vp.Parameter[DB.BuiltInParameter.VIEWPORT_DETAIL_NUMBER]
if detnum_param:
try:
detnum = int(detnum_param.AsString())
@@ -48,9 +48,9 @@
for i in range(1, len(selection) + 1):
try:
- vports[i].LookupParameter('Detail Number').Set(str(max_num + i))
+ vports[i].Parameter[DB.BuiltInParameter.VIEWPORT_DETAIL_NUMBER].Set(str(max_num + i))
except KeyError:
continue
for i, el in enumerate(selection):
- el.LookupParameter('Detail Number').Set(str(i + 1))
+ el.Parameter[DB.BuiltInParameter.VIEWPORT_DETAIL_NUMBER].Set(str(i + 1))
diff --git a/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/views.stack3/Views.pulldown/Find Referring Views.pushbutton/script.py b/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/views.stack3/Views.pulldown/Find Referring Views.pushbutton/script.py
index de6c4bb88..42b2a164f 100644
--- a/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/views.stack3/Views.pulldown/Find Referring Views.pushbutton/script.py
+++ b/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/views.stack3/Views.pulldown/Find Referring Views.pushbutton/script.py
@@ -35,7 +35,9 @@ def __init__(self, view_id):
if not self._valid_view():
raise Exception()
- titleos = self.element.LookupParameter('Title on Sheet').AsString()
+ titleos_param = \
+ self.element.Parameter[DB.BuiltInParameter.VIEW_DESCRIPTION]
+ titleos = titleos_param.AsString()
self.name = titleos if titleos else self.element.ViewName
self.refs = []
self._update_refs(all_ref_els)
@@ -44,11 +46,11 @@ def __init__(self, view_id):
# self._update_refs(self.element.GetReferenceElevations())
self.sheet_num = \
- self.element.LookupParameter('Sheet Number').AsString()
+ self.element.Parameter[DB.BuiltInParameter.SHEET_NUMBER].AsString()
self.sheet_name = \
- self.element.LookupParameter('Sheet Name').AsString()
+ self.element.Parameter[DB.BuiltInParameter.SHEET_NAME].AsString()
self.ref_det = \
- self.element.LookupParameter('Detail Number').AsString()
+ self.element.Parameter[DB.BuiltInParameter.VIEWER_DETAIL_NUMBER].AsString()
def __repr__(self):
return '<{} on sheet: {} - {} Refs>'\
@@ -61,7 +63,7 @@ def _valid_view(self):
def _update_refs(self, el_list):
for elid in el_list:
element = revit.doc.GetElement(elid)
- viewnameparam = element.LookupParameter("View Name")
+ viewnameparam = element.Parameter[DB.BuiltInParameter.VIEW_NAME]
if element.OwnerViewId == self.element.Id \
or (viewnameparam \
and viewnameparam.AsString() == self.element.ViewName):
@@ -89,7 +91,7 @@ def is_sheeted(self):
for vp in selection:
if isinstance(vp, DB.Viewport):
v = revit.doc.GetElement(vp.ViewId)
- title = v.LookupParameter('Title on Sheet').AsString()
+ title = v.Parameter[DB.BuiltInParameter.VIEW_DESCRIPTION].AsString()
print('\n\nVIEW NAME: {}\n Referenced by:'
.format(title if title else v.ViewName))
diff --git a/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/views.stack3/Views.pulldown/Find Sheeted But Unreferenced Views.pushbutton/script.py b/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/views.stack3/Views.pulldown/Find Sheeted But Unreferenced Views.pushbutton/script.py
index afca4c3dd..22a80462e 100644
--- a/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/views.stack3/Views.pulldown/Find Sheeted But Unreferenced Views.pushbutton/script.py
+++ b/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/views.stack3/Views.pulldown/Find Sheeted But Unreferenced Views.pushbutton/script.py
@@ -16,10 +16,10 @@
def find_sheeted_unrefed_views(view_list):
for v in view_list:
- sheetnum = v.LookupParameter('Sheet Number')
- detnum = v.LookupParameter('Detail Number')
- refsheet = v.LookupParameter('Referencing Sheet')
- refviewport = v.LookupParameter('Referencing Detail')
+ sheetnum = v.Parameter[DB.BuiltInParameter.SHEET_NUMBER]
+ detnum = v.Parameter[DB.BuiltInParameter.VIEWER_DETAIL_NUMBER]
+ refsheet = v.Parameter[DB.BuiltInParameter.VIEW_REFERENCING_SHEET]
+ refviewport = v.Parameter[DB.BuiltInParameter.VIEW_REFERENCING_DETAIL]
# is the view placed on a sheet?
if sheetnum \
and detnum \
@@ -59,7 +59,8 @@ def find_sheeted_unrefed_views(view_list):
view_refs_names = set()
for view_ref in view_refs:
- ref_param = view_ref.LookupParameter('Target view')
+ ref_param = \
+ view_ref.Parameter[DB.BuiltInParameter.REFERENCE_VIEWER_TARGET_VIEW]
view_refs_names.add(ref_param.AsValueString())
dviews = []
diff --git a/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/views.stack3/Views.pulldown/Find Unreferenced Views.pushbutton/script.py b/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/views.stack3/Views.pulldown/Find Unreferenced Views.pushbutton/script.py
index 4c7eca181..7f6c8b02f 100644
--- a/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/views.stack3/Views.pulldown/Find Unreferenced Views.pushbutton/script.py
+++ b/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/views.stack3/Views.pulldown/Find Unreferenced Views.pushbutton/script.py
@@ -17,11 +17,11 @@
def find_unrefed_views(view_list):
for v in view_list:
- phasep = v.LookupParameter('Phase')
- sheetnum = v.LookupParameter('Sheet Number')
- detnum = v.LookupParameter('Detail Number')
- refsheet = v.LookupParameter('Referencing Sheet')
- refviewport = v.LookupParameter('Referencing Detail')
+ phasep = v.Parameter[DB.BuiltInParameter.VIEW_PHASE]
+ sheetnum = v.Parameter[DB.BuiltInParameter.SHEET_NUMBER]
+ detnum = v.Parameter[DB.BuiltInParameter.VIEWER_DETAIL_NUMBER]
+ refsheet = v.Parameter[DB.BuiltInParameter.VIEW_REFERENCING_SHEET]
+ refviewport = v.Parameter[DB.BuiltInParameter.VIEW_REFERENCING_DETAIL]
refprefix = view_ref_prefixes.get(v.ViewType, '')
if refsheet \
and refviewport \
@@ -55,7 +55,8 @@ def find_unrefed_views(view_list):
view_refs_names = set()
for view_ref in view_refs:
- ref_param = view_ref.LookupParameter('Target view')
+ ref_param = \
+ view_ref.Parameter[DB.BuiltInParameter.REFERENCE_VIEWER_TARGET_VIEW]
view_refs_names.add(ref_param.AsValueString())
dviews = []
diff --git a/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/views.stack3/Views.pulldown/Find Views.pushbutton/script.py b/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/views.stack3/Views.pulldown/Find Views.pushbutton/script.py
index 4a3c5e9ed..8c73f20f6 100644
--- a/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/views.stack3/Views.pulldown/Find Views.pushbutton/script.py
+++ b/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/views.stack3/Views.pulldown/Find Views.pushbutton/script.py
@@ -18,9 +18,11 @@
def find_views_with_underlay():
for v in views:
try:
- if HOST_APP.version == '2017':
- base_underlay_param = v.LookupParameter('Range: Base Level')
- top_underlay_param = v.LookupParameter('Range: Top Level')
+ if HOST_APP.is_newer_than(2016, or_equal=True):
+ base_underlay_param = \
+ v.Parameter[DB.BuiltInParameter.VIEW_UNDERLAY_BOTTOM_ID]
+ top_underlay_param = \
+ v.Parameter[DB.BuiltInParameter.VIEW_UNDERLAY_TOP_ID]
if base_underlay_param \
and top_underlay_param \
and base_underlay_param.AsValueString() != 'None' \
@@ -38,7 +40,7 @@ def find_views_with_underlay():
base_underlay_param.AsValueString().ljust(25),
top_underlay_param.AsValueString().ljust(25)))
else:
- underlayp = v.LookupParameter('Underlay')
+ underlayp = v.Parameter[DB.BuiltInParameter.VIEW_UNDERLAY_ID]
if underlayp and underlayp.AsValueString() != 'None':
print('TYPE: {1}\n'
'ID: {2}\n'
@@ -58,7 +60,7 @@ def find_view_with_template():
vtid = v.ViewTemplateId
vt = revit.doc.GetElement(vtid)
if vt:
- phasep = v.LookupParameter('Phase')
+ phasep = v.Parameter[DB.BuiltInParameter.VIEW_PHASE]
print('TYPE: {1} ID: {2} TEMPLATE: {3} PHASE:{4} {0}'.format(
v.ViewName,
str(v.ViewType).ljust(20),
diff --git a/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/views.stack3/Views.pulldown/Match Title on Sheet in Open Docs.pushbutton/script.py b/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/views.stack3/Views.pulldown/Match Title on Sheet in Open Docs.pushbutton/script.py
index 8292fafa7..c3ed8475c 100644
--- a/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/views.stack3/Views.pulldown/Match Title on Sheet in Open Docs.pushbutton/script.py
+++ b/extensions/pyRevitTools.extension/pyRevit.tab/Drawing Set.panel/views.stack3/Views.pulldown/Match Title on Sheet in Open Docs.pushbutton/script.py
@@ -24,10 +24,13 @@ def collect_views(input_doc):
with revit.Transaction('Match Title on Sheets', doc=open_doc):
for v in views:
if v.ViewName in curdoc_views_dict:
- tos_param = v.LookupParameter('Title on Sheet')
+ tos_param = v.Parameter[
+ DB.BuiltInParameter.VIEW_DESCRIPTION
+ ]
matching_view = curdoc_views_dict[v.ViewName]
- orig_tos_param = \
- matching_view.LookupParameter('Title on Sheet')
+ orig_tos_param = matching_view.Parameter[
+ DB.BuiltInParameter.VIEW_DESCRIPTION
+ ]
if orig_tos_param and tos_param:
print('Matching Views: {} / {}'
diff --git a/extensions/pyRevitTools.extension/pyRevit.tab/Modify.panel/Match.pushbutton/script.py b/extensions/pyRevitTools.extension/pyRevit.tab/Modify.panel/Match.pushbutton/script.py
index ace1f8811..0f149b1ee 100644
--- a/extensions/pyRevitTools.extension/pyRevit.tab/Modify.panel/Match.pushbutton/script.py
+++ b/extensions/pyRevitTools.extension/pyRevit.tab/Modify.panel/Match.pushbutton/script.py
@@ -150,6 +150,8 @@ def get_source_style(element_id):
def pick_and_match_dim_overrides(src_dim_id):
with forms.WarningBar(title='Pick dimensions to match overrides:'):
src_dim = revit.doc.GetElement(src_dim_id)
+ if src_dim.NumberOfSegments > 1:
+ src_dim = src_dim.Segments[0]
while True:
dest_dim = revit.pick_element()
@@ -158,7 +160,12 @@ def pick_and_match_dim_overrides(src_dim_id):
if isinstance(dest_dim, DB.Dimension):
with revit.Transaction('Match Dimension Overrides'):
- setup_dim_overrides_per_config(src_dim, dest_dim)
+ if dest_dim.NumberOfSegments > 1:
+ segments = dest_dim.Segments
+ for segment in segments:
+ setup_dim_overrides_per_config(src_dim, segment)
+ else:
+ setup_dim_overrides_per_config(src_dim, dest_dim)
def pick_and_match_styles(src_style):
diff --git a/extensions/pyRevitTools.extension/pyRevit.tab/Modify.panel/edit1.stack3/Flip.pushbutton/script.py b/extensions/pyRevitTools.extension/pyRevit.tab/Modify.panel/edit1.stack3/Flip.pushbutton/script.py
index 536d47cc2..fbb48e9b1 100644
--- a/extensions/pyRevitTools.extension/pyRevit.tab/Modify.panel/edit1.stack3/Flip.pushbutton/script.py
+++ b/extensions/pyRevitTools.extension/pyRevit.tab/Modify.panel/edit1.stack3/Flip.pushbutton/script.py
@@ -37,7 +37,7 @@ def flip_wall_location():
with revit.TransactionGroup("Flip Wall On CenterLine"):
for el in revit.get_selection():
if isinstance(el, DB.Wall):
- param = el.LookupParameter('Location Line')
+ param = el.Parameter[DB.BuiltInParameter.WALL_KEY_REF_PARAM]
current_value = param.AsInteger()
with revit.Transaction('Change Wall Location Line'):
param.Set(location_line_values['Core Centerline'][0])
@@ -50,7 +50,7 @@ def flip_wall_location():
def flip_wall_location_line():
for el in revit.get_selection():
if isinstance(el, DB.Wall):
- param = el.LookupParameter('Location Line')
+ param = el.Parameter[DB.BuiltInParameter.WALL_KEY_REF_PARAM]
current_value = param.AsInteger()
for pair in location_line_values.values():
if pair[0] == current_value:
diff --git a/extensions/pyRevitTools.extension/pyRevit.tab/Modify.panel/edit2.stack3/Groups.pulldown/Explode And Remove Selected Groups.pushbutton/script.py b/extensions/pyRevitTools.extension/pyRevit.tab/Modify.panel/edit2.stack3/Groups.pulldown/Explode And Remove Selected Groups.pushbutton/script.py
index 879a8ade9..8242a8499 100644
--- a/extensions/pyRevitTools.extension/pyRevit.tab/Modify.panel/edit2.stack3/Groups.pulldown/Explode And Remove Selected Groups.pushbutton/script.py
+++ b/extensions/pyRevitTools.extension/pyRevit.tab/Modify.panel/edit2.stack3/Groups.pulldown/Explode And Remove Selected Groups.pushbutton/script.py
@@ -28,7 +28,7 @@
grps.append(grp)
for g in grps:
- if g.LookupParameter('Attached to'):
+ if g.Parameter[DB.BuiltInParameter.GROUP_ATTACHED_PARENT_NAME]:
attachedGrps.append(g.GroupType)
g.UngroupMembers()
diff --git a/extensions/pyRevitTools.extension/pyRevit.tab/Project.panel/Wipe.pulldown/Wipe Model Components.pushbutton/wipeactions.py b/extensions/pyRevitTools.extension/pyRevit.tab/Project.panel/Wipe.pulldown/Wipe Model Components.pushbutton/wipeactions.py
index 0e36804d3..89130c191 100644
--- a/extensions/pyRevitTools.extension/pyRevit.tab/Project.panel/Wipe.pulldown/Wipe Model Components.pushbutton/wipeactions.py
+++ b/extensions/pyRevitTools.extension/pyRevit.tab/Project.panel/Wipe.pulldown/Wipe Model Components.pushbutton/wipeactions.py
@@ -359,11 +359,13 @@ def is_referenced(v):
view_refs_names = set()
for view_ref in view_refs:
- ref_param = view_ref.LookupParameter('Target view')
+ ref_param = view_ref.Parameter[
+ DB.BuiltInParameter.REFERENCE_VIEWER_TARGET_VIEW
+ ]
view_refs_names.add(ref_param.AsValueString())
- refsheet = v.LookupParameter('Referencing Sheet')
- refviewport = v.LookupParameter('Referencing Detail')
+ refsheet = v.Parameter[DB.BuiltInParameter.VIEW_REFERENCING_SHEET]
+ refviewport = v.Parameter[DB.BuiltInParameter.VIEW_REFERENCING_DETAIL]
refprefix = VIEWREF_PREFIX.get(v.ViewType, '')
if refsheet \
and refviewport \
diff --git a/extensions/pyRevitTools.extension/pyRevit.tab/Project.panel/ptools.stack3/Family.pulldown/Wipe Unused Family Parameters.pushbutton/script.py b/extensions/pyRevitTools.extension/pyRevit.tab/Project.panel/ptools.stack3/Family.pulldown/Wipe Unused Family Parameters.pushbutton/script.py
index a984539e4..ef8b9d7a2 100644
--- a/extensions/pyRevitTools.extension/pyRevit.tab/Project.panel/ptools.stack3/Family.pulldown/Wipe Unused Family Parameters.pushbutton/script.py
+++ b/extensions/pyRevitTools.extension/pyRevit.tab/Project.panel/ptools.stack3/Family.pulldown/Wipe Unused Family Parameters.pushbutton/script.py
@@ -34,11 +34,11 @@
visibParams = set()
for el in allelements:
try:
- visibparam = el.LookupParameter('Visible')
- if visibparam is not None:
+ visible_param = el.Parameter[DB.BuiltInParameter.IS_VISIBLE_PARAM]
+ if visible_param is not None:
famvisibparam = \
revit.doc.FamilyManager.GetAssociatedFamilyParameter(
- visibparam
+ visible_param
)
if famvisibparam is not None \
diff --git a/extensions/pyRevitTools.extension/pyRevit.tab/Project.panel/ptools.stack3/Links.pulldown/Create Workset For Linked Element.pushbutton/script.py b/extensions/pyRevitTools.extension/pyRevit.tab/Project.panel/ptools.stack3/Links.pulldown/Create Workset For Linked Element.pushbutton/script.py
index 2e18727f0..2e4855d05 100644
--- a/extensions/pyRevitTools.extension/pyRevit.tab/Project.panel/ptools.stack3/Links.pulldown/Create Workset For Linked Element.pushbutton/script.py
+++ b/extensions/pyRevitTools.extension/pyRevit.tab/Project.panel/ptools.stack3/Links.pulldown/Create Workset For Linked Element.pushbutton/script.py
@@ -20,7 +20,8 @@
if isinstance(el, DB.RevitLinkInstance):
linkedModelName = el.Name.split(':')[0]
elif isinstance(el, DB.ImportInstance):
- linkedModelName = el.LookupParameter('Name').AsString()
+ linkedModelName = \
+ el.Parameter[DB.BuiltInParameter.IMPORT_SYMBOL_NAME].AsString()
if linkedModelName:
if not revit.doc.IsWorkshared and revit.doc.CanEnableWorksharing:
revit.doc.EnableWorksharing('Shared Levels and Grids',
diff --git a/extensions/pyRevitTools.extension/pyRevit.tab/Project.panel/ptools.stack3/Links.pulldown/ListDWGs.pushbutton/ListDWGs_script.py b/extensions/pyRevitTools.extension/pyRevit.tab/Project.panel/ptools.stack3/Links.pulldown/ListDWGs.pushbutton/ListDWGs_script.py
index 8ebfa29fd..bd16d00eb 100644
--- a/extensions/pyRevitTools.extension/pyRevit.tab/Project.panel/ptools.stack3/Links.pulldown/ListDWGs.pushbutton/ListDWGs_script.py
+++ b/extensions/pyRevitTools.extension/pyRevit.tab/Project.panel/ptools.stack3/Links.pulldown/ListDWGs.pushbutton/ListDWGs_script.py
@@ -53,7 +53,8 @@ def listdwgs(current_view_only=False):
output.print_md("####{}".format(link_mode))
for dwg in dwgInst[link_mode]:
dwg_id = dwg.Id
- dwg_name = dwg.LookupParameter("Name").AsString()
+ dwg_name = \
+ dwg.Parameter[DB.BuiltInParameter.IMPORT_SYMBOL_NAME].AsString()
dwg_workset = workset_table.GetWorkset(dwg.WorksetId).Name
dwg_instance_creator = \
DB.WorksharingUtils.GetWorksharingTooltipInfo(revit.doc,
diff --git a/extensions/pyRevitTools.extension/pyRevit.tab/Project.panel/ptools.stack3/Team.pulldown/Find Sheets With Elements Owned By Me.pushbutton/script.py b/extensions/pyRevitTools.extension/pyRevit.tab/Project.panel/ptools.stack3/Team.pulldown/Find Sheets With Elements Owned By Me.pushbutton/script.py
index 82272746b..df4074e29 100644
--- a/extensions/pyRevitTools.extension/pyRevit.tab/Project.panel/ptools.stack3/Team.pulldown/Find Sheets With Elements Owned By Me.pushbutton/script.py
+++ b/extensions/pyRevitTools.extension/pyRevit.tab/Project.panel/ptools.stack3/Team.pulldown/Find Sheets With Elements Owned By Me.pushbutton/script.py
@@ -45,9 +45,9 @@
filteredlist.append(sheet)
print('{0}{1}'
.format(
- sheet.LookupParameter('Sheet Number')
+ sheet.Parameter[DB.BuiltInParameter.SHEET_NUMBER]
.AsString().ljust(10),
- sheet.LookupParameter('Sheet Name')
+ sheet.Parameter[DB.BuiltInParameter.SHEET_NAME]
.AsString().ljust(50)
)
)
diff --git a/extensions/pyRevitTools.extension/pyRevit.tab/Selection.panel/select.stack3/Select.pulldown/Find And Select Entities Without Tags.pushbutton/script.py b/extensions/pyRevitTools.extension/pyRevit.tab/Selection.panel/select.stack3/Select.pulldown/Find And Select Entities Without Tags.pushbutton/script.py
index 847acc936..712c5423b 100644
--- a/extensions/pyRevitTools.extension/pyRevit.tab/Selection.panel/select.stack3/Select.pulldown/Find And Select Entities Without Tags.pushbutton/script.py
+++ b/extensions/pyRevitTools.extension/pyRevit.tab/Selection.panel/select.stack3/Select.pulldown/Find And Select Entities Without Tags.pushbutton/script.py
@@ -121,11 +121,12 @@
for elid in elements:
el = revit.doc.GetElement(elid)
try:
- typecomment = el.Symbol.LookupParameter('Type Comments')
+ tcomment_param = \
+ el.Symbol.Parameter[DB.BuiltInParameter.ALL_MODEL_TYPE_COMMENTS]
if el.Id.IntegerValue not in tagged_elements \
- and typecomment \
- and typecomment.HasValue \
- and ('auxiliary' not in typecomment.AsString().lower()):
+ and tcomment_param \
+ and tcomment_param.HasValue \
+ and ('auxiliary' not in tcomment_param.AsString().lower()):
untagged_elements.append(elid)
except Exception:
if el.Id.IntegerValue not in tagged_elements:
diff --git a/extensions/pyRevitTools.extension/pyRevit.tab/Selection.panel/select.stack3/Select.pulldown/Select All Clouds with Same Comment.pushbutton/script.py b/extensions/pyRevitTools.extension/pyRevit.tab/Selection.panel/select.stack3/Select.pulldown/Select All Clouds with Same Comment.pushbutton/script.py
index ff5edbaee..53e2da5cd 100644
--- a/extensions/pyRevitTools.extension/pyRevit.tab/Selection.panel/select.stack3/Select.pulldown/Select All Clouds with Same Comment.pushbutton/script.py
+++ b/extensions/pyRevitTools.extension/pyRevit.tab/Selection.panel/select.stack3/Select.pulldown/Select All Clouds with Same Comment.pushbutton/script.py
@@ -21,13 +21,15 @@
src_comment = None
for el in selection.elements:
if isinstance(el, DB.RevisionCloud):
- src_comment = el.LookupParameter('Comments').AsString()
+ cparam = el.Parameter[DB.BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS]
+ src_comment = cparam.AsString()
# find matching clouds
if src_comment:
clouds = []
for revcloud in revclouds:
- dest_comment = revcloud.LookupParameter('Comments').AsString()
+ cparam = el.Parameter[DB.BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS]
+ dest_comment = cparam.AsString()
if src_comment == dest_comment:
clouds.append(revcloud.Id)
diff --git a/extensions/pyRevitTutor.extension/pyRevitTutor.tab/Sessions.panel/Session 2.pushbutton/total volume_script.py b/extensions/pyRevitTutor.extension/pyRevitTutor.tab/Sessions.panel/Session 2.pushbutton/total volume_script.py
index 1b1b56036..f7e4d610e 100644
--- a/extensions/pyRevitTutor.extension/pyRevitTutor.tab/Sessions.panel/Session 2.pushbutton/total volume_script.py
+++ b/extensions/pyRevitTutor.extension/pyRevitTutor.tab/Sessions.panel/Session 2.pushbutton/total volume_script.py
@@ -17,7 +17,7 @@
total_volume = 0.0
for wall in wall_collector:
- vol_param = wall.LookupParameter('Volume')
+ vol_param = wall.Parameter[DB.BuiltInParameter.HOST_VOLUME_COMPUTED]
if vol_param:
total_volume = total_volume + vol_param.AsDouble()
diff --git a/extensions/pyRevitTutor.extension/pyRevitTutor.tab/Sessions.panel/Session 4.pushbutton/firsttransaction_script.py b/extensions/pyRevitTutor.extension/pyRevitTutor.tab/Sessions.panel/Session 4.pushbutton/firsttransaction_script.py
index 8d104e05d..7652271cf 100644
--- a/extensions/pyRevitTutor.extension/pyRevitTutor.tab/Sessions.panel/Session 4.pushbutton/firsttransaction_script.py
+++ b/extensions/pyRevitTutor.extension/pyRevitTutor.tab/Sessions.panel/Session 4.pushbutton/firsttransaction_script.py
@@ -23,7 +23,7 @@
t.Start()
for sheet in sheets_collector:
- custom_param = sheet.LookupParameter('Comments')
+ custom_param = sheet.Parameter[DB.BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS]
if custom_param:
custom_param.Set("Example value")
diff --git a/extensions/pyRevitTutor.extension/pyRevitTutor.tab/Sessions.panel/Session 5.pulldown/Collector.pushbutton/script.py b/extensions/pyRevitTutor.extension/pyRevitTutor.tab/Sessions.panel/Session 5.pulldown/Collector.pushbutton/script.py
index a1c6e151e..aed16d999 100644
--- a/extensions/pyRevitTutor.extension/pyRevitTutor.tab/Sessions.panel/Session 5.pulldown/Collector.pushbutton/script.py
+++ b/extensions/pyRevitTutor.extension/pyRevitTutor.tab/Sessions.panel/Session 5.pulldown/Collector.pushbutton/script.py
@@ -25,7 +25,7 @@
tallwalls_ids = []
for wall in walls:
- heightp = wall.LookupParameter('Unconnected Height')
+ heightp = wall.Parameter[DB.BuiltInParameter.WALL_USER_HEIGHT_PARAM]
if heightp and heightp.AsDouble() == 10.0:
tallwalls_ids.append(wall.Id)
diff --git a/pyrevitlib/pyrevit/__init__.py b/pyrevitlib/pyrevit/__init__.py
index cc65a8f2a..b34236d75 100644
--- a/pyrevitlib/pyrevit/__init__.py
+++ b/pyrevitlib/pyrevit/__init__.py
@@ -38,7 +38,7 @@
PYREVIT_ADDON_NAME = 'pyRevit'
VERSION_MAJOR = 4
VERSION_MINOR = 6
-BUILD_METADATA = '.6'
+BUILD_METADATA = '.7'
# -----------------------------------------------------------------------------
# config environment paths
@@ -53,9 +53,6 @@
# BIN directory
BIN_DIR = op.join(HOME_DIR, 'bin')
-# default extensions directory
-EXTENSIONS_DEFAULT_DIR = op.join(HOME_DIR, 'extensions')
-
# main pyrevit lib folders
MAIN_LIB_DIR = op.join(HOME_DIR, 'pyrevitlib')
MISC_LIB_DIR = op.join(HOME_DIR, 'site-packages')
@@ -493,10 +490,16 @@ def result_dict(self):
USER_ROAMING_DIR = os.getenv('appdata')
USER_SYS_TEMP = os.getenv('temp')
USER_DESKTOP = op.expandvars('%userprofile%\\desktop')
+
# verify directory per issue #369
if not USER_DESKTOP or not op.exists(USER_DESKTOP):
USER_DESKTOP = USER_SYS_TEMP
+# default extensions directory
+EXTENSIONS_DEFAULT_DIR = op.join(HOME_DIR, 'extensions')
+THIRDPARTY_EXTENSIONS_DEFAULT_DIR = \
+ op.join(USER_ROAMING_DIR, PYREVIT_ADDON_NAME, 'Extensions')
+
# create paths for pyrevit files
if EXEC_PARAMS.doc_mode:
PYREVIT_ALLUSER_APP_DIR = PYREVIT_APP_DIR = PYREVIT_VERSION_APP_DIR = ' '
@@ -509,7 +512,9 @@ def result_dict(self):
# add runtime paths to sys.paths
# this will allow importing any dynamically compiled DLLs that
# would be placed under this paths.
- for pyrvt_app_dir in [PYREVIT_APP_DIR, PYREVIT_VERSION_APP_DIR]:
+ for pyrvt_app_dir in [PYREVIT_APP_DIR,
+ PYREVIT_VERSION_APP_DIR,
+ THIRDPARTY_EXTENSIONS_DEFAULT_DIR]:
if not op.isdir(pyrvt_app_dir):
try:
os.mkdir(pyrvt_app_dir)
@@ -532,28 +537,43 @@ def result_dict(self):
PYREVIT_FILE_PREFIX_STAMPED_USER = None
else:
# e.g. pyRevit_
- PYREVIT_FILE_PREFIX_UNIVERSAL = '{}'.format(PYREVIT_ADDON_NAME)
+ PYREVIT_FILE_PREFIX_UNIVERSAL = '{}_'.format(PYREVIT_ADDON_NAME)
+ PYREVIT_FILE_PREFIX_UNIVERSAL_REGEX = \
+ r'^' + PYREVIT_ADDON_NAME + r'_(?P.+)'
# e.g. pyRevit_2018_
- PYREVIT_FILE_PREFIX = '{}_{}'.format(PYREVIT_ADDON_NAME,
- HOST_APP.version)
+ PYREVIT_FILE_PREFIX = '{}_{}_'.format(PYREVIT_ADDON_NAME,
+ HOST_APP.version)
+ PYREVIT_FILE_PREFIX_REGEX = \
+ r'^' + PYREVIT_ADDON_NAME + r'_(?P\d{4})_(?P.+)'
# e.g. pyRevit_2018_14422_
- PYREVIT_FILE_PREFIX_STAMPED = '{}_{}_{}'.format(PYREVIT_ADDON_NAME,
- HOST_APP.version,
- HOST_APP.proc_id)
+ PYREVIT_FILE_PREFIX_STAMPED = '{}_{}_{}_'.format(PYREVIT_ADDON_NAME,
+ HOST_APP.version,
+ HOST_APP.proc_id)
+ PYREVIT_FILE_PREFIX_STAMPED_REGEX = \
+ r'^' + PYREVIT_ADDON_NAME \
+ + r'_(?P\d{4})_(?P\d+)_(?P.+)'
# e.g. pyRevit_eirannejad_
- PYREVIT_FILE_PREFIX_UNIVERSAL_USER = '{}_{}'.format(PYREVIT_ADDON_NAME,
- HOST_APP.username)
+ PYREVIT_FILE_PREFIX_UNIVERSAL_USER = '{}_{}_'.format(PYREVIT_ADDON_NAME,
+ HOST_APP.username)
+ PYREVIT_FILE_PREFIX_UNIVERSAL_USER_REGEX = \
+ r'^' + PYREVIT_ADDON_NAME + r'_(?P.+)_(?P.+)'
# e.g. pyRevit_2018_eirannejad_
- PYREVIT_FILE_PREFIX_USER = '{}_{}_{}'.format(PYREVIT_ADDON_NAME,
- HOST_APP.version,
- HOST_APP.username)
+ PYREVIT_FILE_PREFIX_USER = '{}_{}_{}_'.format(PYREVIT_ADDON_NAME,
+ HOST_APP.version,
+ HOST_APP.username)
+ PYREVIT_FILE_PREFIX_USER_REGEX = \
+ r'^' + PYREVIT_ADDON_NAME \
+ + r'_(?P\d{4})_(?P.+)_(?P.+)'
# e.g. pyRevit_2018_eirannejad_14422_
- PYREVIT_FILE_PREFIX_STAMPED_USER = '{}_{}_{}_{}'.format(PYREVIT_ADDON_NAME,
- HOST_APP.version,
- HOST_APP.username,
- HOST_APP.proc_id)
+ PYREVIT_FILE_PREFIX_STAMPED_USER = '{}_{}_{}_{}_'.format(PYREVIT_ADDON_NAME,
+ HOST_APP.version,
+ HOST_APP.username,
+ HOST_APP.proc_id)
+ PYREVIT_FILE_PREFIX_STAMPED_USER_REGEX = \
+ r'^' + PYREVIT_ADDON_NAME \
+ + r'_(?P\d{4})_(?P.+)_(?P\d+)_(?P.+)'
diff --git a/pyrevitlib/pyrevit/coreutils/appdata.py b/pyrevitlib/pyrevit/coreutils/appdata.py
index bc635f36c..3fa0adf27 100644
--- a/pyrevitlib/pyrevit/coreutils/appdata.py
+++ b/pyrevitlib/pyrevit/coreutils/appdata.py
@@ -13,14 +13,15 @@
import os.path as op
import re
-from pyrevit import PYREVIT_APP_DIR, PYREVIT_VERSION_APP_DIR, EXEC_PARAMS
-from pyrevit import PYREVIT_FILE_PREFIX_UNIVERSAL,\
- PYREVIT_FILE_PREFIX, PYREVIT_FILE_PREFIX_STAMPED
+import pyrevit
+from pyrevit import EXEC_PARAMS, HOST_APP
from pyrevit.coreutils import make_canonical_name
-from pyrevit.coreutils.logger import get_logger
+from pyrevit.coreutils import logger
+from pyrevit.labs import TargetApps
+
#pylint: disable=W0703,C0302
-mlogger = get_logger(__name__) #pylint: disable=C0103
+mlogger = logger.get_logger(__name__) #pylint: disable=C0103
TEMP_FILE_EXT = 'tmp'
@@ -37,9 +38,9 @@ def _list_app_files(prefix, file_ext, universal=False):
requested_files = []
if universal:
- appdata_folder = PYREVIT_APP_DIR
+ appdata_folder = pyrevit.PYREVIT_APP_DIR
else:
- appdata_folder = PYREVIT_VERSION_APP_DIR
+ appdata_folder = pyrevit.PYREVIT_VERSION_APP_DIR
for appdata_file in os.listdir(appdata_folder):
if appdata_file.startswith(prefix) and appdata_file.endswith(file_ext):
@@ -50,16 +51,16 @@ def _list_app_files(prefix, file_ext, universal=False):
def _get_app_file(file_id, file_ext,
filename_only=False, stamped=False, universal=False):
- appdata_folder = PYREVIT_VERSION_APP_DIR
- file_prefix = PYREVIT_FILE_PREFIX
+ appdata_folder = pyrevit.PYREVIT_VERSION_APP_DIR
+ file_prefix = pyrevit.PYREVIT_FILE_PREFIX
if stamped:
- file_prefix = PYREVIT_FILE_PREFIX_STAMPED
+ file_prefix = pyrevit.PYREVIT_FILE_PREFIX_STAMPED
elif universal:
- appdata_folder = PYREVIT_APP_DIR
- file_prefix = PYREVIT_FILE_PREFIX_UNIVERSAL
+ appdata_folder = pyrevit.PYREVIT_APP_DIR
+ file_prefix = pyrevit.PYREVIT_FILE_PREFIX_UNIVERSAL
- full_filename = '{}_{}.{}'.format(file_prefix, file_id, file_ext)
+ full_filename = '{}{}.{}'.format(file_prefix, file_id, file_ext)
if filename_only:
return full_filename
@@ -67,6 +68,45 @@ def _get_app_file(file_id, file_ext,
return op.join(appdata_folder, full_filename)
+def _match_file(file_name):
+ match = re.match(pattern=pyrevit.PYREVIT_FILE_PREFIX_STAMPED_USER_REGEX,
+ string=file_name)
+ if match:
+ return match.groupdict()
+
+ # e.g. pyRevit_2018_14422_
+ match = re.match(pattern=pyrevit.PYREVIT_FILE_PREFIX_STAMPED_REGEX,
+ string=file_name)
+ if match:
+ return match.groupdict()
+
+ # e.g. pyRevit_2018_eirannejad_
+ match = re.match(pattern=pyrevit.PYREVIT_FILE_PREFIX_USER_REGEX,
+ string=file_name)
+ if match:
+ return match.groupdict()
+
+ # e.g. pyRevit_2018_
+ match = re.match(pattern=pyrevit.PYREVIT_FILE_PREFIX_REGEX,
+ string=file_name)
+ if match:
+ return match.groupdict()
+
+ # e.g. pyRevit_eirannejad_
+ match = re.match(pattern=pyrevit.PYREVIT_FILE_PREFIX_UNIVERSAL_USER_REGEX,
+ string=file_name)
+ if match:
+ return match.groupdict()
+
+ # e.g. pyRevit_
+ match = re.match(pattern=pyrevit.PYREVIT_FILE_PREFIX_UNIVERSAL_REGEX,
+ string=file_name)
+ if match:
+ return match.groupdict()
+
+ return {}
+
+
def get_universal_data_file(file_id, file_ext, name_only=False):
"""Get path to file that is shared between all host versions.
@@ -128,7 +168,7 @@ def is_pyrevit_data_file(file_name):
Returns:
bool: True if file is a pyRevit data file
"""
- return PYREVIT_FILE_PREFIX in file_name
+ return pyrevit.PYREVIT_FILE_PREFIX in file_name
def is_file_available(file_name, file_ext, universal=False):
@@ -143,10 +183,10 @@ def is_file_available(file_name, file_ext, universal=False):
str: file path if file is available
"""
if universal:
- full_filename = op.join(PYREVIT_APP_DIR,
+ full_filename = op.join(pyrevit.PYREVIT_APP_DIR,
make_canonical_name(file_name, file_ext))
else:
- full_filename = op.join(PYREVIT_VERSION_APP_DIR,
+ full_filename = op.join(pyrevit.PYREVIT_VERSION_APP_DIR,
make_canonical_name(file_name, file_ext))
if op.exists(full_filename):
return full_filename
@@ -181,7 +221,7 @@ def list_data_files(file_ext, universal=False):
Returns:
:obj:`list`: list of files
"""
- return _list_app_files(PYREVIT_FILE_PREFIX, file_ext, universal=universal)
+ return _list_app_files(pyrevit.PYREVIT_FILE_PREFIX, file_ext, universal=universal)
def list_session_data_files(file_ext):
@@ -194,7 +234,7 @@ def list_session_data_files(file_ext):
:obj:`list`: list of data files
"""
- return _list_app_files(PYREVIT_FILE_PREFIX_STAMPED, file_ext)
+ return _list_app_files(pyrevit.PYREVIT_FILE_PREFIX_STAMPED, file_ext)
def garbage_data_file(file_path):
@@ -211,12 +251,18 @@ def garbage_data_file(file_path):
def cleanup_appdata_folder():
"""Cleanup appdata folder of all temporary appdata files."""
if EXEC_PARAMS.first_load:
- finder = re.compile(r'(.+)_(.+)_(.+)_(\d+).+')
- for appdata_file in os.listdir(PYREVIT_VERSION_APP_DIR):
- file_name_pieces = finder.findall(appdata_file)
- if file_name_pieces \
- and len(file_name_pieces[0]) == 4 \
- and int(file_name_pieces[0][3]) > 0 \
- and appdata_file.endswith(TEMP_FILE_EXT):
- _remove_app_file(op.join(PYREVIT_VERSION_APP_DIR,
- appdata_file))
+ hostapp_pids = \
+ [x.ProcessId
+ for x in TargetApps.Revit.RevitController.ListRunningRevits()]
+ for appdata_file in os.listdir(pyrevit.PYREVIT_VERSION_APP_DIR):
+ file_naming_dict = _match_file(appdata_file)
+ if 'pid' in file_naming_dict:
+ try:
+ pid = int(file_naming_dict['pid'])
+ if pid not in hostapp_pids:
+ _remove_app_file(
+ op.join(pyrevit.PYREVIT_VERSION_APP_DIR,
+ appdata_file)
+ )
+ except Exception:
+ pass
diff --git a/pyrevitlib/pyrevit/coreutils/logger.py b/pyrevitlib/pyrevit/coreutils/logger.py
index 8350d7188..fef827cff 100644
--- a/pyrevitlib/pyrevit/coreutils/logger.py
+++ b/pyrevitlib/pyrevit/coreutils/logger.py
@@ -45,7 +45,7 @@
# Creating default file log name and status
-FILE_LOG_FILENAME = '{}.log'.format(PYREVIT_FILE_PREFIX_STAMPED)
+FILE_LOG_FILENAME = '{}runtime.log'.format(PYREVIT_FILE_PREFIX_STAMPED)
FILE_LOG_FILEPATH = os.path.join(PYREVIT_VERSION_APP_DIR, FILE_LOG_FILENAME)
FILE_LOGGING_DEFAULT_STATE = False
diff --git a/pyrevitlib/pyrevit/coreutils/ribbon.py b/pyrevitlib/pyrevit/coreutils/ribbon.py
index 8a427cc93..4af60a626 100644
--- a/pyrevitlib/pyrevit/coreutils/ribbon.py
+++ b/pyrevitlib/pyrevit/coreutils/ribbon.py
@@ -44,6 +44,7 @@ class PyRevitUIError(PyRevitException):
class _ButtonIcons(object):
def __init__(self, file_address):
self.icon_file_path = file_address
+ self.check_icon_size()
self.filestream = IO.FileStream(file_address,
IO.FileMode.Open,
IO.FileAccess.Read)
@@ -63,6 +64,16 @@ def recolour(image_data, size, stride, color):
image_data[idx+1] = color >> 8 & 0xff # green
image_data[idx+2] = color >> 16 & 0xff # red
+ def check_icon_size(self):
+ image = System.Drawing.Image.FromFile(self.icon_file_path)
+ image_size = max(image.Width, image.Height)
+ if image_size > 96:
+ mlogger.warning('Icon file is too large. Large icons adversely '
+ 'affect the load time since they need to be '
+ 'processed and adjusted for screen scaling. '
+ 'Keep icons at max 96x96 pixels: %s',
+ self.icon_file_path)
+
def create_bitmap(self, icon_size):
mlogger.debug('Creating %sx%s bitmap from: %s',
icon_size, icon_size, self.icon_file_path)
@@ -70,6 +81,7 @@ def create_bitmap(self, icon_size):
adjusted_dpi = DEFAULT_DPI * 2
screen_scaling = HOST_APP.proc_screen_scalefactor
+ self.filestream.Seek(0, IO.SeekOrigin.Begin)
base_image = Imaging.BitmapImage()
base_image.BeginInit()
base_image.StreamSource = self.filestream
diff --git a/pyrevitlib/pyrevit/forms/ImageListContainerStyle.xaml b/pyrevitlib/pyrevit/forms/ImageListContainerStyle.xaml
new file mode 100644
index 000000000..817b86052
--- /dev/null
+++ b/pyrevitlib/pyrevit/forms/ImageListContainerStyle.xaml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/pyrevitlib/pyrevit/forms/ImageListPanelStyle.xaml b/pyrevitlib/pyrevit/forms/ImageListPanelStyle.xaml
new file mode 100644
index 000000000..6a88def75
--- /dev/null
+++ b/pyrevitlib/pyrevit/forms/ImageListPanelStyle.xaml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/pyrevitlib/pyrevit/forms/SelectFromList.xaml b/pyrevitlib/pyrevit/forms/SelectFromList.xaml
index e39674c3d..d13e7653e 100644
--- a/pyrevitlib/pyrevit/forms/SelectFromList.xaml
+++ b/pyrevitlib/pyrevit/forms/SelectFromList.xaml
@@ -8,13 +8,13 @@
-
+
-
+
@@ -28,9 +28,13 @@
Visibility="{Binding checkable}"/>
+ Template="{DynamicResource ItemTemplate}"/>
+
+
+
+
@@ -84,6 +88,8 @@
+ ScrollViewer.HorizontalScrollBarVisibility="Disabled"
+ ItemTemplate="{DynamicResource ItemContainerTemplate}"
+ ItemsPanel="{DynamicResource ItemsPanelTemplate}" />
diff --git a/pyrevitlib/pyrevit/forms/__init__.py b/pyrevitlib/pyrevit/forms/__init__.py
index 87f630f1c..9d1d56da1 100644
--- a/pyrevitlib/pyrevit/forms/__init__.py
+++ b/pyrevitlib/pyrevit/forms/__init__.py
@@ -148,14 +148,8 @@ def set_image_source(self, element_name, image_file):
os.path.join(EXEC_PARAMS.command_path,
image_file)
)
- # wpfel.Source = \
- # framework.Imaging.BitmapImage(
- # framework.Uri(os.path.join(EXEC_PARAMS.command_path,
- # image_file))
- # )
else:
- wpfel.Source = \
- framework.Imaging.BitmapImage(framework.Uri(image_file))
+ wpfel.Source = utils.bitmap_from_file(image_file)
@staticmethod
def hide_element(*wpf_elements):
@@ -438,14 +432,18 @@ def _setup(self, **kwargs):
self.ctx_groups_active = kwargs.get('default_group', None)
# check for custom templates
- item_template = kwargs.get('item_template', None)
- if item_template:
- self.Resources["ListItemTemplate"] = item_template
+ items_panel_template = kwargs.get('items_panel_template', None)
+ if items_panel_template:
+ self.Resources["ItemsPanelTemplate"] = items_panel_template
item_container_template = kwargs.get('item_container_template', None)
if item_container_template:
- self.Resources["ListItemContainerTemplate"] = \
- item_container_template
+ self.Resources["ItemContainerTemplate"] = item_container_template
+
+ item_template = kwargs.get('item_template', None)
+ if item_template:
+ self.Resources["ItemTemplate"] = \
+ item_template
# nicely wrap and prepare context for presentation, then present
self._prepare_context()
@@ -1600,7 +1598,7 @@ def select_titleblocks(title='Select Titleblock',
revit.ElementWrapper(tb).name): tb.Id
for tb in titleblocks}
tblock_dict[no_tb_option] = DB.ElementId.InvalidElementId
- selected_titleblocks = SelectFromList.show(tblock_dict.keys(),
+ selected_titleblocks = SelectFromList.show(sorted(tblock_dict.keys()),
title=title,
button_name=button_name,
width=width,
@@ -1628,21 +1626,71 @@ def select_swatch(title='Select Color Swatch', button_name='Select'):
>>> forms.select_swatch(title="Select Text Color")
...
"""
- ict_xaml_file = \
+ itemplate_xaml_file = \
os.path.join(op.dirname(__file__), "SwatchContainerStyle.xaml")
- ict = wpf.LoadComponent(Controls.ControlTemplate(), ict_xaml_file)
+ itemplate = \
+ wpf.LoadComponent(Controls.ControlTemplate(), itemplate_xaml_file)
swatch = SelectFromList.show(
colors.COLORS.values(),
title=title,
button_name=button_name,
width=300,
multiselect=False,
- item_container_template=ict
+ item_template=itemplate
)
return swatch
+def select_image(images, title='Select Image', button_name='Select'):
+ """Standard form for selecting an image.
+
+ Args:
+ images (str | framework.Imaging.BitmapImage):
+ list of image file paths or bitmaps
+ title (str, optional): swatch list window title
+ button_name (str, optional): swatch list window button caption
+
+ Returns:
+ str : path of the selected image
+
+ Example:
+ >>> from pyrevit import forms
+ >>> forms.select_image(title="Select Variation")
+ ... c:/path/to/image.png
+ """
+ ptemplate_xaml_file = \
+ os.path.join(op.dirname(__file__), "ImageListPanelStyle.xaml")
+ ptemplate = \
+ wpf.LoadComponent(Controls.ItemsPanelTemplate(), ptemplate_xaml_file)
+
+ itemplate_xaml_file = \
+ os.path.join(op.dirname(__file__), "ImageListContainerStyle.xaml")
+ itemplate = \
+ wpf.LoadComponent(Controls.ControlTemplate(), itemplate_xaml_file)
+
+ bitmap_images = {}
+ for imageobj in images:
+ if isinstance(imageobj, str):
+ img = utils.bitmap_from_file(imageobj)
+ if img:
+ bitmap_images[img] = imageobj
+ elif isinstance(imageobj, framework.Imaging.BitmapImage):
+ bitmap_images[imageobj] = imageobj
+
+ selected_image = SelectFromList.show(
+ sorted(bitmap_images.keys(), key=lambda x: x.UriSource.AbsolutePath),
+ title=title,
+ button_name=button_name,
+ width=500,
+ multiselect=False,
+ item_template=itemplate,
+ items_panel_template=ptemplate
+ )
+
+ return bitmap_images.get(selected_image, None)
+
+
def alert(msg, title=None, sub_msg=None, expanded=None, footer='',
ok=True, cancel=False, yes=False, no=False, retry=False,
warn_icon=True, exitscript=False):
diff --git a/pyrevitlib/pyrevit/loader/basetypes/__init__.py b/pyrevitlib/pyrevit/loader/basetypes/__init__.py
index 5c0abd487..ea4542fd5 100644
--- a/pyrevitlib/pyrevit/loader/basetypes/__init__.py
+++ b/pyrevitlib/pyrevit/loader/basetypes/__init__.py
@@ -28,9 +28,9 @@
'Microsoft', 'Framework', '.NETFramework')
try:
- FRAMEWORK_DIRS = os.listdir(DOTNET_SDK_DIR)
+ FRAMEWORK_DIRS = sorted(os.listdir(DOTNET_SDK_DIR), reverse=True)
except Exception as dotnet_sdk_err:
- FRAMEWORK_DIRS = None
+ FRAMEWORK_DIRS = []
mlogger.debug('Dotnet SDK is not installed. | %s', dotnet_sdk_err)
else:
INTERFACE_TYPES_DIR = DOTNET_SDK_DIR = FRAMEWORK_DIRS = None
@@ -113,7 +113,7 @@ def _get_resource_file(resource_name):
def _get_framework_module(fw_module):
# start with the newest sdk folder and
# work backwards trying to find the dll
- for sdk_folder in reversed(FRAMEWORK_DIRS):
+ for sdk_folder in FRAMEWORK_DIRS:
fw_module_file = op.join(DOTNET_SDK_DIR,
sdk_folder,
make_canonical_name(fw_module,
diff --git a/pyrevitlib/pyrevit/loader/basetypes/scriptoutput.cs b/pyrevitlib/pyrevit/loader/basetypes/scriptoutput.cs
index 162def4fe..35cc375e3 100644
--- a/pyrevitlib/pyrevit/loader/basetypes/scriptoutput.cs
+++ b/pyrevitlib/pyrevit/loader/basetypes/scriptoutput.cs
@@ -29,13 +29,16 @@ public void EnablePyRevitTemplateWindowStyle() {
// setup template styles
Background = Brushes.White;
var glowColor = Color.FromArgb(0x66, 0x2c, 0x3e, 0x50);
- GlowBrush = new SolidColorBrush() { Color = glowColor };
- NonActiveGlowBrush = new SolidColorBrush() { Color = glowColor };
+ // activating glow on the window causes an exception in PresentationFramework on Revit 2019
+ // when closing Revit with pyRevit windows open.
+ //GlowBrush = new SolidColorBrush() { Color = glowColor };
+ //NonActiveGlowBrush = new SolidColorBrush() { Color = glowColor };
ResetIcon();
//ResizeBorderThickness = new Thickness(10);
- BorderThickness = new Thickness();
+ // added thickness after disabling glow brush due to a bug
+ BorderThickness = new Thickness(1);
WindowStartupLocation = WindowStartupLocation.Manual;
WindowTransitionsEnabled = false;
SaveWindowPosition = false;
diff --git a/pyrevitlib/pyrevit/revit/db/__init__.py b/pyrevitlib/pyrevit/revit/db/__init__.py
index 43b832cdc..994b9d892 100644
--- a/pyrevitlib/pyrevit/revit/db/__init__.py
+++ b/pyrevitlib/pyrevit/revit/db/__init__.py
@@ -92,7 +92,7 @@ def workset_id(self):
@property
def mark(self):
- mparam = self._wrapped.LookupParameter('Mark')
+ mparam = self._wrapped.Parameter[DB.BuiltInParameter.ALL_MODEL_MARK]
return mparam.AsString() if mparam else ''
@property
diff --git a/pyrevitlib/pyrevit/revit/db/query.py b/pyrevitlib/pyrevit/revit/db/query.py
index 7f15feedf..a73490f02 100644
--- a/pyrevitlib/pyrevit/revit/db/query.py
+++ b/pyrevitlib/pyrevit/revit/db/query.py
@@ -507,6 +507,15 @@ def get_builtincategory(cat_name_or_id, doc=None):
return bicat
+def get_builtinparameter(element, param_name, doc=None):
+ doc = doc or HOST_APP.doc
+ eparam = element.LookupParameter(param_name)
+ if eparam:
+ for biparam in DB.BuiltInParameter.GetValues(DB.BuiltInParameter):
+ if int(biparam) == eparam.Definition.Id.IntegerValue:
+ return biparam
+
+
def get_view_cutplane_offset(view):
viewrange = view.GetViewRange()
return viewrange.GetOffset(DB.PlanViewPlane.CutPlane)
diff --git a/pyrevitlib/pyrevit/revit/report.py b/pyrevitlib/pyrevit/revit/report.py
index e4efece41..7540ee531 100644
--- a/pyrevitlib/pyrevit/revit/report.py
+++ b/pyrevitlib/pyrevit/revit/report.py
@@ -1,5 +1,6 @@
""""Utility methods for reporting Revit data uniformly."""
+from pyrevit import DB
from pyrevit.output import PyRevitOutputWindow
from pyrevit.revit import db
@@ -18,8 +19,10 @@ def print_revision(rev, prefix='', print_id=True):
def print_sheet(sht, prefix='', print_id=True):
- outstr = '{}\t{}'.format(sht.LookupParameter('Sheet Number').AsString(),
- sht.LookupParameter('Sheet Name').AsString())
+ outstr = '{}\t{}'.format(
+ sht.Parameter[DB.BuiltInParameter.SHEET_NUMBER].AsString(),
+ sht.Parameter[DB.BuiltInParameter.SHEET_NAME].AsString()
+ )
if print_id:
outstr = PyRevitOutputWindow.linkify(sht.Id) + '\t' + outstr
print(prefix + outstr)
diff --git a/pyrevitlib/pyrevit/script.py b/pyrevitlib/pyrevit/script.py
index fadc0bef3..3a8794790 100644
--- a/pyrevitlib/pyrevit/script.py
+++ b/pyrevitlib/pyrevit/script.py
@@ -17,7 +17,6 @@
from pyrevit.coreutils import appdata
from pyrevit.coreutils import envvars
from pyrevit import framework
-from pyrevit import forms
from pyrevit import revit
from pyrevit import output
from pyrevit import versionmgr
@@ -322,14 +321,17 @@ def get_bundle_file(file_name):
return op.join(EXEC_PARAMS.command_path, file_name)
-def get_bundle_files():
+def get_bundle_files(sub_path=None):
"""Return full path to all file under current script bundle.
Returns:
list[str]: list of bundle file paths
"""
- return [op.join(EXEC_PARAMS.command_path, x)
- for x in os.listdir(EXEC_PARAMS.command_path)]
+ if sub_path:
+ command_path = op.join(EXEC_PARAMS.command_path, sub_path)
+ else:
+ command_path = EXEC_PARAMS.command_path
+ return [op.join(command_path, x) for x in os.listdir(command_path)]
def journal_write(data_key, msg):
diff --git a/pyrevitlib/pyrevit/userconfig.py b/pyrevitlib/pyrevit/userconfig.py
index 38d603a2f..33793b09f 100644
--- a/pyrevitlib/pyrevit/userconfig.py
+++ b/pyrevitlib/pyrevit/userconfig.py
@@ -35,7 +35,8 @@
import os
import os.path as op
-from pyrevit import EXEC_PARAMS, EXTENSIONS_DEFAULT_DIR, HOME_DIR
+from pyrevit import EXEC_PARAMS, HOME_DIR
+from pyrevit import EXTENSIONS_DEFAULT_DIR, THIRDPARTY_EXTENSIONS_DEFAULT_DIR
from pyrevit import PYREVIT_ALLUSER_APP_DIR, PYREVIT_APP_DIR
from pyrevit.labs import TargetApps
@@ -150,6 +151,8 @@ def get_thirdparty_ext_root_dirs(self):
:obj:`list`: list of strings. External user extension directories.
"""
dir_list = []
+ # add default ext path
+ dir_list.append(THIRDPARTY_EXTENSIONS_DEFAULT_DIR)
try:
dir_list.extend([op.expandvars(p)
for p in self.core.userextensions])
diff --git a/release/pyRevit.aip b/release/pyRevit.aip
index 0ff4948c2..e0ce731cc 100644
--- a/release/pyRevit.aip
+++ b/release/pyRevit.aip
@@ -1,7 +1,7 @@
-
+
-
+
@@ -27,10 +27,10 @@
-
+
-
+
@@ -426,7 +426,7 @@
-
+
@@ -1155,6 +1155,8 @@
+
+
@@ -5385,7 +5387,7 @@
-
+