Skip to content

Commit b1db3a8

Browse files
committed
Merge branch 'develop' into release/46beta
2 parents bf45832 + 9bcbd48 commit b1db3a8

File tree

143 files changed

+1582
-756
lines changed

Some content is hidden

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

143 files changed

+1582
-756
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
extensions/*
33
!extensions/pyRevitCore.extension/
44
!extensions/pyRevitDevTools.extension/
5+
!extensions/pyRevitTemplates.extension/
56
!extensions/pyRevitTools.extension/
67
!extensions/pyRevitTutor.extension/
78
!extensions/extensions.json

bin/ControlzEx.pdb

304 KB
Binary file not shown.

bin/MahApps.Metro.pdb

1.41 MB
Binary file not shown.

bin/pyRevitLabs.Common.dll

0 Bytes
Binary file not shown.

bin/pyRevitLabs.Common.pdb

0 Bytes
Binary file not shown.

bin/pyRevitLabs.CommonCLI.dll

0 Bytes
Binary file not shown.

bin/pyRevitLabs.CommonCLI.pdb

0 Bytes
Binary file not shown.

bin/pyRevitLabs.CommonWPF.dll

1 KB
Binary file not shown.

bin/pyRevitLabs.CommonWPF.pdb

43.5 KB
Binary file not shown.

bin/pyRevitLabs.Language.dll

0 Bytes
Binary file not shown.

bin/pyRevitLabs.Language.pdb

0 Bytes
Binary file not shown.

bin/pyRevitLabs.TargetApps.Revit.dll

5 KB
Binary file not shown.

bin/pyRevitLabs.TargetApps.Revit.pdb

8 KB
Binary file not shown.

bin/pyRevitUpdater.exe

8 KB
Binary file not shown.

bin/pyrevit.exe

0 Bytes
Binary file not shown.

bin/pyrevit.pdb

0 Bytes
Binary file not shown.

dev/WPFEdit/WPFEdit/WPFEdit.csproj

+18-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
44
<PropertyGroup>
@@ -8,11 +8,12 @@
88
<OutputType>WinExe</OutputType>
99
<RootNamespace>WPFEdit</RootNamespace>
1010
<AssemblyName>WPFEdit</AssemblyName>
11-
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
11+
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
1212
<FileAlignment>512</FileAlignment>
1313
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
1414
<WarningLevel>4</WarningLevel>
1515
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
16+
<TargetFrameworkProfile />
1617
</PropertyGroup>
1718
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1819
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -55,12 +56,12 @@
5556
<Generator>MSBuild:Compile</Generator>
5657
<SubType>Designer</SubType>
5758
</Page>
58-
<Page Include="..\..\..\extensions\pyRevitCore.extension\pyRevit.tab\pyRevit.panel\Extensions.pushbutton\ExtensionsWindow.xaml">
59+
<Page Include="..\..\..\extensions\pyRevitCore.extension\pyRevit.tab\pyRevit.panel\Extensions.smartbutton\ExtensionsWindow.xaml">
5960
<Link>Core\ExtensionsWindow.xaml</Link>
6061
<Generator>MSBuild:Compile</Generator>
6162
<SubType>Designer</SubType>
6263
</Page>
63-
<Page Include="..\..\..\extensions\pyRevitCore.extension\pyRevit.tab\pyRevit.panel\Settings.pushbutton\SettingsWindow.xaml">
64+
<Page Include="..\..\..\extensions\pyRevitCore.extension\pyRevit.tab\pyRevit.panel\Settings.smartbutton\SettingsWindow.xaml">
6465
<Link>Core\SettingsWindow.xaml</Link>
6566
<Generator>MSBuild:Compile</Generator>
6667
<SubType>Designer</SubType>
@@ -70,6 +71,11 @@
7071
<Generator>MSBuild:Compile</Generator>
7172
<SubType>Designer</SubType>
7273
</Page>
74+
<Page Include="..\..\..\extensions\pyRevitDevTools.extension\pyRevitDev.tab\Debug.panel\Unit Tests.pulldown\Test FillPatternViewer.pushbutton\TestFillPatternViewer.xaml">
75+
<Link>Dev\TestFillPatternViewer.xaml</Link>
76+
<Generator>MSBuild:Compile</Generator>
77+
<SubType>Designer</SubType>
78+
</Page>
7379
<Page Include="..\..\..\extensions\pyRevitDevTools.extension\pyRevitDev.tab\Debug.panel\Usage Records.pushbutton\UsageRecordsWindow.xaml">
7480
<Link>Debug\UsageRecordsWindow.xaml</Link>
7581
<Generator>MSBuild:Compile</Generator>
@@ -100,6 +106,11 @@
100106
<Generator>MSBuild:Compile</Generator>
101107
<SubType>Designer</SubType>
102108
</Page>
109+
<Page Include="..\..\..\extensions\pyRevitTools.extension\pyRevit.tab\Modify.panel\edit1.stack3\ReValue.pushbutton\ReValueWindow.xaml">
110+
<Link>Tools\ReValueWindow.xaml</Link>
111+
<Generator>MSBuild:Compile</Generator>
112+
<SubType>Designer</SubType>
113+
</Page>
103114
<Page Include="..\..\..\extensions\pyRevitTools.extension\pyRevit.tab\Modify.panel\Match.pushbutton\MatchConfigWindow.xaml">
104115
<Link>Tools\MatchConfigWindow.xaml</Link>
105116
<Generator>MSBuild:Compile</Generator>
@@ -154,5 +165,8 @@
154165
<ItemGroup>
155166
<Folder Include="Properties\" />
156167
</ItemGroup>
168+
<ItemGroup>
169+
<None Include="app.config" />
170+
</ItemGroup>
157171
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
158172
</Project>

dev/WPFEdit/WPFEdit/app.config

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1"/></startup></configuration>

dev/todo.todo

+13
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,16 @@ pyrevit:
88
☐ the help uri for splitpushbutton doesn't work correctly e.g match tool
99
☐ slowly move collectors in List tool to db.query
1010
☐ slowly phase out the extpackages module and user PyRevitLabs
11+
☐ Globally change text styles:
12+
☐ Text styles
13+
☐ Dim types:
14+
Linear
15+
Angular
16+
Radial
17+
Diameter
18+
Spot Elev
19+
Spot Coord
20+
Spot Slope
21+
☐ Annotation Families:
22+
23+

extensions/pyRevitCore.extension/pyRevit.tab/pyRevit.panel/tools.stack3/Spy.pulldown/List Elements.pushbutton/script.py

+24-20
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
__doc__ = 'Lists specific elements from the model database.'
1+
"""Lists specific elements from the model database."""
2+
#pylint: disable=C0103,E0401,W0703
3+
from collections import defaultdict
24

35
from pyrevit.framework import List
46
from pyrevit import coreutils
@@ -22,7 +24,7 @@
2224
'Views',
2325
'View Templates',
2426
'Viewports',
25-
'Viewport Types',
27+
'Element Types',
2628
'Family Symbols',
2729
'Levels',
2830
'Scope Boxes',
@@ -172,17 +174,21 @@
172174
str(v.Id).ljust(10),
173175
revit.doc.GetElement(v.ViewId).ViewName))
174176

175-
elif selected_switch == 'Viewport Types':
176-
vps = []
177+
elif selected_switch == 'Element Types':
178+
all_types = \
179+
revit.query.get_types_by_class(DB.ElementType, doc=revit.doc)
180+
etypes_dict = defaultdict(list)
181+
for etype in all_types:
182+
if etype.FamilyName:
183+
etypes_dict[str(etype.FamilyName).strip()].append(etype)
177184

178-
cl_views = DB.FilteredElementCollector(revit.doc)
179-
vptypes = cl_views.OfClass(DB.ElementType).ToElements()
185+
for etype_name in sorted(etypes_dict.keys()):
186+
etypes = etypes_dict[etype_name]
187+
output.print_md('**{}**'.format(etype_name))
188+
for et in etypes:
189+
print('\t{} {}'.format(output.linkify(et.Id),
190+
revit.ElementWrapper(et).name))
180191

181-
for tp in vptypes:
182-
wrapperd_tp = revit.ElementWrapper(tp)
183-
if tp.FamilyName == 'Viewport':
184-
print('ID: {1} TYPE: {0}'.format(wrapperd_tp.name,
185-
str(tp.Id).ljust(10)))
186192

187193
elif selected_switch == 'Family Symbols':
188194
cl = DB.FilteredElementCollector(revit.doc)
@@ -249,14 +255,15 @@
249255
elif selected_switch == 'External References':
250256
location = revit.doc.PathName
251257
try:
252-
modelPath = DB.ModelPathUtils.ConvertUserVisiblePathToModelPath(location)
258+
modelPath = \
259+
DB.ModelPathUtils.ConvertUserVisiblePathToModelPath(location)
253260
transData = DB.TransmissionData.ReadTransmissionData(modelPath)
254261
externalReferences = transData.GetAllExternalFileReferenceIds()
255262
for refId in externalReferences:
256263
extRef = transData.GetLastSavedReferenceData(refId)
257264
refpath = extRef.GetPath()
258265
path = DB.ModelPathUtils.ConvertModelPathToUserVisiblePath(refpath)
259-
if '' == path:
266+
if not path:
260267
path = '--NOT ASSIGNED--'
261268
reftype = str(extRef.ExternalFileReferenceType) + ':'
262269
print("{0}{1}".format(reftype.ljust(20), path))
@@ -305,7 +312,7 @@
305312

306313
views = []
307314

308-
if len(selection) == 0:
315+
if selection:
309316
cl_views = DB.FilteredElementCollector(revit.doc)
310317
views = cl_views.OfCategory(DB.BuiltInCategory.OST_Views)\
311318
.WhereElementIsNotElementType().ToElements()
@@ -405,11 +412,9 @@ def isline(line):
405412
elif selected_switch == 'Data Schema Entities':
406413
allElements = \
407414
list(DB.FilteredElementCollector(revit.doc)
408-
.WherePasses(
409-
DB.LogicalOrFilter(DB.ElementIsElementTypeFilter(False),
410-
DB.ElementIsElementTypeFilter(True))
411-
)
412-
)
415+
.WherePasses(
416+
DB.LogicalOrFilter(DB.ElementIsElementTypeFilter(False),
417+
DB.ElementIsElementTypeFilter(True))))
413418

414419
guids = {sc.GUID.ToString(): sc.SchemaName
415420
for sc in DB.ExtensibleStorage.Schema.ListSchemas()}
@@ -466,4 +471,3 @@ def isline(line):
466471
.format(sheet.SheetNumber,
467472
repr(sheetnum),
468473
sheetnum_repr))
469-
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3+
xmlns:controls="clr-namespace:pyRevitLabs.TargetApps.Revit.Controls;assembly=pyRevitLabs.TargetApps.Revit"
4+
Title="Test FillPatternPreview Control"
5+
Width="300" ResizeMode="NoResize"
6+
ShowInTaskbar="False" SizeToContent="Height"
7+
WindowStartupLocation="CenterScreen"
8+
ScrollViewer.VerticalScrollBarVisibility="Disabled"
9+
HorizontalContentAlignment="Center">
10+
<StackPanel Margin="10" HorizontalAlignment="Stretch">
11+
<Label FontWeight="Bold">Pattern Name:</Label>
12+
<ComboBox x:Name="pat_name_cb" Height="25px" SelectionChanged="fill_pattern_changed"/>
13+
<DockPanel Margin="0,10,0,0" Height="250">
14+
<controls:FillPatternViewerControl x:Name="fillpattern_control"/>
15+
</DockPanel>
16+
</StackPanel>
17+
</Window>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#pylint: disable=C0111,E0401,C0103,W0201,W0613
2+
from pyrevit import revit, DB
3+
from pyrevit import forms
4+
from pyrevit import script
5+
6+
7+
logger = script.get_logger()
8+
output = script.get_output()
9+
10+
11+
class TestFillPatternViewer(forms.WPFWindow):
12+
def __init__(self, xaml_file_name):
13+
forms.WPFWindow.__init__(self, xaml_file_name)
14+
self.pat_name_cb.ItemsSource = \
15+
sorted([x.GetFillPattern().Name
16+
for x in revit.query.get_all_fillpattern_elements(
17+
DB.FillPatternTarget.Drafting
18+
)])
19+
self.pat_name_cb.SelectedIndex = 0
20+
21+
def fill_pattern_changed(self, sender, args):
22+
selected_fillpattern = \
23+
revit.query.get_fillpattern_element(
24+
self.pat_name_cb.SelectedItem,
25+
DB.FillPatternTarget.Drafting
26+
).GetFillPattern()
27+
if selected_fillpattern:
28+
self.fillpattern_control.FillPattern = selected_fillpattern
29+
30+
31+
TestFillPatternViewer('TestFillPatternViewer.xaml').show(modal=True)

extensions/pyRevitDevTools.extension/pyRevitDev.tab/Debug.panel/Unit Tests.pulldown/_layout

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Run All Tests
22
-----
33
Engine Tests
4+
pyRevitLabs Module Tests
45
Output Window Tests
56
Forms Module Tests
67
Revit Module Tests
@@ -20,3 +21,4 @@ Test Toast
2021
Test XML
2122
Test C# Script
2223
Test DynamoBIM
24+
Test FillPatternViewer
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"builtin": "True",
3+
"default_enabled": "False",
4+
"type": "extension",
5+
"rocket_mode_compatible": "True",
6+
"name": "pyRevitTemplates",
7+
"description": "Tools for maintaining Revit Templates",
8+
"author": "Ehsan Iran-Nejad",
9+
"author_profile": "https://keybase.io/ein",
10+
"url": "https://github.com/eirannejad/pyRevit.git",
11+
"website": "http://eirannejad.github.io/pyRevit/",
12+
"image": "",
13+
"dependencies": []
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
"""Generate filledregion swatches in active view."""
2+
#pylint: disable=E0401,C0103
3+
from pyrevit.framework import List
4+
from pyrevit import revit, DB
5+
6+
7+
MAX_WIDTH = 16
8+
DIRECTION = 1 # OR -1
9+
10+
11+
def make_title(base_point, fr_type):
12+
tnote_typeid = \
13+
revit.doc.GetDefaultElementTypeId(DB.ElementTypeGroup.TextNoteType)
14+
DB.TextNote.Create(revit.doc,
15+
revit.activeview.Id,
16+
DB.XYZ(base_point.X, base_point.Y + 1, base_point.Z),
17+
1/12.0,
18+
revit.ElementWrapper(fr_type).name,
19+
tnote_typeid
20+
)
21+
22+
23+
def make_filledregion_element(base_point, fr_type):
24+
cloop = DB.CurveLoop()
25+
cloop.Append(
26+
DB.Line.CreateBound(
27+
DB.XYZ(base_point.X, base_point.Y, base_point.Z),
28+
DB.XYZ(base_point.X + 1, base_point.Y, base_point.Z)
29+
)
30+
)
31+
cloop.Append(
32+
DB.Line.CreateBound(
33+
DB.XYZ(base_point.X + 1, base_point.Y, base_point.Z),
34+
DB.XYZ(base_point.X + 1, base_point.Y + DIRECTION, base_point.Z)
35+
)
36+
)
37+
cloop.Append(
38+
DB.Line.CreateBound(
39+
DB.XYZ(base_point.X + 1, base_point.Y + DIRECTION, base_point.Z),
40+
DB.XYZ(base_point.X, base_point.Y + DIRECTION, base_point.Z)
41+
)
42+
)
43+
cloop.Append(
44+
DB.Line.CreateBound(
45+
DB.XYZ(base_point.X, base_point.Y + DIRECTION, base_point.Z),
46+
DB.XYZ(base_point.X, base_point.Y, base_point.Z)
47+
)
48+
)
49+
50+
DB.FilledRegion.Create(revit.doc,
51+
fr_type.Id,
52+
revit.activeview.Id,
53+
List[DB.CurveLoop]([cloop]))
54+
55+
56+
def make_swatch(index, fr_type):
57+
row = 0 + (index / MAX_WIDTH)
58+
col = index - (MAX_WIDTH * row)
59+
base_point = DB.XYZ(col, row * DIRECTION, 0)
60+
make_title(base_point, fr_type)
61+
make_filledregion_element(base_point, fr_type)
62+
63+
64+
filledregion_types = revit.query.get_types_by_class(DB.FilledRegionType)
65+
with revit.Transaction('Generate FilledRegion Swatched'):
66+
for idx, filledregion_type in enumerate(
67+
sorted(filledregion_types,
68+
key=lambda x: revit.ElementWrapper(x).name)):
69+
make_swatch(idx, filledregion_type)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"""Generate FilledRegion Swatches"""
2+
#pylint: disable=E0401,C0103
3+
from pyrevit import revit, DB
4+
5+
6+
fillpats = revit.query.get_types_by_class(DB.FillPatternElement)
7+
with revit.Transaction('Generate FilledRegion Types'):
8+
for fillpat in fillpats:
9+
if fillpat.Name.startswith('#'):
10+
print(fillpat.Name)
11+
filledregion_type = \
12+
revit.create.create_filledregion(fillpat.Name, fillpat)
13+
filledregion_type.ForegroundPatternColor = DB.Color(128, 128, 128)
14+
filledregion_type.LineWeight = 1
15+
filledregion_type.IsMasking = True
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Templates[afterall:]

0 commit comments

Comments
 (0)