Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RevitRefreshLinks: Создан плагин по добавлению и обновлению связей #164

Open
wants to merge 69 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
c22f2bd
Создан новый плагин RevitRefreshLinks
vlastroG Jan 14, 2025
7073e38
Убрать лишние файлы и скорректировать названия
vlastroG Jan 14, 2025
4e06b3c
Добавление старой разметки окна обновления связей
vlastroG Jan 14, 2025
61ed1ff
Добавление основных классов
vlastroG Jan 14, 2025
2c77ed9
Реализация команды по добавлению связей из папки
vlastroG Jan 15, 2025
8262217
Скорректировать локализацию для добавления связей из папок
vlastroG Jan 15, 2025
df07ea7
Скорректировать логику добавления связей
vlastroG Jan 16, 2025
24bcd08
Скорректировать опции загрузки связей с RS
vlastroG Jan 16, 2025
8b1fd6b
Рефакторинг
vlastroG Jan 16, 2025
410355c
Добавление заглушки для получения связей с RS
vlastroG Jan 16, 2025
1be12e7
Рефакторинг
vlastroG Jan 16, 2025
10467fb
Базовая реализация выбора папок локально и из RS
vlastroG Jan 16, 2025
45315d5
Рефакторинг
vlastroG Jan 16, 2025
75b8998
Промежуточные изменения команды по обновлению связей
vlastroG Jan 16, 2025
b68442c
Рефакторинг
vlastroG Jan 16, 2025
3ed1271
Тестовая разметка окна
vlastroG Jan 16, 2025
63281a7
Реализация поиска источников связей и кнопок GUI
vlastroG Jan 17, 2025
e4fabb9
Решение бага с использованием DynamicResource в DataGrid.Header
vlastroG Jan 17, 2025
020b337
Добавление валидации
vlastroG Jan 17, 2025
ca97998
Добавил напоминание в комментарии
vlastroG Jan 22, 2025
2195f35
Скорректировать разметку и стили
vlastroG Jan 29, 2025
825d508
Добавить назначение статуса источника на старте окна
vlastroG Jan 29, 2025
75bb85e
Скорректировать словари для локализации
vlastroG Jan 29, 2025
da41091
Добавить запуск обновления связей
vlastroG Jan 29, 2025
6367fcd
Добавил интерфейсы для выбора файлов и папок
vlastroG Jan 30, 2025
7f23f37
Добавил классы для окон диалогов для RS
vlastroG Feb 5, 2025
c18fba1
Добавление интерфейсов для работы с файлами
vlastroG Feb 10, 2025
3c56b97
Первичная реализация работы с RS
vlastroG Feb 11, 2025
8057bfb
Добавление классов для работы с окном и рефакторинг
vlastroG Feb 11, 2025
a8fd598
Подключение окна выбора папок с RS
vlastroG Feb 12, 2025
16e765e
Подключение окна выбора файлов с RS и рефакторинг
vlastroG Feb 12, 2025
94aa093
Добавить заготовку окна выбора файлов с RS
vlastroG Feb 12, 2025
095c15d
Добавил запуск окна выбора файлов с RS
vlastroG Feb 13, 2025
68f48c2
Убрать ненужные файлы
vlastroG Feb 13, 2025
7805618
Добавить открытие вложенного каталога
vlastroG Feb 13, 2025
2e3e5aa
Заглушки для работы с файловой системой вместо RS (для быстроты отлад…
vlastroG Feb 13, 2025
c3a8df0
Скорректировать высоту списка файлов
vlastroG Feb 13, 2025
7636653
Вернуть ListBox
vlastroG Feb 13, 2025
606960f
Добавить иконки
vlastroG Feb 14, 2025
295b693
Скорректировать открытие папки на двойной клик
vlastroG Feb 14, 2025
4557867
Добавить историю открытых директорий
vlastroG Feb 17, 2025
d80d4ba
Добавить получение выбранных файлов
vlastroG Feb 17, 2025
600fdc3
Добавить фильтр файлов
vlastroG Feb 17, 2025
eb60dcc
Обновление строк локализации
vlastroG Feb 17, 2025
4952fe9
Добавить команду обновления контента директории
vlastroG Feb 17, 2025
6254abf
Добавить в CanExecute проверку на выполняющиеся команды
vlastroG Feb 18, 2025
49b257b
Добавить прогресс бар
vlastroG Feb 18, 2025
54c6480
Добавить конвертер для красивого размера файла
vlastroG Feb 18, 2025
120f02f
Скорректировать загрузку содержимого директорий
vlastroG Feb 18, 2025
42a40e6
Добавить горизонтальный скролл на shift+mouse scroll
vlastroG Feb 18, 2025
8ab404a
Скорректировать конвертер для SelectionMode
vlastroG Feb 18, 2025
0a7975c
Исправить ошибку с преобразованием типов
vlastroG Feb 18, 2025
8b60dd1
Подключить RS
vlastroG Feb 18, 2025
e72c8cb
Merge branch 'master' into vlastroG/RevitRefreshLinks
vlastroG Feb 18, 2025
ed5ab58
Рефакторинг
vlastroG Feb 18, 2025
6d04ac0
Убрать лишнюю проверку
vlastroG Feb 18, 2025
3bbb7b9
Обновить GUI
vlastroG Feb 18, 2025
c3e1e6a
Скорректировать получение абсолютного пути
vlastroG Feb 19, 2025
63ddf33
Скорректировать создание окон
vlastroG Feb 19, 2025
d93b9e2
Исправить проблемы с путями
vlastroG Feb 19, 2025
3b40fe7
Подключение обозревателя папок на RS
vlastroG Feb 19, 2025
1ebc210
Исправление ошибок с путями
vlastroG Feb 19, 2025
96f025b
Исправление ошибок обновления связей
vlastroG Feb 19, 2025
287c6cb
Добавить прогресс
vlastroG Feb 19, 2025
7bb1edd
Скорректировать строки локализации
vlastroG Feb 19, 2025
a001243
Убрать тестовый код
vlastroG Feb 19, 2025
35a4a4d
Убрать тестовый код
vlastroG Feb 19, 2025
cba398f
Удалить неиспользуемый код
vlastroG Feb 19, 2025
29bee76
Дополнить локализацию
vlastroG Feb 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/publish.RevitRefreshLinks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: publish RevitRefreshLinks

on:
workflow_dispatch:
pull_request:
types: [ closed, synchronize, review_requested ]
branches: [ main, master ]
paths:
- '**RevitRefreshLinks**.cs'
- '**RevitRefreshLinks**.xaml'

env:
plugin-name: "RevitRefreshLinks"

jobs:
build:
name: build
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

# Install the .NET workload
- name: Install .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

# Add DevExrepress package source: https://nuget.devexpress.com/
- name: Add DevExpress package source
run: dotnet nuget add source https://nuget.devexpress.com/api -n DXFeed -u DevExpress -p ${{ secrets.DEVEXPRESS_FEED_AUTHORIZATION_KEY }}

- name: Run './build.cmd '
run: ./build.cmd publish --profile ${{ env.plugin-name }} --pull-request-merged ${{ github.event.pull_request.merged }} --extensions-app-token ${{ secrets.EXTENSIONS_APP_TOKEN }} --revit-plugins-app-token ${{ secrets.REVIT_PLUGINS_APP_TOKEN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15 changes: 15 additions & 0 deletions .nuke/parameters.RevitRefreshLinks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "./build.schema.json",
"Solution": "RevitPlugins.sln",
"PluginName": "RevitRefreshLinks",
"PublishDirectory": "01.BIM.extension\\BIM.tab\\bin",
"RevitVersions": [
"Rv2022",
"Rv2023",
"Rv2024"
],
"IconUrl": "https://icons8.com/icon/16013/broken-link",
"BundleName": "Обновить связанные файлы",
"BundleType": "InvokeButton",
"BundleOutput": "01.BIM.extension\\BIM.tab\\Связи.panel\\Связи rvt.pulldown"
}
16 changes: 16 additions & 0 deletions RevitPlugins.sln
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RevitValueModifier", "src\R
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RevitMirroredElements", "src\RevitMirroredElements\RevitMirroredElements.csproj", "{827319DD-D76C-4757-9DF0-220BCB852135}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RevitRefreshLinks", "src\RevitRefreshLinks\RevitRefreshLinks.csproj", "{9B394C2C-5966-4C1F-9161-1F2DF1C3E383}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RevitMarkingElements", "src\RevitMarkingElements\RevitMarkingElements.csproj", "{9107CDD3-CC16-4AC3-A811-A0C29D415F2A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RevitRoomExtrusion", "src\RevitRoomExtrusion\RevitRoomExtrusion.csproj", "{16E3C594-3896-431E-8537-B807E6E53A2A}"
Expand Down Expand Up @@ -956,6 +958,20 @@ Global
{827319DD-D76C-4757-9DF0-220BCB852135}.Debug|x64.Build.0 = D2020|x64
{827319DD-D76C-4757-9DF0-220BCB852135}.Release|x64.ActiveCfg = D2020|x64
{827319DD-D76C-4757-9DF0-220BCB852135}.Release|x64.Build.0 = D2020|x64
{9B394C2C-5966-4C1F-9161-1F2DF1C3E383}.D2020|x64.ActiveCfg = D2020|x64
{9B394C2C-5966-4C1F-9161-1F2DF1C3E383}.D2020|x64.Build.0 = D2020|x64
{9B394C2C-5966-4C1F-9161-1F2DF1C3E383}.D2021|x64.ActiveCfg = D2021|x64
{9B394C2C-5966-4C1F-9161-1F2DF1C3E383}.D2021|x64.Build.0 = D2021|x64
{9B394C2C-5966-4C1F-9161-1F2DF1C3E383}.D2022|x64.ActiveCfg = D2022|x64
{9B394C2C-5966-4C1F-9161-1F2DF1C3E383}.D2022|x64.Build.0 = D2022|x64
{9B394C2C-5966-4C1F-9161-1F2DF1C3E383}.D2023|x64.ActiveCfg = D2023|x64
{9B394C2C-5966-4C1F-9161-1F2DF1C3E383}.D2023|x64.Build.0 = D2023|x64
{9B394C2C-5966-4C1F-9161-1F2DF1C3E383}.D2024|x64.ActiveCfg = D2024|x64
{9B394C2C-5966-4C1F-9161-1F2DF1C3E383}.D2024|x64.Build.0 = D2024|x64
{9B394C2C-5966-4C1F-9161-1F2DF1C3E383}.Debug|x64.ActiveCfg = D2020|x64
{9B394C2C-5966-4C1F-9161-1F2DF1C3E383}.Debug|x64.Build.0 = D2020|x64
{9B394C2C-5966-4C1F-9161-1F2DF1C3E383}.Release|x64.ActiveCfg = D2020|x64
{9B394C2C-5966-4C1F-9161-1F2DF1C3E383}.Release|x64.Build.0 = D2020|x64
{9107CDD3-CC16-4AC3-A811-A0C29D415F2A}.D2020|x64.ActiveCfg = D2020|x64
{9107CDD3-CC16-4AC3-A811-A0C29D415F2A}.D2020|x64.Build.0 = D2020|x64
{9107CDD3-CC16-4AC3-A811-A0C29D415F2A}.D2021|x64.ActiveCfg = D2021|x64
Expand Down
127 changes: 127 additions & 0 deletions src/RevitRefreshLinks/Extensions/NinjectExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;

using dosymep.Bim4Everyone;
using dosymep.Revit.ServerClient;
using dosymep.SimpleServices;
using dosymep.WPF.Views;

using Ninject;

using RevitRefreshLinks.Services;
using RevitRefreshLinks.ViewModels;
using RevitRefreshLinks.Views;

namespace RevitRefreshLinks.Extensions {
internal static class NinjectExtensions {
/// <summary>
/// Добавляет в контейнер <see cref="IOpenFolderDialog"/>.
/// </summary>
/// <param name="kernel">Ninject контейнер.</param>
/// <param name="title">Заголовок окна. По умолчанию "Выбрать папку на RS".</param>
/// <param name="initialDirectory">Директория, открываемая по умолчанию.</param>
/// <param name="multiSelect">True - разрешает мультивыбор. По умолчанию отключено.</param>
/// <returns>Возвращает настроенный контейнер Ninject.</returns>
/// <exception cref="System.ArgumentNullException">kernel is null.</exception>
public static IKernel UseRsOpenFolderDialog(this IKernel kernel,
string title = "Выбрать папку на RS",
string initialDirectory = default,
bool multiSelect = false) {
if(kernel == null) {
throw new ArgumentNullException(nameof(kernel));
}

kernel.Bind<IFileSystem>()
.To<RsFileSystem>()
.WhenInjectedInto<DirectoriesExplorerViewModel>();

kernel.Bind<DirectoriesExplorerViewModel>()
.ToSelf()
.InSingletonScope();
kernel.Bind<DirectoriesExplorerWindow>()
.ToSelf()
.InTransientScope()
.WithPropertyValue(nameof(Window.DataContext),
c => c.Kernel.Get<DirectoriesExplorerViewModel>())
.WithPropertyValue(nameof(PlatformWindow.LocalizationService),
c => c.Kernel.Get<ILocalizationService>());
kernel.Bind<IDirectoriesExplorerWindowProvider>()
.To<ExplorerWindowProvider>()
.InSingletonScope();

kernel.Bind<IReadOnlyCollection<IServerClient>>()
.ToMethod(c => c.Kernel.Get<Autodesk.Revit.ApplicationServices.Application>()
.GetRevitServerNetworkHosts()
.Select(item => new ServerClientBuilder()
.SetServerName(item)
.SetServerVersion(ModuleEnvironment.RevitVersion)
.Build())
.ToArray());

kernel.Bind<IOpenFolderDialog>()
.To<RsOpenFolderDialog>()
.WithPropertyValue(nameof(IOpenFolderDialog.Title), title)
.WithPropertyValue(nameof(IOpenFolderDialog.InitialDirectory), initialDirectory)
.WithPropertyValue(nameof(IOpenFolderDialog.MultiSelect), multiSelect);

return kernel;
}

/// <summary>
/// Добавляет в контейнер <see cref="IOpenFileDialog"/>.
/// </summary>
/// <param name="kernel">Ninject контейнер.</param>
/// <param name="title">Заголовок окна. По умолчанию "Выбрать файлы с RS".</param>
/// <param name="initialDirectory">Директория, открываемая по умолчанию.</param>
/// <param name="multiSelect">True - разрешает мультивыбор. По умолчанию отключено.</param>
/// <returns>Возвращает настроенный контейнер Ninject.</returns>
/// <exception cref="System.ArgumentNullException">kernel is null.</exception>
public static IKernel UseRsOpenFileDialog(this IKernel kernel,
string title = "Выберите файлы с RS",
string initialDirectory = default,
bool multiSelect = false,
string filter = "*.rvt") {
if(kernel == null) {
throw new ArgumentNullException(nameof(kernel));
}

kernel.Bind<IFileSystem>()
.To<RsFileSystem>()
.WhenInjectedInto<FilesExplorerViewModel>();

kernel.Bind<FilesExplorerViewModel>()
.ToSelf()
.InSingletonScope();
kernel.Bind<FilesExplorerWindow>()
.ToSelf()
.InTransientScope()
.WithPropertyValue(nameof(Window.DataContext),
c => c.Kernel.Get<FilesExplorerViewModel>())
.WithPropertyValue(nameof(PlatformWindow.LocalizationService),
c => c.Kernel.Get<ILocalizationService>());
kernel.Bind<IFilesExplorerWindowProvider>()
.To<ExplorerWindowProvider>()
.InSingletonScope();

kernel.Bind<IReadOnlyCollection<IServerClient>>()
.ToMethod(c => c.Kernel.Get<Autodesk.Revit.ApplicationServices.Application>()
.GetRevitServerNetworkHosts()
.Select(item => new ServerClientBuilder()
.SetServerName(item)
.SetServerVersion(ModuleEnvironment.RevitVersion)
.Build())
.ToArray());

kernel.Bind<IOpenFileDialog>()
.To<RsOpenFileDialog>()
.WithPropertyValue(nameof(IOpenFileDialog.Title), title)
.WithPropertyValue(nameof(IOpenFileDialog.InitialDirectory), initialDirectory)
.WithPropertyValue(nameof(IOpenFileDialog.MultiSelect), multiSelect)
.WithPropertyValue(nameof(IOpenFileDialog.Filter), filter);

return kernel;
}
}
}
97 changes: 97 additions & 0 deletions src/RevitRefreshLinks/Localization/Language.en-US.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">

<system:String
x:Key="UpdateLinksWindow.Title">Link update</system:String>
<system:String
x:Key="UpdateLinksWindow.EmptySelectionCheck">Select links to update.</system:String>
<system:String
x:Key="UpdateLinksWindow.EmptySourcesCheck">Select source with link.</system:String>
<system:String
x:Key="UpdateLinksWindow.LocalFolder">Local source:</system:String>
<system:String
x:Key="UpdateLinksWindow.ServerFolder">Revit Server source:</system:String>
<system:String
x:Key="UpdateLinksWindow.List.LinkName.Header">Link name</system:String>
<system:String
x:Key="UpdateLinksWindow.List.Workset.Header">Workset status</system:String>
<system:String
x:Key="UpdateLinksWindow.List.Workset.Opened">Opened</system:String>
<system:String
x:Key="UpdateLinksWindow.List.Workset.Closed">Closed</system:String>
<system:String
x:Key="UpdateLinksWindow.List.Link.Header">Link status</system:String>
<system:String
x:Key="UpdateLinksWindow.List.Link.Loaded">Loaded</system:String>
<system:String
x:Key="UpdateLinksWindow.List.Link.Unloaded">Unloaded</system:String>
<system:String
x:Key="UpdateLinksWindow.List.Link.LocallyUnloaded">Locally unload</system:String>
<system:String
x:Key="UpdateLinksWindow.List.Link.NotFound">Not found</system:String>
<system:String
x:Key="UpdateLinksWindow.List.Link.ClosedWorkset">Closed workset</system:String>
<system:String
x:Key="UpdateLinksWindow.List.Link.Unknown">Unknown</system:String>
<system:String
x:Key="UpdateLinksWindow.List.Source.Header">Source</system:String>
<system:String
x:Key="UpdateLinksWindow.List.Source.Found">Found</system:String>
<system:String
x:Key="UpdateLinksWindow.List.Source.NotFound">Not found</system:String>
<system:String
x:Key="UpdateLinksWindow.List.Source.Duplicated">Duplicated</system:String>
<system:String
x:Key="UpdateLinksWindow.List.Button.SelectAll">Select all</system:String>
<system:String
x:Key="UpdateLinksWindow.List.Button.UnselectAll">Unselect all</system:String>
<system:String
x:Key="UpdateLinksWindow.List.Button.Invert">Invert</system:String>
<system:String
x:Key="UpdateLinksWindow.Buttons.SelectLocalFolder">Select local folder</system:String>
<system:String
x:Key="UpdateLinksWindow.Buttons.SelectServerFolder">Select RS folder</system:String>
<system:String
x:Key="UpdateLinksWindow.Progress.Title">Update links [{0}/{1}] ...</system:String>
<system:String
x:Key="SelectLinksFromFolderDialog.Title">Select links to add</system:String>
<system:String
x:Key="SelectLinksFromFolderDialog.Filter">Revit files (*.rvt)|*.rvt</system:String>

<system:String
x:Key="LinkLoader.Transaction.AddLinks">Add links</system:String>
<system:String
x:Key="LinkLoader.Error.Coordinates">File with different shared coordinates</system:String>
<system:String
x:Key="LinkLoader.Error.Version">File was created in a different Revit version</system:String>
<system:String
x:Key="LinkLoader.Error.AlreadyAdded">File has already been added</system:String>
<system:String
x:Key="MessageBox.Title.ErrorAddLink">Errors when adding links</system:String>
<system:String
x:Key="MessageBox.Title.ErrorUpdateLink">Errors when updating links</system:String>

<system:String
x:Key="SelectLocalFoldersDialog.Title">Select folders with links to update</system:String>

<system:String
x:Key="RsOpenFileWindow.Title">Select models from Revit Server</system:String>
<system:String
x:Key="RsOpenFileWindow.List.Name">Name</system:String>
<system:String
x:Key="RsOpenFileWindow.List.Size">Size</system:String>
<system:String
x:Key="RsOpenFileWindow.ExecutingCmdCheck">Wait for the previous command to complete</system:String>

<system:String
x:Key="DirectoriesExplorer.Title">Select folder from Revit Server</system:String>
<system:String
x:Key="DirectoriesExplorer.ExecutingCmdCheck">Wait for the previous command to complete</system:String>

<system:String
x:Key="AllWindow.Ok">OK</system:String>
<system:String
x:Key="AllWindow.Cancel">Cancel</system:String>
</ResourceDictionary>
Loading