Browse Source

mxg:添加Revit菜单图片显示

mengxiangge 5 years ago
parent
commit
e49864fe9e

+ 1 - 1
FWindSoft/Revit/XiaoHong/MainWindow.xaml.cs

@@ -34,7 +34,7 @@ namespace LRH
 
         private void MainWindow_Loaded(object sender, RoutedEventArgs e)
         {
-            Button_Click(sender,e);
+            Button_Click_1(sender,e);
         }
 
         private void Button_Click(object sender, RoutedEventArgs e)

+ 1 - 1
FWindSoft/Saga.PlugIn/CreateFacility/WinCreateFacility.xaml

@@ -29,7 +29,7 @@
                     ></Button>
                 </Grid>
             <Grid Grid.Row="1">
-                <TextBox Text="{Binding Path=TabCode,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
+                <TextBox Text="{Binding Path=TabCode,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" IsReadOnly="True">
                     <TextBox.Resources>
                         <VisualBrush x:Key="HelpBrush" TileMode="None" Opacity="0.3" Stretch="None" AlignmentX="Left" AlignmentY="Top">
                             <VisualBrush.Visual>

+ 1 - 1
FWindSoft/Saga.PlugIn/CreateFacilityCommand.cs

@@ -16,7 +16,7 @@ namespace Saga.PlugIn
 {
     [Transaction(TransactionMode.Manual)]
     [Regeneration(RegenerationOption.Manual)]
-    [Button(ButtonName = "待建模设备", Index = -1, PanelName = "禹数建模工作", GroupName = "完善设备设施模型")]
+    [Button(ButtonName = "待建模设备", Index = 3, TabName = "禹数建模工具", PanelName = "完善设备设施模型",ImageName = "pack://application:,,,/Saga.PlugIn;component/Image/待建模设备")]
     public class CreateFacilityCommand : ExternalCommand
     {
         public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)

BIN
FWindSoft/Saga.PlugIn/Image/建模规范检查16.png


BIN
FWindSoft/Saga.PlugIn/Image/建模规范检查32.png


BIN
FWindSoft/Saga.PlugIn/Image/待建模设备16.png


BIN
FWindSoft/Saga.PlugIn/Image/待建模设备32.png


BIN
FWindSoft/Saga.PlugIn/Image/立管检查16.png


BIN
FWindSoft/Saga.PlugIn/Image/立管检查32.png


+ 2 - 1
FWindSoft/Saga.PlugIn/ModelCheck/CheckOperation.cs

@@ -82,7 +82,8 @@ namespace Saga.PlugIn.ModelCheck
             });
 
             //重置workbook准备保存结果
-            DCRExport.ClearWorkbook();
+            DCRExport.ClearWorkbook(DCRExport.MCRPath);
+
             //保存
             list.ForEach(t => t.Export2());
             ExportResultSummary(list);

+ 19 - 17
FWindSoft/Saga.PlugIn/ModelCheck/DCRExport.cs

@@ -21,6 +21,7 @@ namespace Saga.PlugIn.ModelCheck
     public static class DCRExport
     {
         public static string MCRPath = Path.Combine(AppBaseInfo.DllRunPath, @"ModelCheck\ExcelTemplate\模型检查结果输出格式-模版.xlsx");
+        public static string VerticalPipePath = Path.Combine(AppBaseInfo.DllRunPath, @"VerticalPipeCheck\ExcelTemplate\立管对齐检查-模板.xlsx");
         /// <summary>
         /// 获取导出Excel
         /// </summary>
@@ -54,7 +55,7 @@ namespace Saga.PlugIn.ModelCheck
         {
             if (isreset)
             {
-                ClearWorkbook();
+                m_ExportWorkBook = null;
             }
             if (m_ExportWorkBook == null)
             {
@@ -88,9 +89,10 @@ namespace Saga.PlugIn.ModelCheck
         /// <summary>
         /// 重置workbook
         /// </summary>
-        public static void ClearWorkbook()
+        public static void ClearWorkbook(string path)
         {
             m_ExportWorkBook = null;
+            SetTemplatePath(path);
         }
         /// <summary>
         /// 保存
@@ -103,21 +105,21 @@ namespace Saga.PlugIn.ModelCheck
             bool result = true;
             try
             {
-                bool allVisible = true;
-                //判断全部都隐藏不保存
-                for (int i = 0; i < book.NumberOfSheets - 1; i++)
-                {
-                    bool tempVisible = book.IsSheetVeryHidden(i);
-                    if (!tempVisible)
-                    {
-                        allVisible = false;
-                    }
-                }
-                if (allVisible)
-                {
-                    MessageShowBase.Infomation("所有检查项都通过检查,取消保存");
-                    return result;
-                }
+                //bool allVisible = true;
+                ////判断全部都隐藏不保存
+                //for (int i = 0; i < book.NumberOfSheets - 1; i++)
+                //{
+                //    bool tempVisible = book.IsSheetVeryHidden(i);
+                //    if (!tempVisible)
+                //    {
+                //        allVisible = false;
+                //    }
+                //}
+                //if (allVisible)
+                //{
+                //    MessageShowBase.Infomation("所有检查项都通过检查,取消保存");
+                //    return result;
+                //}
                 MemoryStream ms = new MemoryStream();
                 book.Write(ms);
 

BIN
FWindSoft/Saga.PlugIn/ModelCheck/ExcelTemplate/模型检查结果输出格式-模版.xlsx


+ 1 - 1
FWindSoft/Saga.PlugIn/ModelCheckCommand.cs

@@ -16,7 +16,7 @@ namespace Saga.PlugIn
 {
     [Transaction(TransactionMode.Manual)]
     [Regeneration(RegenerationOption.Manual)]
-    [Button(ButtonName = "建模规范检查", Index = -1, PanelName = "禹数建模工作", GroupName = "模型检查")]
+    [Button(ButtonName = "建模规范检查", Index = 1, TabName = "禹数建模工具", PanelName = "模型检查", ImageName = "pack://application:,,,/Saga.PlugIn;component/Image/建模规范检查")]
     public class ModelCheckCommand : ExternalCommand
     {
         public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)

+ 22 - 1
FWindSoft/Saga.PlugIn/Saga.PlugIn.csproj

@@ -99,7 +99,7 @@
       <DependentUpon>WinTipMissFamily.xaml</DependentUpon>
     </Compile>
     <Compile Include="CreateFacilityCommand.cs" />
-    <Compile Include="VerticalPpeCheckCommand.cs" />
+    <Compile Include="VerticalPipeCheckCommand.cs" />
     <Compile Include="ModelCheckCommand.cs" />
     <Compile Include="ModelCheck\ModelCheckConverter.cs" />
     <Compile Include="ModelCheck\InstanceLocationOverlapCheck.cs" />
@@ -146,6 +146,9 @@
     </Compile>
   </ItemGroup>
   <ItemGroup>
+    <Content Include="VerticalPipeCheck\ExcelTemplate\立管对齐检查-模板.xlsx">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
     <Resource Include="ModelCheck\Image\叉.png">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Resource>
@@ -167,6 +170,24 @@
     <Resource Include="Image\下一层.png">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Resource>
+    <Resource Include="Image\建模规范检查32.png">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Resource>
+    <Resource Include="Image\待建模设备32.png">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Resource>
+    <Resource Include="Image\建模规范检查16.png">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Resource>
+    <Resource Include="Image\待建模设备16.png">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Resource>
+    <Resource Include="Image\立管检查16.png">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Resource>
+    <Resource Include="Image\立管检查32.png">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Resource>
     <Content Include="ModelCheck\ExcelTemplate\模型检查结果输出格式-模版.xlsx">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>

BIN
FWindSoft/Saga.PlugIn/VerticalPipeCheck/ExcelTemplate/立管对齐检查-模板.xlsx


+ 20 - 4
FWindSoft/Saga.PlugIn/VerticalPipeCheck/VerticalPipeUtil.cs

@@ -10,6 +10,7 @@ using System.Text;
 using System.Threading.Tasks;
 using Autodesk.Revit.DB;
 using FWindSoft.Revit;
+using FWindSoft.Wpf;
 using NPOI.SS.UserModel;
 using Saga.PlugIn.ModelCheck;
 using SAGA.DotNetUtils;
@@ -24,6 +25,13 @@ namespace Saga.PlugIn.VerticalPipeCheck
     /// </summary>
     class VerticalPipeUtil
     {
+        /// <summary>
+        /// 执行立管检查
+        /// </summary>
+        /// <param name="upPath"></param>
+        /// <param name="downPath"></param>
+        /// <param name="savePath"></param>
+        /// <returns></returns>
         public static Tuple<int,int> Execute(string upPath,string downPath,string savePath)
         {
             try
@@ -35,6 +43,8 @@ namespace Saga.PlugIn.VerticalPipeCheck
                     string fileName = path.GetFileName();
                     foreach (VerticalPipe pipe in pipes1)
                     {
+                        //刷新界面
+                        WpfSysCmd.DoEvent();
                         var pipes = pipes2.Where(t => t.OpenXyz.IsAlmostEqualTo(pipe.OpenXyz));
                         if (pipes.Any())
                         {
@@ -63,7 +73,7 @@ namespace Saga.PlugIn.VerticalPipeCheck
                 #region Save
 
                 //重置workbook准备保存结果
-                DCRExport.ClearWorkbook();
+                DCRExport.ClearWorkbook(DCRExport.VerticalPipePath);
                 //保存
                 ExportResult(results);
                 DCRExport.Save(savePath, DCRExport.GetWorkbook());
@@ -86,7 +96,11 @@ namespace Saga.PlugIn.VerticalPipeCheck
         /// <returns></returns>
         public static List<VerticalPipe> GetVerticalMEPCurves(string path,bool isup)
         {
+            //刷新界面
+            WpfSysCmd.DoEvent();
             var doc=RevitCore.App.OpenDocumentFile(path);
+            //刷新界面
+            WpfSysCmd.DoEvent();
             string fileName = path.GetFileName();
             var mepcurves = doc.GetElements<MEPCurve>();
             List<VerticalPipe> verticalPipes=new List<VerticalPipe>();
@@ -103,12 +117,13 @@ namespace Saga.PlugIn.VerticalPipeCheck
                         XYZ point = null;
                         if (isup)
                         {
-                            point = start.Z.IsThan(end.Z) ? start : end;
+                            point = start.Z.IsThan(end.Z) ? end : start;
                         }
                         else
                         {
-                            point = start.Z.IsThan(end.Z) ? end : start;
+                            point = start.Z.IsThan(end.Z) ? start : end;
                         }
+
                         Connector connector = mepCurve.GetNearConnector(point);
                         if (!connector.IsConnected)
                         {
@@ -119,6 +134,8 @@ namespace Saga.PlugIn.VerticalPipeCheck
                             verticalPipe.FileName = fileName;
                             verticalPipes.Add(verticalPipe);
                         }
+                        //刷新界面
+                        WpfSysCmd.DoEvent();
                     }
                 }
             }
@@ -145,7 +162,6 @@ namespace Saga.PlugIn.VerticalPipeCheck
                 //rowTip.AddCell(0, $"总检查{list.Count}条数据,未通过检查的如下", DataCheckNPOIStyle.Title);
                 foreach (var result in list)
                 {
-                    if (result.IsRight) continue;
                     index++;
                     IRow rowN = sheet.CreateRow(index);
                     DataCheckNPOIStyle style = result.IsRight ? DataCheckNPOIStyle.Content : DataCheckNPOIStyle.Error;

+ 34 - 2
FWindSoft/Saga.PlugIn/VerticalPipeCheck/VmVerticalPipeCheck.cs

@@ -12,6 +12,7 @@ using System.Threading.Tasks;
 using FWindSoft.Wpf;
 using Saga.PlugIn.CreateFacility;
 using Saga.PlugIn.ModelCheck;
+using SAGA.DotNetUtils.Extend;
 using SAGA.DotNetUtils.WPF;
 using SAGA.RevitUtils;
 
@@ -22,6 +23,10 @@ namespace Saga.PlugIn.VerticalPipeCheck
     /// </summary>
     public class VmVerticalPipeCheck:BaseViewModelStub
     {
+        public VmVerticalPipeCheck()
+        {
+            SaveDir = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory));
+        }
         #region Property
         private string m_UpFilePath;
         /// <summary>
@@ -99,7 +104,7 @@ namespace Saga.PlugIn.VerticalPipeCheck
                         WpfSysCmd.DoEvent();
                         ModelCheckState = ModelCheckState.Progress;
                         string savePath = Path.Combine(SaveDir,
-                            $"{"模型规范检查报告"}{DateTime.Now.ToString("yyyyMMddHHmmss")}.xlsx");
+                            $"{UpFilePath.GetFileName()}-{DownFilePath.GetFileName()}{"立管检查报告"}{DateTime.Now.ToString("yyyyMMddHHmmss")}.xlsx");
                         var tuple=VerticalPipeUtil.Execute(UpFilePath,DownFilePath,savePath);
                         ModelCheckState = ModelCheckState.Ending;
                         //为了Ending的界面显示,出问题注释掉
@@ -111,7 +116,9 @@ namespace Saga.PlugIn.VerticalPipeCheck
                     case ModelCheckState.Progress:
                         break;
                     case ModelCheckState.Ending:
-                        System.Diagnostics.Process.Start("explorer.exe", SaveDir);
+                        ModelCheckState = ModelCheckState.Prepare;
+                        DownFilePath = UpFilePath;
+                        UpFilePath = "";
                         break;
                 }
             }
@@ -123,7 +130,32 @@ namespace Saga.PlugIn.VerticalPipeCheck
         }
         public bool CanExecute(object param)
         {
+            switch (ModelCheckState)
+            {
+                    case ModelCheckState.Prepare:
+                        if (string.IsNullOrEmpty(UpFilePath) || string.IsNullOrEmpty(DownFilePath) ||
+                            string.IsNullOrEmpty(SaveDir))
+                            return false;
+                        break;
+            }
             return ModelCheckState.Progress != ModelCheckState;
         }
+        [Command]
+        public void OpenDir(object param)
+        {
+            try
+            {
+                System.Diagnostics.Process.Start("explorer.exe", SaveDir);
+            }
+            catch (Exception e)
+            {
+                MessageShow.Show(e);
+            }
+
+        }
+        public bool CanOpenDir(object param)
+        {
+            return true;
+        }
     }
 }

+ 8 - 7
FWindSoft/Saga.PlugIn/VerticalPipeCheck/WinVecticalPipeCheck.xaml

@@ -36,13 +36,13 @@
                     </Grid.RowDefinitions>
                     <Image Grid.Row="1" Grid.Column="0"
                            Source="../Image/上一层.png"></Image>
-                    <TextBox Grid.Row="1" Grid.Column="1" Name="TxtUpPath"
+                    <TextBox Grid.Row="1" Grid.Column="1" Name="TxtUpPath"  IsReadOnly="True"
                              Text="{Binding Path=UpFilePath,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}"></TextBox>
                     <Button Grid.Row="1" Grid.Column="2" Click="BtnSelectFileUp_OnClick" Content="选择"
                             Margin="10,0,5,0"></Button>
                     <Image Grid.Row="3" Grid.Column="0"
                            Source="../Image/下一层.png"></Image>
-                    <TextBox Grid.Row="3" Grid.Column="1" Name="TxtDownPath"
+                    <TextBox Grid.Row="3" Grid.Column="1" Name="TxtDownPath"  IsReadOnly="True"
                              Text="{Binding Path=DownFilePath,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}"></TextBox>
                     <Button Grid.Row="3" Grid.Column="2" Click="BtnSelectFileDown_OnClick" Content="选择"
                             Margin="10,0,5,0"></Button>
@@ -75,7 +75,7 @@
                         <ColumnDefinition Width="*"></ColumnDefinition>
                         <ColumnDefinition Width="100"></ColumnDefinition>
                     </Grid.ColumnDefinitions>
-                    <TextBox Margin="10,0,0,0" VerticalContentAlignment="Center" Height="25" 
+                    <TextBox Margin="10,0,0,0" VerticalContentAlignment="Center" Height="25" IsReadOnly="True"
                              Name="txtPath"
                              Text="{Binding Path=SaveDir,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}" 
                              VerticalAlignment="Center"></TextBox>
@@ -95,11 +95,12 @@
                                     Converter={StaticResource ItemImageUnEqualVisibleConverter},
                                             ConverterParameter={x:Static local:ModelCheckState.Progress}}">
                 <Grid.RowDefinitions>
-                    <RowDefinition Height="30"></RowDefinition>
+                    <RowDefinition Height="40"></RowDefinition>
                     <RowDefinition Height="40"></RowDefinition>
                     <RowDefinition Height="60"></RowDefinition>
                 </Grid.RowDefinitions>
-                <Grid Grid.Row="0" Margin="5,0">
+                <Grid Grid.Row="0" Margin="5,8,0,2">
+                    <Label Margin="10,0,0,0" Content="检查中..." VerticalAlignment="Center" Foreground="LightGray"></Label>
                 </Grid>
                 <Grid Grid.Row="1" Margin="15,0">
                     <Image Height="15"  gif:AnimationBehavior.SourceUri="../Image/进度条.gif" />
@@ -129,11 +130,11 @@
                 <Grid Grid.Row="2" Background="LightGray">
                     <Button Width="120" Height="25" Background="White"  Foreground="Black" Content="打开文件位置" 
                             HorizontalAlignment="Right" Margin="0,0,115,0" VerticalAlignment="Center" 
-                            Command="{Binding Path=Commands.Execute}" 
+                            Command="{Binding Path=Commands.OpenDir}" 
                             ></Button>
                     <Button Width="100" Height="25" Background="Black"  Foreground="White" Content="继续检查"
                             HorizontalAlignment="Right" Margin="0,0,5,0" VerticalAlignment="Center" 
-                            Click="ButtonNext_OnClick" ></Button>
+                            Command="{Binding Path=Commands.Execute}" ></Button>
                 </Grid>
             </Grid>
         </Grid>

+ 6 - 2
FWindSoft/Saga.PlugIn/VerticalPpeCheckCommand.cs

@@ -17,9 +17,13 @@ namespace Saga.PlugIn
 {
     [Transaction(TransactionMode.Manual)]
     [Regeneration(RegenerationOption.Manual)]
-    [Button(ButtonName = "立管检查", Index = -1,PanelName = "禹数建模工作",GroupName = "模型检查")]
-    public class VerticalPpeCheckCommand : ExternalCommand
+    [Button(ButtonName = "立管检查", Index = 2,TabName = "禹数建模工具", PanelName = "模型检查", ImageName = "pack://application:,,,/Saga.PlugIn;component/Image/立管检查")]
+    public class VerticalPipeCheckCommand : ExternalCommand
     {
+        public VerticalPipeCheckCommand()
+        {
+            ApplicationShow = true;
+        }
         public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
         {
             VmVerticalPipeCheck viewModel=new VmVerticalPipeCheck();