Skip to content

Commit

Permalink
Merge branch 'develop' into release/46beta
Browse files Browse the repository at this point in the history
  • Loading branch information
eirannejad committed Oct 20, 2018
2 parents bf45832 + 9bcbd48 commit b1db3a8
Show file tree
Hide file tree
Showing 143 changed files with 1,582 additions and 756 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
extensions/*
!extensions/pyRevitCore.extension/
!extensions/pyRevitDevTools.extension/
!extensions/pyRevitTemplates.extension/
!extensions/pyRevitTools.extension/
!extensions/pyRevitTutor.extension/
!extensions/extensions.json
Expand Down
Binary file added bin/ControlzEx.pdb
Binary file not shown.
Binary file added bin/MahApps.Metro.pdb
Binary file not shown.
Binary file modified bin/pyRevitLabs.Common.dll
Binary file not shown.
Binary file modified bin/pyRevitLabs.Common.pdb
Binary file not shown.
Binary file modified bin/pyRevitLabs.CommonCLI.dll
Binary file not shown.
Binary file modified bin/pyRevitLabs.CommonCLI.pdb
Binary file not shown.
Binary file modified bin/pyRevitLabs.CommonWPF.dll
Binary file not shown.
Binary file added bin/pyRevitLabs.CommonWPF.pdb
Binary file not shown.
Binary file modified bin/pyRevitLabs.Language.dll
Binary file not shown.
Binary file modified bin/pyRevitLabs.Language.pdb
Binary file not shown.
Binary file modified bin/pyRevitLabs.TargetApps.Revit.dll
Binary file not shown.
Binary file modified bin/pyRevitLabs.TargetApps.Revit.pdb
Binary file not shown.
Binary file modified bin/pyRevitUpdater.exe
Binary file not shown.
Binary file modified bin/pyrevit.exe
Binary file not shown.
Binary file modified bin/pyrevit.pdb
Binary file not shown.
22 changes: 18 additions & 4 deletions dev/WPFEdit/WPFEdit/WPFEdit.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
Expand All @@ -8,11 +8,12 @@
<OutputType>WinExe</OutputType>
<RootNamespace>WPFEdit</RootNamespace>
<AssemblyName>WPFEdit</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand Down Expand Up @@ -55,12 +56,12 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="..\..\..\extensions\pyRevitCore.extension\pyRevit.tab\pyRevit.panel\Extensions.pushbutton\ExtensionsWindow.xaml">
<Page Include="..\..\..\extensions\pyRevitCore.extension\pyRevit.tab\pyRevit.panel\Extensions.smartbutton\ExtensionsWindow.xaml">
<Link>Core\ExtensionsWindow.xaml</Link>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="..\..\..\extensions\pyRevitCore.extension\pyRevit.tab\pyRevit.panel\Settings.pushbutton\SettingsWindow.xaml">
<Page Include="..\..\..\extensions\pyRevitCore.extension\pyRevit.tab\pyRevit.panel\Settings.smartbutton\SettingsWindow.xaml">
<Link>Core\SettingsWindow.xaml</Link>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
Expand All @@ -70,6 +71,11 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="..\..\..\extensions\pyRevitDevTools.extension\pyRevitDev.tab\Debug.panel\Unit Tests.pulldown\Test FillPatternViewer.pushbutton\TestFillPatternViewer.xaml">
<Link>Dev\TestFillPatternViewer.xaml</Link>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="..\..\..\extensions\pyRevitDevTools.extension\pyRevitDev.tab\Debug.panel\Usage Records.pushbutton\UsageRecordsWindow.xaml">
<Link>Debug\UsageRecordsWindow.xaml</Link>
<Generator>MSBuild:Compile</Generator>
Expand Down Expand Up @@ -100,6 +106,11 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="..\..\..\extensions\pyRevitTools.extension\pyRevit.tab\Modify.panel\edit1.stack3\ReValue.pushbutton\ReValueWindow.xaml">
<Link>Tools\ReValueWindow.xaml</Link>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="..\..\..\extensions\pyRevitTools.extension\pyRevit.tab\Modify.panel\Match.pushbutton\MatchConfigWindow.xaml">
<Link>Tools\MatchConfigWindow.xaml</Link>
<Generator>MSBuild:Compile</Generator>
Expand Down Expand Up @@ -154,5 +165,8 @@
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
3 changes: 3 additions & 0 deletions dev/WPFEdit/WPFEdit/app.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1"/></startup></configuration>
13 changes: 13 additions & 0 deletions dev/todo.todo
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,16 @@ pyrevit:
☐ the help uri for splitpushbutton doesn't work correctly e.g match tool
☐ slowly move collectors in List tool to db.query
☐ slowly phase out the extpackages module and user PyRevitLabs
☐ Globally change text styles:
☐ Text styles
☐ Dim types:
Linear
Angular
Radial
Diameter
Spot Elev
Spot Coord
Spot Slope
☐ Annotation Families:


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

from pyrevit.framework import List
from pyrevit import coreutils
Expand All @@ -22,7 +24,7 @@
'Views',
'View Templates',
'Viewports',
'Viewport Types',
'Element Types',
'Family Symbols',
'Levels',
'Scope Boxes',
Expand Down Expand Up @@ -172,17 +174,21 @@
str(v.Id).ljust(10),
revit.doc.GetElement(v.ViewId).ViewName))

elif selected_switch == 'Viewport Types':
vps = []
elif selected_switch == 'Element Types':
all_types = \
revit.query.get_types_by_class(DB.ElementType, doc=revit.doc)
etypes_dict = defaultdict(list)
for etype in all_types:
if etype.FamilyName:
etypes_dict[str(etype.FamilyName).strip()].append(etype)

cl_views = DB.FilteredElementCollector(revit.doc)
vptypes = cl_views.OfClass(DB.ElementType).ToElements()
for etype_name in sorted(etypes_dict.keys()):
etypes = etypes_dict[etype_name]
output.print_md('**{}**'.format(etype_name))
for et in etypes:
print('\t{} {}'.format(output.linkify(et.Id),
revit.ElementWrapper(et).name))

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

elif selected_switch == 'Family Symbols':
cl = DB.FilteredElementCollector(revit.doc)
Expand Down Expand Up @@ -249,14 +255,15 @@
elif selected_switch == 'External References':
location = revit.doc.PathName
try:
modelPath = DB.ModelPathUtils.ConvertUserVisiblePathToModelPath(location)
modelPath = \
DB.ModelPathUtils.ConvertUserVisiblePathToModelPath(location)
transData = DB.TransmissionData.ReadTransmissionData(modelPath)
externalReferences = transData.GetAllExternalFileReferenceIds()
for refId in externalReferences:
extRef = transData.GetLastSavedReferenceData(refId)
refpath = extRef.GetPath()
path = DB.ModelPathUtils.ConvertModelPathToUserVisiblePath(refpath)
if '' == path:
if not path:
path = '--NOT ASSIGNED--'
reftype = str(extRef.ExternalFileReferenceType) + ':'
print("{0}{1}".format(reftype.ljust(20), path))
Expand Down Expand Up @@ -305,7 +312,7 @@

views = []

if len(selection) == 0:
if selection:
cl_views = DB.FilteredElementCollector(revit.doc)
views = cl_views.OfCategory(DB.BuiltInCategory.OST_Views)\
.WhereElementIsNotElementType().ToElements()
Expand Down Expand Up @@ -405,11 +412,9 @@ def isline(line):
elif selected_switch == 'Data Schema Entities':
allElements = \
list(DB.FilteredElementCollector(revit.doc)
.WherePasses(
DB.LogicalOrFilter(DB.ElementIsElementTypeFilter(False),
DB.ElementIsElementTypeFilter(True))
)
)
.WherePasses(
DB.LogicalOrFilter(DB.ElementIsElementTypeFilter(False),
DB.ElementIsElementTypeFilter(True))))

guids = {sc.GUID.ToString(): sc.SchemaName
for sc in DB.ExtensibleStorage.Schema.ListSchemas()}
Expand Down Expand Up @@ -466,4 +471,3 @@ def isline(line):
.format(sheet.SheetNumber,
repr(sheetnum),
sheetnum_repr))

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:pyRevitLabs.TargetApps.Revit.Controls;assembly=pyRevitLabs.TargetApps.Revit"
Title="Test FillPatternPreview Control"
Width="300" ResizeMode="NoResize"
ShowInTaskbar="False" SizeToContent="Height"
WindowStartupLocation="CenterScreen"
ScrollViewer.VerticalScrollBarVisibility="Disabled"
HorizontalContentAlignment="Center">
<StackPanel Margin="10" HorizontalAlignment="Stretch">
<Label FontWeight="Bold">Pattern Name:</Label>
<ComboBox x:Name="pat_name_cb" Height="25px" SelectionChanged="fill_pattern_changed"/>
<DockPanel Margin="0,10,0,0" Height="250">
<controls:FillPatternViewerControl x:Name="fillpattern_control"/>
</DockPanel>
</StackPanel>
</Window>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#pylint: disable=C0111,E0401,C0103,W0201,W0613
from pyrevit import revit, DB
from pyrevit import forms
from pyrevit import script


logger = script.get_logger()
output = script.get_output()


class TestFillPatternViewer(forms.WPFWindow):
def __init__(self, xaml_file_name):
forms.WPFWindow.__init__(self, xaml_file_name)
self.pat_name_cb.ItemsSource = \
sorted([x.GetFillPattern().Name
for x in revit.query.get_all_fillpattern_elements(
DB.FillPatternTarget.Drafting
)])
self.pat_name_cb.SelectedIndex = 0

def fill_pattern_changed(self, sender, args):
selected_fillpattern = \
revit.query.get_fillpattern_element(
self.pat_name_cb.SelectedItem,
DB.FillPatternTarget.Drafting
).GetFillPattern()
if selected_fillpattern:
self.fillpattern_control.FillPattern = selected_fillpattern


TestFillPatternViewer('TestFillPatternViewer.xaml').show(modal=True)
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Run All Tests
-----
Engine Tests
pyRevitLabs Module Tests
Output Window Tests
Forms Module Tests
Revit Module Tests
Expand All @@ -20,3 +21,4 @@ Test Toast
Test XML
Test C# Script
Test DynamoBIM
Test FillPatternViewer
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
14 changes: 14 additions & 0 deletions extensions/pyRevitTemplates.extension/extension.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"builtin": "True",
"default_enabled": "False",
"type": "extension",
"rocket_mode_compatible": "True",
"name": "pyRevitTemplates",
"description": "Tools for maintaining Revit Templates",
"author": "Ehsan Iran-Nejad",
"author_profile": "https://keybase.io/ein",
"url": "https://github.com/eirannejad/pyRevit.git",
"website": "http://eirannejad.github.io/pyRevit/",
"image": "",
"dependencies": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
"""Generate filledregion swatches in active view."""
#pylint: disable=E0401,C0103
from pyrevit.framework import List
from pyrevit import revit, DB


MAX_WIDTH = 16
DIRECTION = 1 # OR -1


def make_title(base_point, fr_type):
tnote_typeid = \
revit.doc.GetDefaultElementTypeId(DB.ElementTypeGroup.TextNoteType)
DB.TextNote.Create(revit.doc,
revit.activeview.Id,
DB.XYZ(base_point.X, base_point.Y + 1, base_point.Z),
1/12.0,
revit.ElementWrapper(fr_type).name,
tnote_typeid
)


def make_filledregion_element(base_point, fr_type):
cloop = DB.CurveLoop()
cloop.Append(
DB.Line.CreateBound(
DB.XYZ(base_point.X, base_point.Y, base_point.Z),
DB.XYZ(base_point.X + 1, base_point.Y, base_point.Z)
)
)
cloop.Append(
DB.Line.CreateBound(
DB.XYZ(base_point.X + 1, base_point.Y, base_point.Z),
DB.XYZ(base_point.X + 1, base_point.Y + DIRECTION, base_point.Z)
)
)
cloop.Append(
DB.Line.CreateBound(
DB.XYZ(base_point.X + 1, base_point.Y + DIRECTION, base_point.Z),
DB.XYZ(base_point.X, base_point.Y + DIRECTION, base_point.Z)
)
)
cloop.Append(
DB.Line.CreateBound(
DB.XYZ(base_point.X, base_point.Y + DIRECTION, base_point.Z),
DB.XYZ(base_point.X, base_point.Y, base_point.Z)
)
)

DB.FilledRegion.Create(revit.doc,
fr_type.Id,
revit.activeview.Id,
List[DB.CurveLoop]([cloop]))


def make_swatch(index, fr_type):
row = 0 + (index / MAX_WIDTH)
col = index - (MAX_WIDTH * row)
base_point = DB.XYZ(col, row * DIRECTION, 0)
make_title(base_point, fr_type)
make_filledregion_element(base_point, fr_type)


filledregion_types = revit.query.get_types_by_class(DB.FilledRegionType)
with revit.Transaction('Generate FilledRegion Swatched'):
for idx, filledregion_type in enumerate(
sorted(filledregion_types,
key=lambda x: revit.ElementWrapper(x).name)):
make_swatch(idx, filledregion_type)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""Generate FilledRegion Swatches"""
#pylint: disable=E0401,C0103
from pyrevit import revit, DB


fillpats = revit.query.get_types_by_class(DB.FillPatternElement)
with revit.Transaction('Generate FilledRegion Types'):
for fillpat in fillpats:
if fillpat.Name.startswith('#'):
print(fillpat.Name)
filledregion_type = \
revit.create.create_filledregion(fillpat.Name, fillpat)
filledregion_type.ForegroundPatternColor = DB.Color(128, 128, 128)
filledregion_type.LineWeight = 1
filledregion_type.IsMasking = True
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions extensions/pyRevitTemplates.extension/pyRevit.tab/_layout
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Templates[afterall:]
Loading

0 comments on commit b1db3a8

Please sign in to comment.