调整代码

This commit is contained in:
GG Z
2026-02-22 20:03:42 +08:00
parent 2ad3d0fde0
commit 7e2d5be3cd
258 changed files with 2916 additions and 5013 deletions

View File

@@ -6,7 +6,7 @@ using Nice3point.Revit.Toolkit.External.Handlers;
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
using ShrlAlgoToolkit.RevitAddins.Windows;
using ShrlAlgoToolkit.RevitAddins.Common.Controls;
namespace ShrlAlgoToolkit.RevitAddins.RvCivil;

View File

@@ -6,7 +6,7 @@ using Autodesk.Revit.DB.IFC;
using Nice3point.Revit.Toolkit.External;
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
using ShrlAlgoToolkit.RevitAddins.Windows;
using ShrlAlgoToolkit.RevitAddins.Common.Controls;
namespace ShrlAlgoToolkit.RevitAddins.RvCivil;

View File

@@ -93,13 +93,13 @@
Grid.Column="0"
Grid.ColumnSpan="2"
Columns="1">
<ms:Card Content="{Binding ProjectBasePoint, StringFormat=项目基点:{}{0}}" />
<ms:Card Content="{Binding SharedBasePoint, StringFormat=测量点:{}{0}}" />
<ms:Card Margin="0,2" Content="{Binding ProjectBasePoint, StringFormat=项目基点:{}{0}}" />
<ms:Card Margin="0,2" Content="{Binding SharedBasePoint, StringFormat=测量点:{}{0}}" />
</UniformGrid>
<UniformGrid
Grid.Row="2"
Grid.Column="0"
Rows="3">
Rows="4">
<CheckBox
Content="管线坡度"
IsChecked="{Binding IsCheckSlope}"
@@ -120,14 +120,15 @@
Content="构件复杂度"
IsChecked="{Binding IsCheckSymbolGeometry}"
ToolTip="检查构件的复杂程度,避免模型导出、轻量化失败" />
<CheckBox
Content="属性检查"
IsChecked="{Binding IsCheckProps}"
ToolTip="检查构件属性是否存在,是否填写" />
<CheckBox
Content="重叠管线"
IsChecked="{Binding IsCheckEqual}"
ToolTip="检查管线是否重叠" />
<CheckBox
Content="属性检查"
IsChecked="{Binding IsCheckProps}"
ToolTip="检查构件属性是否存在,是否填写" />
<TextBox ms:InputAssist.PlaceholderText="请输入属性名,用分号分隔" Text="{Binding Properties, UpdateSourceTrigger=PropertyChanged}" />
</UniformGrid>
<UniformGrid
Grid.Row="2"
@@ -135,7 +136,7 @@
Rows="2">
<UniformGrid Rows="2">
<TextBlock Text="{Binding ErrorCount, Mode=TwoWay, StringFormat=错误数量:{}{0}}" TextWrapping="WrapWithOverflow" />
<CheckBox Content="使用剖切框" IsChecked="{Binding UseSectionBox}" />
<CheckBox Content="使用剖切框定位" IsChecked="{Binding UseSectionBox}" />
</UniformGrid>
<UniformGrid Rows="2">
<Button Command="{Binding CheckModelCommand}" Content="模型检查" />

View File

@@ -19,14 +19,14 @@ using MiniExcelLibs.OpenXml;
using Nice3point.Revit.Toolkit.External.Handlers;
using ShrlAlgoToolkit.RevitAddins.Windows;
using ShrlAlgoToolkit.RevitAddins.Common.Controls;
namespace ShrlAlgoToolkit.RevitAddins.ModelManager;
[UsedImplicitly]
public partial class ModelCheckViewModel : ObservableObject
{
private readonly CorrectReferLevelExecutes correctReferLevelExecutes;
private readonly Standardizer.CorrectReferLevelExecutes correctReferLevelExecutes;
private readonly ActionEventHandler modifyModel = new();
private readonly ActionEventHandler showElementsSectionBox = new();
@@ -37,7 +37,7 @@ public partial class ModelCheckViewModel : ObservableObject
Items = [];
var cv = CollectionViewSource.GetDefaultView(Items);
cv.GroupDescriptions.Add(new PropertyGroupDescription("ErrorMessage"));
correctReferLevelExecutes = new CorrectReferLevelExecutes(uiapp);
correctReferLevelExecutes = new Standardizer.CorrectReferLevelExecutes(uiapp);
this.uiapp = uiapp;
FindBasePoint();
}
@@ -71,7 +71,7 @@ public partial class ModelCheckViewModel : ObservableObject
if (IsCheckLevel)
{
var levels = doc.OfClass<Level>().OfType<Level>().OrderBy(l => l.Elevation);
var levelOutlines = CorrectReferLevelExecutes.GetRegions(levels);
var levelOutlines = Standardizer.CorrectReferLevelExecutes.GetRegions(levels);
foreach (var keyPair in levelOutlines)
{
//得到在标高范围内的元素
@@ -111,114 +111,18 @@ public partial class ModelCheckViewModel : ObservableObject
var id = item.Key;
var type = doc.GetElement(id);
var array = type.Name.Split('-');
if (array.Length >= 3)
{
var prefix = array[0].Trim();
if (
prefix
is not (
"QQ"
or "YT"
or "XL"
or "GJ"
or "CL"
or "JZ"
or "JG"
or "GP"
or "DZ"
or "TF"
or "GD"
or "TX"
or "XH"
or "ZS"
or "HB"
or "ZJ"
or "HJ"
or "CX"
or "MJ"
or "YK"
or "ZK"
or "ZT"
or "CJ"
or "XX"
or "TC"
or "NY"
or "ZB"
or "AF"
)
)
{
var errorItem = new MessageModel(type, "类型专业前缀错误");
Items.Add(errorItem);
}
}
else
if (array.Length < 3)
{
var errorItem = new MessageModel(type, "类型名称不符合三段式");
Items.Add(errorItem);
}
}
//var familyGroups = doc.OfClass<FamilyInstance>().ToElements().Cast<FamilyInstance>().GroupBy(instance => instance.Symbol.Family);
//foreach (var group in familyGroups)
//{
// var array = group.Key.Name.Split('-');
// if (array.Length >= 3)
// {
// var prefix = array[0].Trim();
// if (prefix is not ("QQ" or "YT" or "XL" or "GJ" or "CL" or "JZ" or "JG" or "GP" or "DZ" or "TF" or "GD" or "TX" or "XH" or "ZS" or "HB" or "ZJ" or "HJ" or "CX" or "MJ" or "YK" or "ZK" or "ZT" or "CJ" or "XX" or "TC" or "NY" or "ZB" or "AF"))
// {
// var errorItem = new MessageModel(group.Key, "族名称专业前缀错误");
// Items.Add(errorItem);
// }
// }
// else
// {
// var errorItem = new MessageModel(group.Key, "族名称命名不符合三段式");
// Items.Add(errorItem);
// }
//}
}
if (IsCheckProps)
{
foreach (var group in typeInstancesGroups)
{
var typeCount = 0;
var typeId = group.Key;
var type = doc.GetElement(typeId);
foreach (Parameter param in type.Parameters)
{
var array = param.Definition.Name.Split('-');
if (array.Length >= 3)
{
var prefix = array[0].Trim();
if (prefix is ("ID" or "LC" or "ST" or "GJ" or "MF" or "AM" or "FM" or "TM" or "CM"))
{
typeCount++;
}
}
}
foreach (var elem in group)
{
var instanceCount = 0;
foreach (Parameter param in elem.Parameters)
{
var array = param.Definition.Name.Split('-');
if (array.Length >= 3)
{
var prefix = array[0].Trim();
if (prefix is ("ID" or "LC" or "ST" or "GJ" or "MF" or "AM" or "FM" or "TM" or "CM"))
{
instanceCount++;
}
}
}
if (typeCount + instanceCount < 60)
{
var errorItem = new MessageModel(elem, "规范参数不全");
Items.Add(errorItem);
}
}
}
}
if (IsCheckSlope)
{
@@ -679,6 +583,9 @@ public partial class ModelCheckViewModel : ObservableObject
}
}
[ObservableProperty]
public partial string Properties { get; set; }
[ObservableProperty]
public partial int ErrorCount { get; set; }

View File

@@ -74,7 +74,7 @@ public static class WinDialogAssist
/// 打开或在现有目录并选中相应文件
/// </summary>
/// <param name="fileFullName"></param>
static public void OpenFolderAndSelectFile(string fileFullName)
public static void OpenFolderAndSelectFile(string fileFullName)
{
if (string.IsNullOrEmpty(fileFullName))
throw new ArgumentNullException(nameof(fileFullName));
@@ -201,17 +201,17 @@ public static class WinDialogAssist
AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomain_AssemblyResolve;
}
private static Dictionary<Type, Window> _windows = [];
public static void ShowOrActivate<TWindow, TViewModel>(params object[] viewModelParams)
where TWindow : Window, new()
private static readonly Dictionary<Type, Window> _windows = [];
public static void ShowOrActivate<TView, TViewModel>(params object[] viewModelParams)
where TView : Window,new()
where TViewModel : class
{
var windowType = typeof(TWindow);
var windowType = typeof(TView);
if (!_windows.ContainsKey(windowType) || _windows[windowType] == null)
{
//CloseAllWindowsExcept(windowType);
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
_windows[windowType] = new TWindow();
_windows[windowType] = new TView();
_windows[windowType].Closed += WindowClosed;
_windows[windowType].Closed += (_, _) => _windows[windowType] = null;
if (_windows[windowType].DataContext == null || !(_windows[windowType].DataContext is TViewModel))

View File

@@ -3,7 +3,7 @@ using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
namespace ShrlAlgoToolkit.RevitAddins.Windows
namespace ShrlAlgoToolkit.RevitAddins.Common.Controls
{
public partial class ColorPickerViewModel : ObservableObject
{

View File

@@ -1,19 +1,20 @@
<ui:MelWindow
x:Class="ShrlAlgoToolkit.RevitAddins.Windows.ColorPickerWin"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local2="clr-namespace:ShrlAlgoToolkit.RevitAddins.Windows"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="https://github.com/ShrlAlgo/Melskin"
Height="390"
Icon="{DynamicResource RevitIcon}"
Title="颜色设置"
Width="340"
Height="390"
d:DataContext="{d:DesignInstance Type=local2:ColorPickerViewModel}"
Icon="{DynamicResource RevitIcon}"
WindowStartupLocation="CenterOwner"
mc:Ignorable="d">
d:DataContext="{d:DesignInstance Type=windows:ColorPickerViewModel}"
mc:Ignorable="d"
x:Class="ShrlAlgoToolkit.RevitAddins.Common.Controls.ColorPickerWin"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:ShrlAlgoToolkit.RevitAddins.Common.Controls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="https://github.com/ShrlAlgo/Melskin"
xmlns:windows="clr-namespace:ShrlAlgoToolkit.RevitAddins.Common.Controls"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Window.Resources>
<ResourceDictionary Source="pack://application:,,,/ShrlAlgoToolkit.RevitAddins;component/WPFUI.xaml" />
</Window.Resources>
@@ -37,15 +38,15 @@
</b:Interaction.Triggers>
</controls:StandardColorPicker>-->
<ui:ColorPanel
x:Name="ColorPicker"
Grid.Column="0"
Grid.ColumnSpan="2"
Grid.Row="0"
Grid.Column="0"
Grid.ColumnSpan="2"
SelectedColor="{Binding SelectedColor}" />
SelectedColor="{Binding SelectedColor}"
x:Name="ColorPicker" />
<StackPanel
Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="2"
Grid.Row="1"
HorizontalAlignment="Center"
Orientation="Horizontal">
<Button

View File

@@ -1,4 +1,4 @@
namespace ShrlAlgoToolkit.RevitAddins.Windows;
namespace ShrlAlgoToolkit.RevitAddins.Common.Controls;
/// <summary>
/// ColorPickerWin.xaml 的交互逻辑

View File

@@ -1,7 +1,7 @@

using Autodesk.Revit.DB;
namespace ShrlAlgoToolkit.RevitAddins.Windows;
namespace ShrlAlgoToolkit.RevitAddins.Common.Controls;
/// <summary>
/// 错误的条目

View File

@@ -4,7 +4,7 @@ using CommunityToolkit.Mvvm.Input;
using Nice3point.Revit.Toolkit.External.Handlers;
namespace ShrlAlgoToolkit.RevitAddins.Windows;
namespace ShrlAlgoToolkit.RevitAddins.Common.Controls;
public partial class MessageViewModel : ObservableObject
{

View File

@@ -1,18 +1,19 @@
<ui:MelWindow
x:Class="ShrlAlgoToolkit.RevitAddins.Windows.MessageWin"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local1="clr-namespace:ShrlAlgoToolkit.RevitAddins.Windows"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="https://github.com/ShrlAlgo/Melskin"
Height="450"
Icon="{DynamicResource RevitIcon}"
Title="{Binding WinTitle}"
Width="800"
Height="450"
d:DataContext="{d:DesignInstance Type=local1:MessageViewModel}"
Icon="{DynamicResource RevitIcon}"
mc:Ignorable="d">
d:DataContext="{d:DesignInstance Type=windows:MessageViewModel}"
mc:Ignorable="d"
x:Class="ShrlAlgoToolkit.RevitAddins.Common.Controls.MessageWin"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:ShrlAlgoToolkit.RevitAddins.Common.Controls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="https://github.com/ShrlAlgo/Melskin"
xmlns:windows="clr-namespace:ShrlAlgoToolkit.RevitAddins.Common.Controls"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Window.Resources>
<ResourceDictionary Source="pack://application:,,,/ShrlAlgoToolkit.RevitAddins;component/WPFUI.xaml" />
</Window.Resources>
@@ -21,12 +22,12 @@
</Window.DataContext>-->
<ui:StackPanel Margin="5" Spacing="5">
<DataGrid
ui:StackPanel.Fill="Fill"
AutoGenerateColumns="False"
CanUserAddRows="False"
IsReadOnly="True"
ItemsSource="{Binding ErrorModels}"
ToolTip="双击行可快速定位">
ToolTip="双击行可快速定位"
ui:StackPanel.Fill="Fill">
<b:Interaction.Triggers>
<b:EventTrigger EventName="MouseDoubleClick">
<b:InvokeCommandAction Command="{Binding ShowElementCommand}" CommandParameter="{Binding SelectedItem, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" />
@@ -52,7 +53,7 @@
</DataGrid.Columns>
</DataGrid>
<ui:StackPanel Grid.Row="1" Orientation="Horizontal">
<ui:Heading ui:StackPanel.Fill="Fill" Text="注:错误需人处理、或无法处理" />
<ui:Heading Text="注:错误需人处理、或无法处理" ui:StackPanel.Fill="Fill" />
<TextBlock Text="{Binding Count, StringFormat=错误数量:{0}}" />
<TextBlock Text="{Binding Footer}" />
</ui:StackPanel>

View File

@@ -1,6 +1,6 @@
using Melskin.Controls;
namespace ShrlAlgoToolkit.RevitAddins.Windows
namespace ShrlAlgoToolkit.RevitAddins.Common.Controls
{
/// <summary>
/// MessageWin.xaml 的交互逻辑

View File

@@ -3,7 +3,7 @@ using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
namespace ShrlAlgoToolkit.RevitAddins.Windows
namespace ShrlAlgoToolkit.RevitAddins.Common.Controls
{
public partial class NavigateViewViewModel : ObservableObject
{

View File

@@ -1,18 +1,19 @@
<ui:MelWindow
x:Class="ShrlAlgoToolkit.RevitAddins.Windows.NavigateViewWin"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:sControls3="clr-namespace:ShrlAlgoToolkit.RevitAddins.Windows"
xmlns:ui="https://github.com/ShrlAlgo/Melskin"
Height="200"
Icon="{DynamicResource RevitIcon}"
Title="选择视图"
Width="300"
Height="200"
d:DataContext="{d:DesignInstance Type=sControls3:NavigateViewViewModel}"
Icon="{DynamicResource RevitIcon}"
mc:Ignorable="d">
d:DataContext="{d:DesignInstance Type=windows:NavigateViewViewModel}"
mc:Ignorable="d"
x:Class="ShrlAlgoToolkit.RevitAddins.Common.Controls.NavigateViewWin"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:ShrlAlgoToolkit.RevitAddins.Common.Controls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="https://github.com/ShrlAlgo/Melskin"
xmlns:windows="clr-namespace:ShrlAlgoToolkit.RevitAddins.Common.Controls"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Window.Resources>
<ResourceDictionary Source="pack://application:,,,/ShrlAlgoToolkit.RevitAddins;component/WPFUI.xaml" />
</Window.Resources>

View File

@@ -1,4 +1,4 @@
namespace ShrlAlgoToolkit.RevitAddins.Windows
namespace ShrlAlgoToolkit.RevitAddins.Common.Controls
{
/// <summary>
/// NavigateViewWin.xaml 的交互逻辑

View File

@@ -1,6 +1,6 @@
using Autodesk.Revit.DB;
namespace ShrlAlgoToolkit.RevitAddins.Windows
namespace ShrlAlgoToolkit.RevitAddins.Common.Controls
{
class ProcessEventHandler<T> : IExternalEventHandler
{

View File

@@ -1,6 +1,6 @@
using Autodesk.Revit.DB;
namespace ShrlAlgoToolkit.RevitAddins.Windows
namespace ShrlAlgoToolkit.RevitAddins.Common.Controls
{
class ProgressBarManager<T>
{

View File

@@ -1,12 +1,13 @@
<Window
x:Class="ShrlAlgoToolkit.RevitAddins.Windows.ProgressMonitorView"
x:Class="ShrlAlgoToolkit.RevitAddins.Common.Controls.ProgressMonitorView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:ShrlAlgoToolkit.RevitAddins.Windows"
xmlns:controls1="clr-namespace:ShrlAlgoToolkit.RevitAddins.Common.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:windows="clr-namespace:ShrlAlgoToolkit.RevitAddins.Common.Controls"
Title="{Binding Title}"
d:DataContext="{d:DesignInstance Type=controls:ProgressMonitorViewModel}"
d:DataContext="{d:DesignInstance Type=windows:ProgressMonitorViewModel}"
Background="{DynamicResource MaterialDesign.Brush.Background}"
Icon="{DynamicResource RevitIcon}"
ResizeMode="NoResize"

View File

@@ -1,6 +1,6 @@
using System.Windows;
namespace ShrlAlgoToolkit.RevitAddins.Windows
namespace ShrlAlgoToolkit.RevitAddins.Common.Controls
{
/// <summary>
/// Interaction logic for ProgressMonitorView.xaml

View File

@@ -1,6 +1,6 @@
using CommunityToolkit.Mvvm.ComponentModel;
namespace ShrlAlgoToolkit.RevitAddins.Windows
namespace ShrlAlgoToolkit.RevitAddins.Common.Controls
{
partial class ProgressMonitorViewModel : ObservableObject
{

View File

@@ -2,8 +2,11 @@
using Autodesk.Revit.DB;
using Nice3point.Revit.Toolkit.External;
using ShrlAlgoToolkit.RevitAddins.RvView;
using ShrlAlgoToolkit;
using ShrlAlgoToolkit.RevitAddins;
namespace ShrlAlgoToolkit.RevitAddins.RvView;
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
[Transaction(TransactionMode.Manual)]
public class AdaptiveMEPTagCmd : ExternalCommand

View File

@@ -1,7 +1,10 @@
using Nice3point.Revit.Toolkit.External;
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
using ShrlAlgoToolkit.RevitAddins.RvView;
using ShrlAlgoToolkit;
using ShrlAlgoToolkit.RevitAddins;
namespace ShrlAlgoToolkit.RevitAddins.RvView;
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
@@ -9,6 +12,6 @@ public class AlignTagsCmd : ExternalCommand
{
public override void Execute()
{
Common.Assists.WinDialogAssist.ShowOrActivate<AlignTagsView, AlignTagsViewModel>();
Common.Assists.WinDialogAssist.ShowOrActivate<DrawSheet.AlignTagsView, AlignTagsViewModel>();
}
}

View File

@@ -1,16 +1,16 @@
<ui:MelWindow
x:Class="ShrlAlgoToolkit.RevitAddins.RvView.AlignTagsView"
x:Class="ShrlAlgoToolkit.RevitAddins.DrawSheet.AlignTagsView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:rvDrawing="clr-namespace:ShrlAlgoToolkit.RevitAddins.RvView"
xmlns:rvDrawing1="clr-namespace:ShrlAlgoToolkit.RevitAddins.DrawSheet"
xmlns:ui="https://github.com/ShrlAlgo/Melskin"
Title="整理标记"
Width="200"
Height="150"
MinHeight="150"
d:DataContext="{d:DesignInstance Type=rvDrawing:AlignTagsViewModel}"
d:DataContext="{d:DesignInstance Type=rvDrawing1:AlignTagsViewModel}"
Icon="{DynamicResource RevitIcon}"
mc:Ignorable="d">
<Window.Resources>

View File

@@ -1,4 +1,8 @@
namespace ShrlAlgoToolkit.RevitAddins.RvView
using ShrlAlgoToolkit.RevitAddins.RvView;
using ShrlAlgoToolkit;
using ShrlAlgoToolkit.RevitAddins;
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet
{
/// <summary>
/// AlignTagsView.xaml 的交互逻辑

View File

@@ -3,8 +3,11 @@ using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Nice3point.Revit.Toolkit.External.Handlers;
using ShrlAlgoToolkit.RevitAddins.RvView;
using ShrlAlgoToolkit;
using ShrlAlgoToolkit.RevitAddins;
namespace ShrlAlgoToolkit.RevitAddins.RvView;
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
public partial class AlignTagsViewModel : ObservableObject
{

View File

@@ -3,7 +3,11 @@ using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Nice3point.Revit.Toolkit.External;
namespace ShrlAlgoToolkit.RevitAddins.RvView;
using ShrlAlgoToolkit.RevitAddins.RvView;
using ShrlAlgoToolkit;
using ShrlAlgoToolkit.RevitAddins;
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
[Transaction(TransactionMode.Manual)]
public class ArrangeTagsCmd : ExternalCommand
@@ -76,13 +80,13 @@ public class ArrangeTagsCmd : ExternalCommand
tx.Start("整理标记");
//Create two lists of TagLeader
List<TagLeader> leftTagLeaders = [];
List<TagLeader> rightTagLeaders = [];
List<DrawSheet.TagLeader> leftTagLeaders = [];
List<DrawSheet.TagLeader> rightTagLeaders = [];
foreach (var tag in independentTags)
{
TagLeader currentTag = new(tag, doc);
if (currentTag.Side == ViewSides.Left)
DrawSheet.TagLeader currentTag = new(tag, doc);
if (currentTag.Side == DrawSheet.ViewSides.Left)
{
leftTagLeaders.Add(currentTag);
}
@@ -93,8 +97,8 @@ public class ArrangeTagsCmd : ExternalCommand
}
//Create a errorModels of potential location points for tag headers
var leftTagHeadPoints = ArrangeTagsCmd.CreateTagPositionPoints(activeView, leftTagLeaders, ViewSides.Left);
var rightTagHeadPoints = ArrangeTagsCmd.CreateTagPositionPoints(activeView, rightTagLeaders, ViewSides.Right);
var leftTagHeadPoints = DrawSheet.ArrangeTagsCmd.CreateTagPositionPoints(activeView, leftTagLeaders, DrawSheet.ViewSides.Left);
var rightTagHeadPoints = DrawSheet.ArrangeTagsCmd.CreateTagPositionPoints(activeView, rightTagLeaders, DrawSheet.ViewSides.Right);
//按 Y 位置对标签排序 [..]集合解构是一种新的语法用于表示范围Range操作。范围操作用于从集合或数组中选择一个连续的子集。
leftTagLeaders = [.. leftTagLeaders.OrderBy(x => x.LeaderEnd.X)];
@@ -112,7 +116,7 @@ public class ArrangeTagsCmd : ExternalCommand
tx.Commit();
}
private static List<XYZ> CreateTagPositionPoints(View activeView, List<TagLeader> tagLeaders, ViewSides side)
private static List<XYZ> CreateTagPositionPoints(View activeView, List<DrawSheet.TagLeader> tagLeaders, DrawSheet.ViewSides side)
{
List<XYZ> points = [];
@@ -133,7 +137,7 @@ public class ArrangeTagsCmd : ExternalCommand
//create sides points
for (var i = max * 2; i > 0; i--)
{
if (side == ViewSides.Left)
if (side == DrawSheet.ViewSides.Left)
{
//Add left point
points.Add(baseLeft + new XYZ(0, step * i, 0));
@@ -166,7 +170,7 @@ public class ArrangeTagsCmd : ExternalCommand
return nearestPoint;
}
private void PlaceAndSort(List<XYZ> positionPoints, List<TagLeader> tags)
private void PlaceAndSort(List<XYZ> positionPoints, List<DrawSheet.TagLeader> tags)
{
//place TagLeader
foreach (var tag in tags)
@@ -179,8 +183,8 @@ public class ArrangeTagsCmd : ExternalCommand
}
//unCross leaders (2 times)
ArrangeTagsCmd.UnCross(tags);
ArrangeTagsCmd.UnCross(tags);
DrawSheet.ArrangeTagsCmd.UnCross(tags);
DrawSheet.ArrangeTagsCmd.UnCross(tags);
//update their position
foreach (var tag in tags)
@@ -189,7 +193,7 @@ public class ArrangeTagsCmd : ExternalCommand
}
}
private static void UnCross(List<TagLeader> tags)
private static void UnCross(List<DrawSheet.TagLeader> tags)
{
foreach (var tag in tags)
{
@@ -230,7 +234,7 @@ internal class TagLeader
//View center
var viewCenter = (currentView.CropBox.Max + currentView.CropBox.Min) / 2;
Side = viewCenter.X > LeaderEnd.X ? ViewSides.Left : ViewSides.Right;
Side = viewCenter.X > LeaderEnd.X ? DrawSheet.ViewSides.Left : DrawSheet.ViewSides.Right;
}
GetTagDimension();
@@ -265,7 +269,7 @@ internal class TagLeader
public Line BaseLine { get; private set; }
public ViewSides Side { get; }
public DrawSheet.ViewSides Side { get; }
public XYZ ElbowPosition { get; private set; }
@@ -327,7 +331,7 @@ internal class TagLeader
{
tag.LeaderEndCondition = LeaderEndCondition.Attached;
var offsetFromView = Side == ViewSides.Left ? new XYZ((-Math.Abs(TagWidth) * 0.5) - 0.1, 0, 0) : new XYZ((Math.Abs(TagWidth) * 0.5) + 0.1, 0, 0);
var offsetFromView = Side == DrawSheet.ViewSides.Left ? new XYZ((-Math.Abs(TagWidth) * 0.5) - 0.1, 0, 0) : new XYZ((Math.Abs(TagWidth) * 0.5) + 0.1, 0, 0);
tag.TagHeadPosition = currentView.CropBox.Transform.OfPoint(headOffset + tagCenter + offsetFromView);
#if REVIT2018 || REVIT2020
tag.LeaderElbow = currentView.CropBox.Transform.OfPoint(ElbowPosition);

View File

@@ -4,8 +4,11 @@ using Autodesk.Revit.DB;
using Nice3point.Revit.Toolkit.External;
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
using ShrlAlgoToolkit.RevitAddins.RvView;
using ShrlAlgoToolkit;
using ShrlAlgoToolkit.RevitAddins;
namespace ShrlAlgoToolkit.RevitAddins.RvView;
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
[Transaction(TransactionMode.Manual)]
public class CivilViewFilterCmd : ExternalCommand

View File

@@ -2,8 +2,11 @@
using Autodesk.Revit.UI.Selection;
using Nice3point.Revit.Toolkit.External;
using ShrlAlgoToolkit.RevitAddins.RvView;
using ShrlAlgoToolkit;
using ShrlAlgoToolkit.RevitAddins;
namespace ShrlAlgoToolkit.RevitAddins.RvView;
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]

View File

@@ -1,5 +1,5 @@
<Page
x:Class="ShrlAlgoToolkit.RevitAddins.RvView.ElementsControlDock"
x:Class="ShrlAlgoToolkit.RevitAddins.DrawSheet.ElementsControlDock"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

View File

@@ -4,8 +4,11 @@ using System.Windows.Controls;
using Autodesk.Revit.DB;
using Nice3point.Revit.Toolkit.External.Handlers;
using ShrlAlgoToolkit.RevitAddins.RvView;
using ShrlAlgoToolkit;
using ShrlAlgoToolkit.RevitAddins;
namespace ShrlAlgoToolkit.RevitAddins.RvView;
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
public partial class ElementsControlDock : IDockablePaneProvider
{

View File

@@ -2,9 +2,11 @@
using Autodesk.Revit.Attributes;
using Nice3point.Revit.Toolkit.External;
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
using ShrlAlgoToolkit.RevitAddins.RvView;
using ShrlAlgoToolkit;
using ShrlAlgoToolkit.RevitAddins;
namespace ShrlAlgoToolkit.RevitAddins.RvView;
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
[Transaction(TransactionMode.Manual)]
//打开ElementsControlDock窗口

View File

@@ -11,8 +11,11 @@ using MiniExcelLibs;
using Nice3point.Revit.Toolkit.External;
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
using ShrlAlgoToolkit.RevitAddins.RvView;
using ShrlAlgoToolkit;
using ShrlAlgoToolkit.RevitAddins;
namespace ShrlAlgoToolkit.RevitAddins.RvView;
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]

View File

@@ -1,8 +1,11 @@
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using ShrlAlgoToolkit.RevitAddins.RvView;
using ShrlAlgoToolkit;
using ShrlAlgoToolkit.RevitAddins;
namespace ShrlAlgoToolkit.RevitAddins.RvView
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet
{
[Transaction(TransactionMode.Manual)]
internal class PanelScheduleCmd : IExternalCommand

View File

@@ -1,7 +1,14 @@
using Autodesk.Revit.Attributes;
using Nice3point.Revit.Toolkit.External;
namespace ShrlAlgoToolkit.RevitAddins.RvCommon;
using ShrlAlgoToolkit.RevitAddins.RvCommon;
using ShrlAlgoToolkit;
using ShrlAlgoToolkit.RevitAddins;
using ShrlAlgoToolkit.RevitAddins.General;
using ShrlAlgoToolkit;
using ShrlAlgoToolkit.RevitAddins;
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
[Transaction(TransactionMode.Manual)]
internal class QuickSelectionCmd : ExternalCommand

View File

@@ -1,9 +1,8 @@
<Window
x:Class="ShrlAlgoToolkit.RevitAddins.RvCommon.QuickSelectionView"
x:Class="ShrlAlgoToolkit.RevitAddins.DrawSheet.QuickSelectionView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:ShrlAlgoToolkit.RevitAddins.RvCommon"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="条件选择"
Width="800"

View File

@@ -0,0 +1,20 @@
using System.Windows;
using ShrlAlgoToolkit.RevitAddins.RvCommon;
using ShrlAlgoToolkit;
using ShrlAlgoToolkit.RevitAddins;
using ShrlAlgoToolkit.RevitAddins.General;
using ShrlAlgoToolkit;
using ShrlAlgoToolkit.RevitAddins;
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
/// <summary>
/// QuickSelectionView.xaml 的交互逻辑
/// </summary>
public partial class QuickSelectionView : Window
{
public QuickSelectionView()
{
InitializeComponent();
}
}

View File

@@ -1,7 +1,10 @@
using Nice3point.Revit.Toolkit.External;
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
using ShrlAlgoToolkit.RevitAddins.RvView;
using ShrlAlgoToolkit;
using ShrlAlgoToolkit.RevitAddins;
namespace ShrlAlgoToolkit.RevitAddins.RvView;
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
/// <summary>
///RightDirection = CropBox.Transform.BasisX
///ViewDirection = CropBox.Transform.BasisZ

View File

@@ -1,15 +1,15 @@
<ui:MelWindow
x:Class="ShrlAlgoToolkit.RevitAddins.RvView.QuickViewSectionView"
x:Class="ShrlAlgoToolkit.RevitAddins.DrawSheet.QuickViewSectionView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:ShrlAlgoToolkit.RevitAddins.RvView"
xmlns:local1="clr-namespace:ShrlAlgoToolkit.RevitAddins.DrawSheet"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="https://github.com/ShrlAlgo/Melskin"
Title="快速剖面"
Width="300"
Height="180"
d:DataContext="{d:DesignInstance Type=local:QuickViewSectionViewModel}"
d:DataContext="{d:DesignInstance Type=local1:QuickViewSectionViewModel}"
Icon="{DynamicResource RevitIcon}"
SizeToContent="Height"
mc:Ignorable="d">

View File

@@ -1,4 +1,8 @@
namespace ShrlAlgoToolkit.RevitAddins.RvView;
using ShrlAlgoToolkit.RevitAddins.RvView;
using ShrlAlgoToolkit;
using ShrlAlgoToolkit.RevitAddins;
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
/// <summary>
/// QuickViewSectionView.xaml 的交互逻辑
/// </summary>

View File

@@ -5,9 +5,11 @@ using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Nice3point.Revit.Toolkit.External.Handlers;
using ShrlAlgoToolkit.RevitAddins.RvView;
using ShrlAlgoToolkit;
using ShrlAlgoToolkit.RevitAddins;
namespace ShrlAlgoToolkit.RevitAddins.RvView
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet
{
public partial class QuickViewSectionViewModel : ObservableObject
{

View File

@@ -1,7 +1,10 @@
using Nice3point.Revit.Toolkit.External;
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
using ShrlAlgoToolkit.RevitAddins.RvView;
using ShrlAlgoToolkit;
using ShrlAlgoToolkit.RevitAddins;
namespace ShrlAlgoToolkit.RevitAddins.RvView;
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]

View File

@@ -1,17 +1,16 @@
<ui:MelWindow
x:Class="ShrlAlgoToolkit.RevitAddins.RvView.SectionBoxControllerView"
x:Class="ShrlAlgoToolkit.RevitAddins.DrawSheet.SectionBoxControllerView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:rvManager="clr-namespace:ShrlAlgoToolkit.RevitAddins.RvView"
xmlns:rvView="clr-namespace:ShrlAlgoToolkit.RevitAddins.RvView"
xmlns:rvView="clr-namespace:ShrlAlgoToolkit.RevitAddins.DrawSheet"
xmlns:ui="https://github.com/ShrlAlgo/Melskin"
Title="剖面框"
Width="340"
Height="360"
MinWidth="340"
MinHeight="360"
d:DataContext="{d:DesignInstance Type=rvManager:SectionBoxControllerViewModel}"
Icon="{DynamicResource RevitIcon}"
mc:Ignorable="d">
@@ -46,15 +45,15 @@
<UniformGrid Rows="1">
<RadioButton
Content="元素"
IsChecked="{Binding SectionBoxType, Converter={StaticResource ComparisonConverter}, ConverterParameter={x:Static rvView:SectionBoxType.Element}}"
IsChecked="{Binding SectionBoxType, Converter={StaticResource ComparisonConverter}, ConverterParameter={x:Static rvManager:SectionBoxType.Element}}"
ToolTip="根据选择元素设置剖面框" />
<RadioButton
Content="框选"
IsChecked="{Binding SectionBoxType, Converter={StaticResource ComparisonConverter}, ConverterParameter={x:Static rvView:SectionBoxType.Rectangle}}"
IsChecked="{Binding SectionBoxType, Converter={StaticResource ComparisonConverter}, ConverterParameter={x:Static rvManager:SectionBoxType.Rectangle}}"
ToolTip="根据框选范围设置剖面框" />
<RadioButton
Content="剖面"
IsChecked="{Binding SectionBoxType, Converter={StaticResource ComparisonConverter}, ConverterParameter={x:Static rvView:SectionBoxType.ViewSection}}"
IsChecked="{Binding SectionBoxType, Converter={StaticResource ComparisonConverter}, ConverterParameter={x:Static rvManager:SectionBoxType.ViewSection}}"
ToolTip="根据剖面的范围设置剖面框" />
</UniformGrid>
</GroupBox>

View File

@@ -1,6 +1,10 @@
using Melskin.Controls;
namespace ShrlAlgoToolkit.RevitAddins.RvView
using ShrlAlgoToolkit.RevitAddins.RvView;
using ShrlAlgoToolkit;
using ShrlAlgoToolkit.RevitAddins;
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet
{
/// <summary>
/// SectionBoxControllerView.xaml 的交互逻辑

View File

@@ -1,7 +1,11 @@
using Autodesk.Revit.DB;
using Nice3point.Revit.Toolkit.External;
namespace ShrlAlgoToolkit.RevitAddins.RvView;
using ShrlAlgoToolkit.RevitAddins.RvView;
using ShrlAlgoToolkit;
using ShrlAlgoToolkit.RevitAddins;
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]

View File

@@ -1,7 +1,11 @@
using Autodesk.Revit.Attributes;
using Nice3point.Revit.Toolkit.External;
namespace ShrlAlgoToolkit.RevitAddins.RvView;
using ShrlAlgoToolkit.RevitAddins.RvView;
using ShrlAlgoToolkit;
using ShrlAlgoToolkit.RevitAddins;
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
/// <summary>
/// Revit执行命令
@@ -11,7 +15,7 @@ public class SystemDisplayCmd : ExternalCommand
{
public override void Execute()
{
var view = new SystemDisplayView()
var view = new DrawSheet.SystemDisplayView()
{
DataContext = new SystemDisplayViewModel(UiApplication)
};

View File

@@ -1,19 +1,20 @@
<ui:MelWindow
x:Class="ShrlAlgoToolkit.RevitAddins.RvView.SystemDisplayView"
x:Class="ShrlAlgoToolkit.RevitAddins.DrawSheet.SystemDisplayView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:ShrlAlgoToolkit.RevitAddins.Common.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:ShrlAlgoToolkit.RevitAddins.RvView"
xmlns:local1="clr-namespace:ShrlAlgoToolkit.RevitAddins.DrawSheet"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mep="clr-namespace:ShrlAlgoToolkit.RevitAddins.RvMEP"
xmlns:rvMep="clr-namespace:ShrlAlgoToolkit.RevitAddins.RvMEP"
xmlns:ui="https://github.com/ShrlAlgo/Melskin"
xmlns:rvView="clr-namespace:ShrlAlgoToolkit.RevitAddins.RvView"
Title="系统设置"
Width="550"
Height="450"
MinWidth="550"
d:DataContext="{d:DesignInstance Type=local:SystemDisplayViewModel}"
d:DataContext="{d:DesignInstance Type=rvView:SystemDisplayViewModel}"
Icon="{DynamicResource RevitIcon}"
mc:Ignorable="d">
<Window.Resources>

View File

@@ -1,4 +1,8 @@
namespace ShrlAlgoToolkit.RevitAddins.RvView
using ShrlAlgoToolkit.RevitAddins.RvView;
using ShrlAlgoToolkit;
using ShrlAlgoToolkit.RevitAddins;
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet
{
/// <summary>
/// SystemDisplayView.xaml 的交互逻辑

View File

@@ -4,7 +4,7 @@ using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
using ShrlAlgoToolkit.RevitAddins.RvMEP;
using ShrlAlgoToolkit.RevitAddins.Windows;
using ShrlAlgoToolkit.RevitAddins.Common.Controls;
namespace ShrlAlgoToolkit.RevitAddins.RvView;

View File

@@ -1,8 +1,11 @@
using Autodesk.Revit.Attributes;
using Nice3point.Revit.Toolkit.External;
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
using ShrlAlgoToolkit.RevitAddins.RvView;
using ShrlAlgoToolkit;
using ShrlAlgoToolkit.RevitAddins;
namespace ShrlAlgoToolkit.RevitAddins.RvView;
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
/// <summary>
/// Revit执行命令
@@ -12,6 +15,6 @@ public class ViewManagerCmd : ExternalCommand
{
public override void Execute()
{
Common.Assists.WinDialogAssist.ShowOrActivate<ViewManagerView, ViewManagerViewModel>(UiApplication);
Common.Assists.WinDialogAssist.ShowOrActivate<DrawSheet.ViewManagerView, DrawSheet.ViewManagerViewModel>(UiApplication);
}
}

View File

@@ -1,8 +1,11 @@
using Autodesk.Revit.DB;
using CommunityToolkit.Mvvm.ComponentModel;
using ShrlAlgoToolkit.RevitAddins.RvView;
using ShrlAlgoToolkit;
using ShrlAlgoToolkit.RevitAddins;
namespace ShrlAlgoToolkit.RevitAddins.RvView;
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
public partial class ViewManagerModel : ObservableObject
{

View File

@@ -1,18 +1,18 @@
<ui:MelWindow
x:Class="ShrlAlgoToolkit.RevitAddins.RvView.ViewManagerView"
x:Class="ShrlAlgoToolkit.RevitAddins.DrawSheet.ViewManagerView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
xmlns:converters="clr-namespace:ShrlAlgoToolkit.RevitAddins.Common.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:ShrlAlgoToolkit.RevitAddins.RvView"
xmlns:rvView="clr-namespace:ShrlAlgoToolkit.RevitAddins.DrawSheet"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:rvView="clr-namespace:ShrlAlgoToolkit.RevitAddins.RvView"
xmlns:ui="https://github.com/ShrlAlgo/Melskin"
Title="视图管理"
Width="800"
Height="450"
d:DataContext="{d:DesignInstance Type=local:ViewManagerViewModel}"
d:DataContext="{d:DesignInstance Type=rvView:ViewManagerViewModel}"
Icon="{DynamicResource RevitIcon}"
mc:Ignorable="d">
<Window.Resources>
@@ -21,10 +21,10 @@
<ResourceDictionary Source="pack://application:,,,/ShrlAlgoToolkit.RevitAddins;component/WPFUI.xaml" />
</ResourceDictionary.MergedDictionaries>
<converters:SearchValueConverter x:Key="SearchValueConverter" />
<converters:EnumItemsSourceAndConverter x:Key="DetailLevelConverter" Type="{x:Type rvView:UserViewDetailLevel}" />
<converters:EnumItemsSourceAndConverter x:Key="ViewTypeConverter" Type="{x:Type rvView:UserViewType}" />
<converters:EnumItemsSourceAndConverter x:Key="DisplayStyleConverter" Type="{x:Type rvView:UserDisplayStyle}" />
<converters:EnumItemsSourceAndConverter x:Key="ViewDisciplineConverter" Type="{x:Type rvView:UserViewDiscipline}" />
<converters:EnumItemsSourceAndConverter x:Key="DetailLevelConverter" Type="{x:Type local:UserViewDetailLevel}" />
<converters:EnumItemsSourceAndConverter x:Key="ViewTypeConverter" Type="{x:Type local:UserViewType}" />
<converters:EnumItemsSourceAndConverter x:Key="DisplayStyleConverter" Type="{x:Type local:UserDisplayStyle}" />
<converters:EnumItemsSourceAndConverter x:Key="ViewDisciplineConverter" Type="{x:Type local:UserViewDiscipline}" />
<ui:BindingProxy x:Key="ViewDataGridProxy" Data="{Binding ElementName=ViewDataGrid}" />
</ResourceDictionary>

View File

@@ -1,4 +1,8 @@
namespace ShrlAlgoToolkit.RevitAddins.RvView
using ShrlAlgoToolkit.RevitAddins.RvView;
using ShrlAlgoToolkit;
using ShrlAlgoToolkit.RevitAddins;
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet
{
/// <summary>
/// ViewManagerView.xaml 的交互逻辑

View File

@@ -8,22 +8,24 @@ using CommunityToolkit.Mvvm.Input;
using Nice3point.Revit.Toolkit.External.Handlers;
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
using ShrlAlgoToolkit.RevitAddins.Common.Extensions;
using ShrlAlgoToolkit.RevitAddins.RvView;
using ShrlAlgoToolkit;
using ShrlAlgoToolkit.RevitAddins;
namespace ShrlAlgoToolkit.RevitAddins.RvView;
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
public partial class ViewManagerViewModel : ObservableObject
{
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(RevitAddins.RvView.ViewManagerViewModel.CopyAsDependentCommand))]
[NotifyCanExecuteChangedFor(nameof(DrawSheet.ViewManagerViewModel.CopyAsDependentCommand))]
public partial bool CanCopyAsDependent { get; set; }
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(RevitAddins.RvView.ViewManagerViewModel.CopyOnlyCommand))]
[NotifyCanExecuteChangedFor(nameof(DrawSheet.ViewManagerViewModel.CopyOnlyCommand))]
public partial bool CanCopyOnly { get; set; }
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(RevitAddins.RvView.ViewManagerViewModel.CopyWithDetailCommand))]
[NotifyCanExecuteChangedFor(nameof(DrawSheet.ViewManagerViewModel.CopyWithDetailCommand))]
public partial bool CanCopyWidthDetail { get; set; }
[ObservableProperty]
@@ -160,7 +162,7 @@ public partial class ViewManagerViewModel : ObservableObject
});
}
[RelayCommand(CanExecute = nameof(RevitAddins.RvView.ViewManagerViewModel.CanCopyAsDependent))]
[RelayCommand(CanExecute = nameof(DrawSheet.ViewManagerViewModel.CanCopyAsDependent))]
private void CopyAsDependent(System.Collections.IList items)
{
if (items == null || items.Count == 0)
@@ -193,7 +195,7 @@ public partial class ViewManagerViewModel : ObservableObject
});
}
[RelayCommand(CanExecute = nameof(RevitAddins.RvView.ViewManagerViewModel.CanCopyOnly))]
[RelayCommand(CanExecute = nameof(DrawSheet.ViewManagerViewModel.CanCopyOnly))]
private void CopyOnly(System.Collections.IList items)
{
if (items == null || items.Count == 0)
@@ -226,7 +228,7 @@ public partial class ViewManagerViewModel : ObservableObject
});
}
[RelayCommand(CanExecute = nameof(RevitAddins.RvView.ViewManagerViewModel.CanCopyWidthDetail))]
[RelayCommand(CanExecute = nameof(DrawSheet.ViewManagerViewModel.CanCopyWidthDetail))]
private void CopyWithDetail(System.Collections.IList items)
{
if (items == null || items.Count == 0)

View File

@@ -3,8 +3,11 @@ using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Nice3point.Revit.Toolkit.External;
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
using ShrlAlgoToolkit.RevitAddins.RvView;
using ShrlAlgoToolkit;
using ShrlAlgoToolkit.RevitAddins;
namespace ShrlAlgoToolkit.RevitAddins.RvView;
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
/// <summary>
/// Revit执行命令
@@ -16,7 +19,7 @@ public class VisibilityControlCmd : ExternalCommand
{
if (Document.ActiveView.ViewTemplateId == ElementId.InvalidElementId)
{
Common.Assists.WinDialogAssist.ShowOrActivate<VisibilityView, VisibilityViewModel>(UiApplication);
Common.Assists.WinDialogAssist.ShowOrActivate<DrawSheet.VisibilityView, DrawSheet.VisibilityViewModel>(UiApplication);
}
else
{

View File

@@ -1,10 +1,10 @@
<ui:MelWindow
x:Class="ShrlAlgoToolkit.RevitAddins.RvView.VisibilityView"
x:Class="ShrlAlgoToolkit.RevitAddins.DrawSheet.VisibilityView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:ShrlAlgoToolkit.RevitAddins.RvView"
xmlns:local1="clr-namespace:ShrlAlgoToolkit.RevitAddins.DrawSheet"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="https://github.com/ShrlAlgo/Melskin"
Title="可见性控制"
@@ -12,7 +12,7 @@
Height="60"
MinWidth="400"
MinHeight="60"
d:DataContext="{d:DesignInstance local:VisibilityViewModel}"
d:DataContext="{d:DesignInstance local1:VisibilityViewModel}"
Icon="{DynamicResource RevitIcon}"
SizeToContent="Width"
mc:Ignorable="d">

View File

@@ -1,6 +1,10 @@
using Melskin.Controls;
namespace ShrlAlgoToolkit.RevitAddins.RvView;
using ShrlAlgoToolkit.RevitAddins.RvView;
using ShrlAlgoToolkit;
using ShrlAlgoToolkit.RevitAddins;
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
/// <summary>
/// VisibilityView.xaml 的交互逻辑

View File

@@ -4,8 +4,11 @@ using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Nice3point.Revit.Toolkit.External.Handlers;
using ShrlAlgoToolkit.RevitAddins.RvView;
using ShrlAlgoToolkit;
using ShrlAlgoToolkit.RevitAddins;
namespace ShrlAlgoToolkit.RevitAddins.RvView;
namespace ShrlAlgoToolkit.RevitAddins.DrawSheet;
public partial class VisibilityViewModel : ObservableObject
{

View File

@@ -6,7 +6,7 @@ using Nice3point.Revit.Toolkit.External.Handlers;
using ShrlAlgoToolkit.RevitAddins.Properties;
using ShrlAlgoToolkit.RevitAddins.RvView;
namespace ShrlAlgoToolkit.RevitAddins.UIRibbon;
namespace ShrlAlgoToolkit.RevitAddins.Entry;
public class DrawingViewApp
{
@@ -23,75 +23,75 @@ public class DrawingViewApp
{
var ribbonPanel = application.CreateRibbonPanel(TabName, "视图与出图");
var autoAlignTags = UIAssist.NewPushButtonData<AlignTagsCmd>(
var autoAlignTags = UIAssist.NewPushButtonData<DrawSheet.AlignTagsCmd>(
"对齐标记",
Resources.align_tags_32px,
Resources.align_tags_16px
).SetAvailability<EnableInViewPlan>();
var arrangeTags = UIAssist.NewPushButtonData<ArrangeTagsCmd>(
var arrangeTags = UIAssist.NewPushButtonData<DrawSheet.ArrangeTagsCmd>(
"整理标记",
Resources.arrange_tags_32px,
Resources.arrange_tags_16px
).SetAvailability<EnableInViewPlan>();
var dim2Line = UIAssist.NewPushButtonData<DimensionBy2LineCmd>(
var dim2Line = UIAssist.NewPushButtonData<DrawSheet.DimensionBy2LineCmd>(
"双线标注",
Resources.two_lines_32px,
Resources.two_lines_16px,
"选择要标注的两条平行的几何模型边缘线进行标注。"
);
var adaptiveMEPTag = UIAssist.NewPushButtonData<AdaptiveMEPTagCmd>(
var adaptiveMEPTag = UIAssist.NewPushButtonData<DrawSheet.AdaptiveMEPTagCmd>(
"自适应标记",
Resources.adaptive_MEP_tag_32px,
Resources.adaptive_MEP_tag_16px,
"删除距离过密的标记及管上标记方向调整"
);
var visibilityControl = UIAssist.NewPushButtonData<VisibilityControlCmd>(
var visibilityControl = UIAssist.NewPushButtonData<DrawSheet.VisibilityControlCmd>(
"可见性",
Resources.visibility_control_32px,
Resources.visibility_control_16px,
"可见性控制"
).SetAvailability<OnProjectDocument>();
var sectionBox = UIAssist.NewPushButtonData<SectionBoxControllerCmd>(
var sectionBox = UIAssist.NewPushButtonData<DrawSheet.SectionBoxControllerCmd>(
"剖面框",
Resources.sectionBox_32px,
Resources.sectionBox_16px
);
var filter = UIAssist.NewPushButtonData<CivilViewFilterCmd>(
var filter = UIAssist.NewPushButtonData<DrawSheet.CivilViewFilterCmd>(
"过滤器",
Resources.filter_32px,
Resources.filter_16px,
"创建当前视图的结构模型区分的过滤"
);
var panelSchedule = UIAssist.NewPushButtonData<PanelScheduleCmd>(
var panelSchedule = UIAssist.NewPushButtonData<DrawSheet.PanelScheduleCmd>(
"铺砖明细表",
Resources.schedule_32px,
Resources.schedule_16px
);
var exportSchedulesPbd = UIAssist.NewPushButtonData<ExportSchedulesCmd>(
var exportSchedulesPbd = UIAssist.NewPushButtonData<DrawSheet.ExportSchedulesCmd>(
"导出明细表",
Resources.export_excel_32px,
Resources.export_excel_16px,
"导出明细表为Excel文件"
);
var systemDisplay = UIAssist.NewPushButtonData<SystemDisplayCmd>(
var systemDisplay = UIAssist.NewPushButtonData<DrawSheet.SystemDisplayCmd>(
"系统显示",
Resources.system_display_32px,
Resources.system_display_16px
);
var viewManager = UIAssist.NewPushButtonData<ViewManagerCmd>(
var viewManager = UIAssist.NewPushButtonData<DrawSheet.ViewManagerCmd>(
"视图管理",
Resources.view_manager_32px,
Resources.view_manager_16px
);
var quickViewSection = UIAssist.NewPushButtonData<QuickViewSectionCmd>(
var quickViewSection = UIAssist.NewPushButtonData<DrawSheet.QuickViewSectionCmd>(
"快速剖面",
Resources.view_section_32px,
Resources.view_section_16px
);
var elementsControlCmd = UIAssist.NewPushButtonData<ElementsControlCmd>(
var elementsControlCmd = UIAssist.NewPushButtonData<DrawSheet.ElementsControlCmd>(
"元素控制",
Resources.open_pane_32px,
Resources.open_pane_32px,
@@ -163,7 +163,7 @@ public class DrawingViewApp
}
private static void RegisterDockPaneAndEvent(UIControlledApplication application)
{
ElementsControlDock pane = new();
DrawSheet.ElementsControlDock pane = new();
application.RegisterDockablePane(Variables.PaneId, "元素控制菜单", pane);
}
private static void UiApp_ViewActivated(object sender, Autodesk.Revit.UI.Events.ViewActivatedEventArgs e)

View File

@@ -8,8 +8,7 @@ using ShrlAlgoToolkit.RevitAddins.RvFamily;
using ShrlAlgoToolkit.RevitAddins.RvFamily.FamilyLibrary;
using ShrlAlgoToolkit.RevitAddins.Common.Extensions;
namespace ShrlAlgoToolkit.RevitAddins.UIRibbon;
namespace ShrlAlgoToolkit.RevitAddins.Entry;
public class FamilyApp
{
@@ -183,37 +182,37 @@ public class FamilyApp
var familyManagePanel = application.CreateRibbonPanel(TabName, VbPanelName);
//在面板上添加添加浏览族库按钮
var localFamilyPbd = UIAssist.NewPushButtonData<FamilyLibraryCmd>(
var localFamilyPbd = UIAssist.NewPushButtonData<FamMaster.FamilyLibraryCmd>(
"本地族库",
Resources.library_32px,
Resources.library_16px
);
var familyMassSave = UIAssist.NewPushButtonData<FamilyProcessorCmd>(
var familyMassSave = UIAssist.NewPushButtonData<FamMaster.FamilyProcessorCmd>(
"族复用",
Resources.family_processor_32px,
Resources.family_processor_16px
);
var replaceInstance = UIAssist.NewPushButtonData<ReplaceInstanceCmd>(
var replaceInstance = UIAssist.NewPushButtonData<Modeling.ReplaceInstanceCmd>(
"替换族",
Resources.replace_32px,
Resources.replace_16px
);
var updateFamilyFile = UIAssist.NewPushButtonData<UpgradeFamilyCmd>(
var updateFamilyFile = UIAssist.NewPushButtonData<General.UpgradeFamilyCmd>(
"更新族",
Resources.available_updates_32px,
Resources.available_updates_16px,
"更新族文件缩略图及升级至当前版本"
);
var renameFamily = UIAssist.NewPushButtonData<RenameFamilyNameCmd>(
var renameFamily = UIAssist.NewPushButtonData<Standardizer.RenameFamilyNameCmd>(
"重命名族",
Resources.rename_family_32px,
Resources.rename_family_16px
);
var renameType = UIAssist.NewPushButtonData<RenameTypeNameCmd>(
var renameType = UIAssist.NewPushButtonData<Standardizer.RenameTypeNameCmd>(
"重命名类型",
Resources.rename_type_32px,
Resources.rename_type_16px

View File

@@ -8,8 +8,7 @@ using ShrlAlgoToolkit.RevitAddins.Properties;
using ShrlAlgoToolkit.RevitAddins.RvCommon;
using ShrlAlgoToolkit.RevitAddins.Common.Extensions;
namespace ShrlAlgoToolkit.RevitAddins.UIRibbon;
namespace ShrlAlgoToolkit.RevitAddins.Entry;
public class ModifyTabApp
{
@@ -33,58 +32,58 @@ public class ModifyTabApp
/// </summary>
/// <param name="alignElements">需对齐的元素集合</param>
/// <param name="alignType">对齐的类型</param>
private static void AlignByType(List<AlignModelElement> alignElements, AlignType alignType)
private static void AlignByType(List<General.AlignModelElement> alignElements, General.AlignType alignType)
{
switch (alignType)
{
case AlignType.Left:
case General.AlignType.Left:
{
//最左的元素
var leftAlignElement = alignElements.OrderBy(x => x.UpLeft.X).FirstOrDefault();
foreach (var alignElement in alignElements)
{
XYZ resultingPoint = new(leftAlignElement.UpLeft.X, alignElement.UpLeft.Y, 0);
alignElement.MoveTo(resultingPoint, AlignType.Left);
alignElement.MoveTo(resultingPoint, General.AlignType.Left);
}
break;
}
case AlignType.Right:
case General.AlignType.Right:
{
var rightAlignElement = alignElements.OrderByDescending(x => x.UpRight.X).FirstOrDefault();
foreach (var alignElement in alignElements)
{
XYZ resultingPoint = new(rightAlignElement.UpRight.X, alignElement.UpRight.Y, 0);
alignElement.MoveTo(resultingPoint, AlignType.Right);
alignElement.MoveTo(resultingPoint, General.AlignType.Right);
}
break;
}
case AlignType.Up:
case General.AlignType.Up:
{
var upAlignElement = alignElements.OrderByDescending(x => x.UpRight.Y).FirstOrDefault();
foreach (var alignElement in alignElements)
{
XYZ resultingPoint = new(alignElement.UpRight.X, upAlignElement.UpRight.Y, 0);
alignElement.MoveTo(resultingPoint, AlignType.Up);
alignElement.MoveTo(resultingPoint, General.AlignType.Up);
}
break;
}
case AlignType.Down:
case General.AlignType.Down:
{
var farthestAlign = alignElements.OrderBy(x => x.DownRight.Y).FirstOrDefault();
foreach (var alignElement in alignElements)
{
XYZ resultingPoint = new(alignElement.DownRight.X, farthestAlign.DownRight.Y, 0);
alignElement.MoveTo(resultingPoint, AlignType.Down);
alignElement.MoveTo(resultingPoint, General.AlignType.Down);
}
break;
}
case AlignType.HorizontallyCenter: //同一条垂直轴
case General.AlignType.HorizontallyCenter: //同一条垂直轴
{
var sortedElements = alignElements.OrderBy(x => x.UpRight.X).ToList();
var rightElement = sortedElements.LastOrDefault();
@@ -93,12 +92,12 @@ public class ModifyTabApp
foreach (var alignElement in sortedElements)
{
XYZ resultingPoint = new(xCoord, alignElement.Center.Y, 0);
alignElement.MoveTo(resultingPoint, AlignType.HorizontallyCenter);
alignElement.MoveTo(resultingPoint, General.AlignType.HorizontallyCenter);
}
break;
}
case AlignType.VerticallyCenter: //同一条水平轴
case General.AlignType.VerticallyCenter: //同一条水平轴
{
var sortedElements = alignElements.OrderBy(x => x.UpRight.Y).ToList();
var upperAlignAnnotation = sortedElements.LastOrDefault();
@@ -107,24 +106,24 @@ public class ModifyTabApp
foreach (var alignElement in sortedElements)
{
XYZ resultingPoint = new(alignElement.Center.X, yCoord, 0);
alignElement.MoveTo(resultingPoint, AlignType.VerticallyCenter);
alignElement.MoveTo(resultingPoint, General.AlignType.VerticallyCenter);
}
break;
}
case AlignType.Bottom:
case General.AlignType.Bottom:
{
var sortedElements = alignElements.OrderBy(z => z.Bottom).ToList();
var elevation = sortedElements.FirstOrDefault();
foreach (var alignElement in sortedElements)
{
XYZ resultingPoint = new(0, 0, elevation.Bottom);
alignElement.MoveTo(resultingPoint, AlignType.Bottom);
alignElement.MoveTo(resultingPoint, General.AlignType.Bottom);
}
break;
}
case AlignType.Middle:
case General.AlignType.Middle:
{
var sortedElements = alignElements.OrderBy(z => z.Middle).ToList();
//var middle = sortedElements.FirstOrDefault();
@@ -134,18 +133,18 @@ public class ModifyTabApp
foreach (var alignElement in sortedElements)
{
XYZ resultingPoint = new(0, 0, middle);
alignElement.MoveTo(resultingPoint, AlignType.Middle);
alignElement.MoveTo(resultingPoint, General.AlignType.Middle);
}
break;
}
case AlignType.Top:
case General.AlignType.Top:
{
var sortedElements = alignElements.OrderByDescending(z => z.Top).ToList();
var top = sortedElements.FirstOrDefault();
foreach (var alignElement in sortedElements)
{
XYZ resultingPoint = new(0, 0, top.Top);
alignElement.MoveTo(resultingPoint, AlignType.Top);
alignElement.MoveTo(resultingPoint, General.AlignType.Top);
}
break;
}
@@ -162,7 +161,7 @@ public class ModifyTabApp
return;
}
var alignType = (AlignType)rb.CommandParameter;
var alignType = (General.AlignType)rb.CommandParameter;
handler.Raise(_ =>
{
Document.Invoke(
@@ -170,7 +169,7 @@ public class ModifyTabApp
{
var selectedIds = UIDocument.Selection.GetElementIds();
var alignElements = (from id in selectedIds
let e = new AlignModelElement(Document.GetElement(id))
let e = new General.AlignModelElement(Document.GetElement(id))
select e).ToList();
//List<AlignModelElement> alignElements = new();
//foreach (var id in selectedIds)
@@ -213,7 +212,7 @@ public class ModifyTabApp
Text = "左对齐",
IsCheckable = true,
CommandHandler = new RelayCommand<object>(AlignCommand, _ => CanAlign()),
CommandParameter = AlignType.Left
CommandParameter = General.AlignType.Left
//Orientation = System.Windows.Controls.Orientation.Vertical
};
var alignRightBtn = new Autodesk.Windows.RibbonButton
@@ -228,7 +227,7 @@ public class ModifyTabApp
Text = "右对齐",
IsCheckable = true,
CommandHandler = new RelayCommand<object>(AlignCommand, _ => CanAlign()),
CommandParameter = AlignType.Right
CommandParameter = General.AlignType.Right
//Orientation = System.Windows.Controls.Orientation.Vertical
};
@@ -244,7 +243,7 @@ public class ModifyTabApp
Text = "下对齐",
IsCheckable = true,
CommandHandler = new RelayCommand<object>(AlignCommand, _ => CanAlign()),
CommandParameter = AlignType.Down
CommandParameter = General.AlignType.Down
//Orientation = System.Windows.Controls.Orientation.Vertical
};
var alignUpBtn = new Autodesk.Windows.RibbonButton
@@ -259,7 +258,7 @@ public class ModifyTabApp
Text = "上对齐",
IsCheckable = true,
CommandHandler = new RelayCommand<object>(AlignCommand, _ => CanAlign()),
CommandParameter = AlignType.Up
CommandParameter = General.AlignType.Up
//Orientation = System.Windows.Controls.Orientation.Vertical
};
var alignHCBtn = new Autodesk.Windows.RibbonButton
@@ -274,7 +273,7 @@ public class ModifyTabApp
Text = "水平中",
IsCheckable = true,
CommandHandler = new RelayCommand<object>(AlignCommand, _ => CanAlign()),
CommandParameter = AlignType.HorizontallyCenter
CommandParameter = General.AlignType.HorizontallyCenter
//Orientation = System.Windows.Controls.Orientation.Vertical
};
var alignVCBtn = new Autodesk.Windows.RibbonButton
@@ -289,7 +288,7 @@ public class ModifyTabApp
Text = "垂直中",
IsCheckable = true,
CommandHandler = new RelayCommand<object>(AlignCommand, _ => CanAlign()),
CommandParameter = AlignType.VerticallyCenter
CommandParameter = General.AlignType.VerticallyCenter
//Orientation = System.Windows.Controls.Orientation.Vertical
};
var alignTopBtn = new Autodesk.Windows.RibbonButton
@@ -306,7 +305,7 @@ public class ModifyTabApp
//默认水平,文字与图标
//Orientation = Orientation.Vertical,
CommandHandler = new RelayCommand<object>(AlignCommand, _ => CanAlign()),
CommandParameter = AlignType.Top
CommandParameter = General.AlignType.Top
};
var alignMiddleBtn = new Autodesk.Windows.RibbonButton
{
@@ -321,7 +320,7 @@ public class ModifyTabApp
IsCheckable = true,
//Orientation = Orientation.Vertical,
CommandHandler = new RelayCommand<object>(AlignCommand, _ => CanAlign()),
CommandParameter = AlignType.Middle
CommandParameter = General.AlignType.Middle
};
var alignBottomBtn = new Autodesk.Windows.RibbonButton
{
@@ -337,7 +336,7 @@ public class ModifyTabApp
IsCheckable = true,
//Orientation = Orientation.Vertical,
CommandHandler = new RelayCommand<object>(AlignCommand, _ => CanAlign()),
CommandParameter = AlignType.Bottom
CommandParameter = General.AlignType.Bottom
};
//面板行布局
@@ -538,7 +537,7 @@ public class ModifyTabApp
IsCheckable = true,
Orientation = Orientation.Vertical,
CommandHandler = new RelayCommand(
() => Common.Assists.WinDialogAssist.ShowOrActivate<DetailSelectFiltersView, DetailSelectFiltersViewModel>(uiapp, handler),
() => Common.Assists.WinDialogAssist.ShowOrActivate<General.DetailSelectFiltersView, DetailSelectFiltersViewModel>(uiapp, handler),
() =>
UIDocument?.Selection
.GetElementIds()
@@ -591,7 +590,7 @@ public class ModifyTabApp
IsCheckable = true,
Orientation = Orientation.Vertical,
CommandHandler = new RelayCommand(
() => Common.Assists.WinDialogAssist.ShowOrActivate<DetailSelectFiltersView, DetailSelectFiltersViewModel>(uiapp, handler),
() => Common.Assists.WinDialogAssist.ShowOrActivate<General.DetailSelectFiltersView, DetailSelectFiltersViewModel>(uiapp, handler),
() =>
UIDocument?.Selection
.GetElementIds()

View File

@@ -1,6 +1,7 @@
using System.Windows;
using Nice3point.Revit.Toolkit.External;
using Nice3point.Revit.Toolkit.External.Handlers;
using ShrlAlgoToolkit.RevitAddins.FamMaster;
using ShrlAlgoToolkit.RevitAddins.ModelManager;
using ShrlAlgoToolkit.RevitAddins.Properties;
using ShrlAlgoToolkit.RevitAddins.RvCivil;
@@ -8,7 +9,7 @@ using ShrlAlgoToolkit.RevitAddins.RvCommon;
using ShrlAlgoToolkit.RevitAddins.RvMEP;
using ShrlAlgoToolkit.RevitAddins.RvView;
namespace ShrlAlgoToolkit.RevitAddins.UIRibbon;
namespace ShrlAlgoToolkit.RevitAddins.Entry;
//[Obfuscation(Exclude = true, ApplyToMembers = true)]
public class RvApp : ExternalApplication
@@ -76,11 +77,11 @@ public class RvApp : ExternalApplication
CivilApp(Application);
MEPApp(Application);
_ = new ModifyTabApp(UiApplication);
_ = new Entry.ModifyTabApp(UiApplication);
_ = new DrawingViewApp(Application);
CreateCommonTools(Application);
_ = new TabManagerApp(Application);
_ = new FamilyApp(Application, UiApplication);
_ = new Entry.FamilyApp(Application, UiApplication);
if (Settings.Default.IsActiveAutoSave)
{
@@ -158,84 +159,84 @@ public class RvApp : ExternalApplication
private static void MEPApp(UIControlledApplication application)
{
var panel = application.CreateRibbonPanel(TabName, "机电");
var standMepCurve = UIAssist.NewButtonData<StandMepCurveCmd, EnableInViewPlan>(
var standMepCurve = UIAssist.NewButtonData<Mep.StandMepCurveCmd, EnableInViewPlan>(
"创建立管",
null,
Resources.stand_mepcurve_16px
).SetAvailability<EnableInViewPlan>();
var bloomConnector = UIAssist.NewPushButtonData<BloomConnectorCmd>("引出管线", null, Resources.bloom_16px, "从连接件生成管线");
var anyConnect = UIAssist.NewPushButtonData<AnyConnectCmd>("任意连接", null, Resources.any_connect_16px, "选择任意管线进行连接");
var moveConnect = UIAssist.NewPushButtonData<MoveConnectCmd>(
var bloomConnector = UIAssist.NewPushButtonData<Mep.BloomConnectorCmd>("引出管线", null, Resources.bloom_16px, "从连接件生成管线");
var anyConnect = UIAssist.NewPushButtonData<Mep.AnyConnectCmd>("任意连接", null, Resources.any_connect_16px, "选择任意管线进行连接");
var moveConnect = UIAssist.NewPushButtonData<Mep.MoveConnectCmd>(
"移动连接",
null,
Resources.move_connect_16px,
"根据最近距离的未连接的连接件,将其连接或角度过大则对齐连接"
);
var breakMepCurveBtn = UIAssist.NewPushButtonData<BreakMEPCurveCmd>(
var breakMepCurveBtn = UIAssist.NewPushButtonData<Mep.BreakMEPCurveCmd>(
"打断管线",
null,
Resources.break_mepcurve_16px,
"将管线打断成两根管线并保留打断后的连接关系"
);
var disConnect = UIAssist.NewPushButtonData<DisconnectCmd>(
var disConnect = UIAssist.NewPushButtonData<Mep.DisconnectCmd>(
"取消连接",
null,
Resources.disconnect_16px,
"取消设备、管线之间的连接"
);
var correctSlope = UIAssist.NewPushButtonData<CorrectMEPCurveSlopeCmd>(
var correctSlope = UIAssist.NewPushButtonData<Mep.CorrectMEPCurveSlopeCmd>(
"坡度修正",
null,
Resources.correct_mep_16px,
"修正管线的坡度"
);
var moveMEP = UIAssist.NewPushButtonData<MoveMEPCmd>(
var moveMEP = UIAssist.NewPushButtonData<Mep.MoveMEPCmd>(
"移动管线",
Resources.move_MEP_32px,
Resources.move_MEP_16px,
"基于管线底部参照或距离,上下移动管线"
);
var clashReport = UIAssist.NewPushButtonData<ClashReportCmd>(
var clashReport = UIAssist.NewPushButtonData<Mep.ClashReportCmd>(
"碰撞报告",
Resources.clash_report_32px,
Resources.clash_report_16px,
"根据Revit生成的报告快速定位碰撞构件"
);
var terminalConnect = UIAssist.NewPushButtonData<TerminalConnectToDuctCmd>(
var terminalConnect = UIAssist.NewPushButtonData<Mep.TerminalConnectToDuctCmd>(
"连接风口",
Resources.air_terminal_32px,
Resources.air_terminal_16px
);
var clashResolve = UIAssist.NewPushButtonData<ClashResolveCmd>(
var clashResolve = UIAssist.NewPushButtonData<Mep.ClashResolveCmd>(
"碰撞处理",
Resources.clash_resolve_32px,
Resources.clash_resolve_16px
);
var headroomCheck = UIAssist.NewPushButtonData<HeadroomCheckCmd>(
var headroomCheck = UIAssist.NewPushButtonData<Mep.HeadroomCheckCmd>(
"净高检查",
Resources.head_room_32px,
Resources.head_room_16px
);
var flipWorkplane = UIAssist.NewPushButtonData<FlipWorkplaneCmd>(
var flipWorkplane = UIAssist.NewPushButtonData<Mep.FlipWorkplaneCmd>(
"翻转工作平面",
Resources.flip_workplane_32px,
Resources.flip_workplane_16px,
"将可以翻转工作平面的族实例,翻转其工作平面"
);
var rotateInstance = UIAssist.NewPushButtonData<RotateInstanceCmd>(
var rotateInstance = UIAssist.NewPushButtonData<Mep.RotateInstanceCmd>(
"旋转管件实例",
Resources.rotate_instance_32px,
Resources.rotate_instance_16px,
"将管件族实例根据已连接的情况进行旋转"
);
var addInsulation = UIAssist.NewPushButtonData<AddInsulationCmd>(
var addInsulation = UIAssist.NewPushButtonData<Mep.AddInsulationCmd>(
"保温层",
Resources.add_insulation_32px,
Resources.add_insulation_16px,
"对水管和风管添加保温层"
);
var arrangeMEPCurve = UIAssist.NewPushButtonData<ArrangeMEPCurveCmd>(
var arrangeMEPCurve = UIAssist.NewPushButtonData<Mep.ArrangeMEPCurveCmd>(
"整理管线",
Resources.arrange_mep_32px,
Resources.arrange_mep_16px,
@@ -274,26 +275,26 @@ public class RvApp : ExternalApplication
Resources.model_check_32px,
"对模型进行多项要求的检查"
);
var templateManager = UIAssist.NewPushButtonData<TemplateManagerCmd>(
var templateManager = UIAssist.NewPushButtonData<Standardizer.TemplateManagerCmd>(
"样板定制",
Resources.template_32px,
Resources.template_16px,
"对项目样板进行批量处理"
);
var autoSavePbd = UIAssist.NewPushButtonData<AutoSaveCmd>("定时保存", Resources.save_32px, Resources.save_16px);
var purgeBtn = UIAssist.NewPushButtonData<PureModelCmd>(
var autoSavePbd = UIAssist.NewPushButtonData<General.AutoSaveCmd>("定时保存", Resources.save_32px, Resources.save_16px);
var purgeBtn = UIAssist.NewPushButtonData<General.PureModelCmd>(
"清理模型",
Resources.purge_32px,
Resources.purge_16px,
"清理并压缩模型文件大小"
);
var pipesCreatorPbd = UIAssist.NewPushButtonData<PipesCreatorCmd>(
var pipesCreatorPbd = UIAssist.NewPushButtonData<Modeling.PipesCreatorCmd>(
"管线生成",
Resources.pipe_creator_32px,
Resources.pipe_creator_16px,
"根据dwg图纸生成管线"
);
var instanceCreatorPbd = UIAssist.NewPushButtonData<InstanceCreatorCmd>(
var instanceCreatorPbd = UIAssist.NewPushButtonData<Modeling.InstanceCreatorCmd>(
"实例布置",
Resources.instance_creator_32px,
Resources.instance_creator_16px,
@@ -305,7 +306,7 @@ public class RvApp : ExternalApplication
Resources.model_by_curve_16px,
"根据dwg曲线或模型线对轮廓族放样或者布置族实例"
);
var toggleBackgroundPbd = UIAssist.NewPushButtonData<SwitchBackgroundCmd>(
var toggleBackgroundPbd = UIAssist.NewPushButtonData<DrawSheet.SwitchBackgroundCmd>(
"切换背景",
Resources.background_32px,
Resources.background_16px,

View File

@@ -2,8 +2,7 @@
using ShrlAlgoToolkit.RevitAddins.Properties;
using ShrlAlgoToolkit.RevitAddins.Common.Extensions;
namespace ShrlAlgoToolkit.RevitAddins.UIRibbon;
namespace ShrlAlgoToolkit.RevitAddins.Entry;
public class TabManagerApp
{
@@ -146,7 +145,7 @@ public class TabManagerApp
if (sender is RibbonToggleButton toggleButton)
{
var tabName = toggleButton.Name;
var tab = TabManagerApp.RibbonControl.FindTab(tabName);
var tab = Entry.TabManagerApp.RibbonControl.FindTab(tabName);
tab.IsVisible = toggleButton.IsChecked;
}
}

View File

@@ -0,0 +1,124 @@
using System.Windows;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Nice3point.Revit.Toolkit.External;
namespace ShrlAlgoToolkit.RevitAddins.FamMaster;
/// <summary>
/// 剪切内建模型
/// </summary>
[Transaction(TransactionMode.Manual)]
public class CutGeologyByLoopCmd : ExternalCommand
{
public override void Execute()
{
try
{
var curveElements = UiDocument.Selection
.PickElementsByRectangle(new GenericFilter<CurveElement>(), "请框选闭合的模型线或符号线")
.Cast<CurveElement>();
var curvesSelected = curveElements.Select(x => x.GeometryCurve).ToList();
if(curvesSelected.Count < 3)
{
MessageBox.Show("请至少选择三条线", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
return;
}
var curveList = SpatialAssist.GroupContinuousCurves(curvesSelected);
List<CurveLoop> curveLoops = new List<CurveLoop>();
foreach(var curves in curveList)
{
var loop = CurveLoop.Create(curves);
if(loop.IsOpen())
{
continue;
}
curveLoops.Add(loop);
}
if(curveLoops.Count == 0)
{
MessageBox.Show("未能构成闭合环", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
return;
}
if(curveLoops.Count > 1)
{
MessageBox.Show("存在多个闭合环,请确保只选择一个闭合环", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
return;
}
var solidInstances = UiDocument.Selection
.PickElementsByRectangle(
new FuncFilter(
e => e is FamilyInstance instance && instance.Symbol.Family.IsInPlace),
"请选择一个实体族")
.Cast<FamilyInstance>()
.ToList();
//var solidInstances = solidReferences.Select(x => x as FamilyInstance).ToList();
var solidCut = GeometryCreationUtilities.CreateExtrusionGeometry(curveLoops, new XYZ(0, 0, 1), 100000);
//StringBuilder sb = new StringBuilder();
Document.Invoke(
_ =>
{
foreach(var instance in solidInstances)
{
var geomElem = instance.get_Geometry(new Options());
foreach(var geometryObject in geomElem)
{
if(geometryObject is GeometryInstance geomInst)
{
var instanceGeoms = geomInst.GetInstanceGeometry();
foreach(var geom in instanceGeoms)
{
if(geom is Solid solid)
{
var solidResult = BooleanOperationsUtils.ExecuteBooleanOperation(
solid,
solidCut,
BooleanOperationsType.Intersect);
var shape = Document.CreateDirectShapeInstance(
instance.Name,
BuiltInCategory.OST_GenericModel,
[ solidResult ]);
Document.Regenerate();
var materialId = shape.GetMaterialIds(false).FirstOrDefault();
var subGeoElem = shape.get_Geometry(new Options());
foreach(var ins in subGeoElem)
{
if(ins is Solid subSolid)
{
foreach(Face item in subSolid.Faces)
{
try
{
Document.Paint(shape.Id, item, materialId);
} catch(Exception)
{
continue;
}
}
}
}
//shape.GetMaterialIds()
}
}
}
//var geomInst = geometryObject.GetInstanceGeometry();
}
}
},
"剪切几何");
//MessageBox.Show(sb.ToString());
} catch(Autodesk.Revit.Exceptions.OperationCanceledException)
{
} catch(Exception ex)
{
MessageBox.Show(ex.Message, "错误", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
}

View File

@@ -5,7 +5,11 @@ using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI.Selection;
namespace ShrlAlgoToolkit.RevitAddins.RvFamily;
using ShrlAlgoToolkit.RevitAddins.RvFamily;
using ShrlAlgoToolkit;
using ShrlAlgoToolkit.RevitAddins;
namespace ShrlAlgoToolkit.RevitAddins.FamMaster;
/// <summary>
/// 炸开族中的dwg或嵌套族图元
/// </summary>

View File

@@ -1,8 +1,12 @@
using Autodesk.Revit.Attributes;
using Nice3point.Revit.Toolkit.External;
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
using ShrlAlgoToolkit.RevitAddins.RvFamily.FamilyLibrary;
using ShrlAlgoToolkit;
using ShrlAlgoToolkit.RevitAddins;
using ShrlAlgoToolkit.RevitAddins.RvFamily;
namespace ShrlAlgoToolkit.RevitAddins.RvFamily.FamilyLibrary;
namespace ShrlAlgoToolkit.RevitAddins.FamMaster;
[Transaction(TransactionMode.Manual)]
public class FamilyLibraryCmd : ExternalCommand

View File

@@ -1,5 +1,5 @@
<ui:MelWindow
x:Class="ShrlAlgoToolkit.RevitAddins.RvFamily.FamilyLibrary.FamilyLibraryView"
x:Class="ShrlAlgoToolkit.RevitAddins.FamMaster.FamilyLibraryView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
@@ -7,12 +7,13 @@
xmlns:local="clr-namespace:ShrlAlgoToolkit.RevitAddins.RvFamily.FamilyLibrary"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="https://github.com/ShrlAlgo/Melskin"
xmlns:famMaster="clr-namespace:ShrlAlgoToolkit.RevitAddins.FamMaster"
Title="本地族库"
Width="1050"
Height="600"
MinWidth="1050"
MinHeight="600"
d:DataContext="{d:DesignInstance Type=local:FamilyLibraryViewModel}"
d:DataContext="{d:DesignInstance Type=famMaster:FamilyLibraryViewModel}"
Icon="{DynamicResource RevitIcon}"
ResizeMode="CanResizeWithGrip"
mc:Ignorable="d">

View File

@@ -1,4 +1,9 @@
namespace ShrlAlgoToolkit.RevitAddins.RvFamily.FamilyLibrary
using ShrlAlgoToolkit.RevitAddins.RvFamily.FamilyLibrary;
using ShrlAlgoToolkit;
using ShrlAlgoToolkit.RevitAddins;
using ShrlAlgoToolkit.RevitAddins.RvFamily;
namespace ShrlAlgoToolkit.RevitAddins.FamMaster
{
/// <summary>
/// LocalFamily.xaml 的交互逻辑.

View File

@@ -10,8 +10,12 @@ using Nice3point.Revit.Toolkit.External.Handlers;
using ShrlAlgoToolkit.RevitAddins.Common.Assists;
using static ShrlAlgoToolkit.RevitCore.Assists.RevitFileAssist;
using Settings = ShrlAlgoToolkit.RevitAddins.Properties.Settings;
using ShrlAlgoToolkit.RevitAddins.RvFamily.FamilyLibrary;
using ShrlAlgoToolkit;
using ShrlAlgoToolkit.RevitAddins;
using ShrlAlgoToolkit.RevitAddins.RvFamily;
namespace ShrlAlgoToolkit.RevitAddins.RvFamily.FamilyLibrary;
namespace ShrlAlgoToolkit.RevitAddins.FamMaster;
public partial class FamilyLibraryViewModel : ObservableObject
{

Some files were not shown because too many files have changed in this diff Show More