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

RevitApartmentPlans: Добавлен плагин "Планы квартир" #65

Merged
merged 40 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
beb51b8
Создать проект RevitApartmentPlans
vlastroG Jul 3, 2024
16aab04
Первая реализация алгоритма получения общего контура
vlastroG Jul 3, 2024
00aadfb
Убрал неиспользуемый код
vlastroG Jul 3, 2024
76eca80
Добавить комментарий
vlastroG Jul 3, 2024
718877b
Исправить направление линий в прямоугольном контуре
vlastroG Jul 3, 2024
217bdb7
Вынести сервисы для определения прямоугольных контуров и оффсета
vlastroG Jul 3, 2024
c93eac4
Заменить CreateViaOffset на метод сервиса
vlastroG Jul 4, 2024
eefd3c9
Добавление сервиса для создания видов
vlastroG Jul 4, 2024
d41339c
Переименовать BoundsCalculateService в BoundsCalculationService
vlastroG Jul 4, 2024
b99298d
Оптимизация алгоритма
vlastroG Jul 4, 2024
c66fac2
Добавление моделей представления. В процессе
vlastroG Jul 5, 2024
bd4f409
Добавление главного окна. В процессе
vlastroG Jul 5, 2024
0ee88fc
Скорректировать главное окно
vlastroG Jul 5, 2024
c81ab8b
Скорректировать GUI
vlastroG Jul 8, 2024
29589a7
Попытка добавления popup окна для добавления шаблона
vlastroG Jul 8, 2024
6aa9c76
Сделано отдельное окно для добавления фильтров
vlastroG Jul 9, 2024
5ea9e19
Сделать сохранение конфига
vlastroG Jul 9, 2024
14cef56
Подключить сервис создания планов к окну
vlastroG Jul 9, 2024
817dba5
Добавление прогресс бара
vlastroG Jul 9, 2024
577c4e7
Добавить проверку на активный план
vlastroG Jul 9, 2024
78d4de7
Добавить фильтрацию параметров
vlastroG Jul 9, 2024
9ae8aef
Добавить кнопку для выделения квартиры на плане
vlastroG Jul 9, 2024
b7088a6
Добавить конвертер для ViewType
vlastroG Jul 9, 2024
8e01ac2
Добавить упрощение контура
vlastroG Jul 9, 2024
d6de236
Сделать назначение прямоугольного контура в случае ошибки
vlastroG Jul 10, 2024
aa57d04
Скорректировать валидацию
vlastroG Jul 10, 2024
1eb7c25
Скорректировать GUI
vlastroG Jul 10, 2024
2caf6fa
Добавить обработку контуров помещений с самопересечениями
vlastroG Jul 12, 2024
0e24057
Вынести конвертер в в dosymep
vlastroG Jul 12, 2024
7bf2a68
Рефакторинг
vlastroG Jul 12, 2024
5ca3c8a
Убрать пустые блоки xml комментариев
vlastroG Jul 12, 2024
940f09d
Скорректировать создание пустого ForgeTypeId
vlastroG Jul 12, 2024
6b2c4b6
Скорректировать метод получения граней солида
vlastroG Jul 12, 2024
c144980
Скорректировать форматирование комментариев
vlastroG Jul 12, 2024
93cdf29
Добавил проверку на null в CreateViews
vlastroG Jul 12, 2024
d72933e
Разнести генерацию контуров на отдельные строки
vlastroG Jul 12, 2024
e828c7c
Дополнить сообщение об ошибке
vlastroG Jul 12, 2024
dc390c6
Рефакторинг
vlastroG Jul 12, 2024
ecf7085
Заменить TryMergeSolids на CreateUnitedSolids из dosymep.Revit.Geometry
vlastroG Jul 15, 2024
29f1988
Скорректировать тип ValueConversion
vlastroG Jul 15, 2024
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.RevitApartmentPlans.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: publish RevitApartmentPlans

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

env:
plugin-name: "RevitApartmentPlans"

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.RevitApartmentPlans.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "./build.schema.json",
"Solution": "RevitPlugins.sln",
"PluginName": "RevitApartmentPlans",
"PublishDirectory": "02.AR.extension\\АР.tab\\bin",
"RevitVersions": [
"Rv2022",
"Rv2023",
"Rv2024"
],
"IconUrl": "https://icons8.com/icon/14376/floor-plan",
"BundleName": "Планы квартир",
"BundleType": "InvokeButton",
"BundleOutput": "02.AR.extension\\АР.tab\\Документация.panel"
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
| 24. | Удалить марки помещений | [RevitRemoveRoomTags](src/RevitRemoveRoomTags) | [Confluence]() | [АР](https://github.com/dosymep/ARExtensions) | Прочее |
| 25. | Отделка стен | [RevitFinishingWalls](src/RevitFinishingWalls) | [Confluence]() | [АР](https://github.com/Bim4Everyone/ARExtensions) | РД |
| 26. | Конструктор секций | [RevitSectionsConstructor](src/RevitSectionsConstructor) | [Confluence]() | [BIM](https://github.com/Bim4Everyone/BIMExtensions)| ОПП |
| 27. | Планы квартир | [RevitApartmentPlans](src/RevitApartmentPlans) | [Confluence]() | [АР](https://github.com/Bim4Everyone/ARExtensions) | Документация |

# Сборка проекта

Expand Down
17 changes: 17 additions & 0 deletions RevitPlugins.sln
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dosymep", "dosymep", "{0647
src\dosymep\PlatformWindow.cs = src\dosymep\PlatformWindow.cs
src\dosymep\RelayCommand.cs = src\dosymep\RelayCommand.cs
src\dosymep\RelayCommand.T.cs = src\dosymep\RelayCommand.T.cs
src\dosymep\RevitViewTypeConverter.cs = src\dosymep\RevitViewTypeConverter.cs
src\dosymep\ThemedPlatformWindow.cs = src\dosymep\ThemedPlatformWindow.cs
EndProjectSection
EndProject
Expand Down Expand Up @@ -296,6 +297,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RevitFinishingWalls", "src\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RevitReinforcementCoefficient", "src\RevitReinforcementCoefficient\RevitReinforcementCoefficient.csproj", "{BA555C42-F0F2-4C1F-9AC7-0B5E76B1B4A9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RevitApartmentPlans", "src\RevitApartmentPlans\RevitApartmentPlans.csproj", "{C2BD63D9-4E08-4DBC-8945-1495D92E1A7B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
D2020|x64 = D2020|x64
Expand Down Expand Up @@ -805,6 +808,20 @@ Global
{BA555C42-F0F2-4C1F-9AC7-0B5E76B1B4A9}.Debug|x64.Build.0 = Debug|x64
{BA555C42-F0F2-4C1F-9AC7-0B5E76B1B4A9}.Release|x64.ActiveCfg = Release|x64
{BA555C42-F0F2-4C1F-9AC7-0B5E76B1B4A9}.Release|x64.Build.0 = Release|x64
{C2BD63D9-4E08-4DBC-8945-1495D92E1A7B}.D2020|x64.ActiveCfg = D2020|x64
{C2BD63D9-4E08-4DBC-8945-1495D92E1A7B}.D2020|x64.Build.0 = D2020|x64
{C2BD63D9-4E08-4DBC-8945-1495D92E1A7B}.D2021|x64.ActiveCfg = D2021|x64
{C2BD63D9-4E08-4DBC-8945-1495D92E1A7B}.D2021|x64.Build.0 = D2021|x64
{C2BD63D9-4E08-4DBC-8945-1495D92E1A7B}.D2022|x64.ActiveCfg = D2022|x64
{C2BD63D9-4E08-4DBC-8945-1495D92E1A7B}.D2022|x64.Build.0 = D2022|x64
{C2BD63D9-4E08-4DBC-8945-1495D92E1A7B}.D2023|x64.ActiveCfg = D2023|x64
{C2BD63D9-4E08-4DBC-8945-1495D92E1A7B}.D2023|x64.Build.0 = D2023|x64
{C2BD63D9-4E08-4DBC-8945-1495D92E1A7B}.D2024|x64.ActiveCfg = D2024|x64
{C2BD63D9-4E08-4DBC-8945-1495D92E1A7B}.D2024|x64.Build.0 = D2024|x64
{C2BD63D9-4E08-4DBC-8945-1495D92E1A7B}.Debug|x64.ActiveCfg = D2020|x64
{C2BD63D9-4E08-4DBC-8945-1495D92E1A7B}.Debug|x64.Build.0 = D2020|x64
{C2BD63D9-4E08-4DBC-8945-1495D92E1A7B}.Release|x64.ActiveCfg = D2020|x64
{C2BD63D9-4E08-4DBC-8945-1495D92E1A7B}.Release|x64.Build.0 = D2020|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
1 change: 1 addition & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
<Compile Include="..\dosymep\RelayCommand.T.cs" Link="dosymep\BaseCommands\RelayCommand.T.cs"/>
<Compile Include="..\dosymep\AsyncRelayCommand.cs" Link="dosymep\BaseCommands\AsyncRelayCommand.cs"/>
<Compile Include="..\dosymep\AsyncRelayCommand.T.cs" Link="dosymep\BaseCommands\AsyncRelayCommand.T.cs"/>
<Compile Include="..\dosymep\RevitViewTypeConverter.cs" Link="dosymep\Converters\RevitViewTypeConverter.cs"/>
</ItemGroup>

<ItemGroup Condition="$(RevitVersion) != ''">
Expand Down
58 changes: 58 additions & 0 deletions src/RevitApartmentPlans/Models/Apartment.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;

using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Architecture;

namespace RevitApartmentPlans.Models {
internal class Apartment {
private readonly ICollection<Room> _rooms;

/// <summary>
/// Конструктор квартиры на основе коллекции помещений.
/// </summary>
/// <param name="rooms">Коллекция помещений квартиры, в которой находися как минимум 1 элемент.
/// Также все помещения квартиры должны быть на одном и том же уровне.</param>
/// <param name="name">Название квартиры.</param>
/// <exception cref="ArgumentNullException">Исключение, если один из обязательных параметров null</exception>
/// <exception cref="ArgumentOutOfRangeException">Исключение, если коллекция помещений пустая</exception>
/// <exception cref="ArgumentException">Исключение, если помещения расположены на разных уровнях</exception>
public Apartment(ICollection<Room> rooms, string name) {
if(rooms is null) {
throw new ArgumentNullException(nameof(rooms));
}
if(string.IsNullOrWhiteSpace(name)) {
throw new ArgumentNullException(nameof(name));
}
if(rooms.Count == 0) {
throw new ArgumentOutOfRangeException(nameof(rooms));
}
if(rooms.Select(r => r.LevelId).Distinct().Count() != 1) {
throw new ArgumentException($"Помещения квартиры {name} расположены на разных уровнях.");
}

_rooms = rooms;
Name = name;
Level level = rooms.First().Level;
dosymep marked this conversation as resolved.
Show resolved Hide resolved
LevelName = level.Name;
LevelId = level.Id;
}


/// <summary>
/// Номер квартиры
/// </summary>
public string Name { get; }

public ElementId LevelId { get; }

public string LevelName { get; }


public IReadOnlyCollection<Room> GetRooms() {
return new ReadOnlyCollection<Room>(_rooms.ToArray());
}
}
}
43 changes: 43 additions & 0 deletions src/RevitApartmentPlans/Models/PluginConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using Autodesk.Revit.DB;

using dosymep.Bim4Everyone;
using dosymep.Bim4Everyone.ProjectConfigs;
using dosymep.Serializers;

using pyRevitLabs.Json;

namespace RevitApartmentPlans.Models {
internal class PluginConfig : ProjectConfig<RevitSettings> {
[JsonIgnore] public override string ProjectConfigPath { get; set; }

[JsonIgnore] public override IConfigSerializer Serializer { get; set; }

public static PluginConfig GetPluginConfig() {
return new ProjectConfigBuilder()
.SetSerializer(new ConfigSerializer())
.SetPluginName(nameof(RevitApartmentPlans))
.SetRevitVersion(ModuleEnvironment.RevitVersion)
.SetProjectConfigName(nameof(PluginConfig) + ".json")
.Build<PluginConfig>();
}
}

internal class RevitSettings : ProjectSettings {
public override string ProjectName { get; set; }

/// <summary>
/// Наружный отступ в мм от контура квартиры
/// </summary>
public double OffsetMm { get; set; }

/// <summary>
/// Название параметра для группировки помещений по квартирам
/// </summary>
public string ParamName { get; set; }
dosymep marked this conversation as resolved.
Show resolved Hide resolved

/// <summary>
/// Id всех выбранных пользователем шаблонов видов для создания планов
/// </summary>
public ElementId[] ViewTemplates { get; set; }
}
}
Loading
Loading