소스 검색

xls:增加修改元空间,编辑框映射

xulisong 6 년 전
부모
커밋
0623ad5648

+ 4 - 0
MBI/MBIResource/DataDictionary/ComponentCodeToInputType.xml

@@ -20,4 +20,8 @@
     <ComponentCode>D1</ComponentCode>
     <InputType>Enum_D1</InputType>
   </ComponentCodeToInputType>
+ <ComponentCodeToInputType>
+    <ComponentCode>D2</ComponentCode>
+    <InputType>Enum_D1</InputType>
+  </ComponentCodeToInputType>
 </ArrayOfComponentCodeToInputType>

+ 14 - 0
MBI/Menu/MBITool.xml

@@ -95,6 +95,19 @@
       <MenuTab>MBITool_W</MenuTab>
       <Modules>MBITool</Modules>
     </Button>
+
+ <Button ButtonStyles="Large">
+      <ButtonName>SAGA.MBI.AddSiSpaceCommand</ButtonName>
+      <ButtonText>增加遗漏空间</ButtonText>
+      <ImageName>1、打开楼层模型</ImageName>
+      <DllName>..\OutputDll\SAGA.MBI.exe</DllName>
+      <ClassName>SAGA.MBI.AddSiSpaceCommand</ClassName>
+      <ToolTip>加遗漏空间。</ToolTip>
+      <LongDescription>修复创建元空间缺失问题</LongDescription>
+      <ToolTipImage></ToolTipImage>
+      <MenuTab>MBITool_W</MenuTab>
+      <Modules>MBITool</Modules>
+    </Button>
   </Panel>
   <Panel PanelName="工具" GroupFlag="True" GroupImage="" RevitVer="R14,R15,R16,R17"  ButtonStyles="Large">
 
@@ -198,6 +211,7 @@
       <MenuTab>MBITool_W</MenuTab>
       <Modules>MBITool</Modules>
     </Button>
+
 </Panel>
 </Menus>
 <!--名称里面换行-->

+ 1 - 1
MBI/SAGA.GplotManage/RelationManager/ElectricalRelationUploader.cs

@@ -44,7 +44,7 @@ namespace SAGA.GplotManage
             {
                 foreach (var n in dn.Childrens)
                 {
-                    data.Add(GetReleateData(dn.EId, n.EId));
+                   // data.Add(GetReleateData(dn.EId, n.EId));
                     CreateGraph(n, data);
                 }
             }

+ 2 - 0
MBI/SAGA.MBI/DataArrange/DalInfoCode.cs

@@ -31,6 +31,8 @@ namespace SAGA.MBI.DataArrange
             codes.Add(new ComponentCodeToInputType() { ComponentCode = "B1", InputType = "TextBox_String_B1" });
             codes.Add(new ComponentCodeToInputType() { ComponentCode = "C5", InputType = "DataTime_Date_C5" });
             codes.Add(new ComponentCodeToInputType() { ComponentCode = "D1", InputType = "Enum_D1" });
+            //第二新加
+            codes.Add(new ComponentCodeToInputType() { ComponentCode = "D2", InputType = "Enum_D1" });
             string path = MBIConst.MBIDataDictionaryPath;
             string fileName = "ComponentCodeToInputType.xml";
             SerializerByXml.SerializeAndSave(path, fileName, codes);

+ 8 - 1
MBI/SAGA.MBI/TestCommand.cs

@@ -468,7 +468,14 @@ namespace SAGA.MBI
                                 continue;
                             }
 
-                            intNum = intNum + 1;
+                            if (intNum < 23)
+                            {
+                                intNum = intNum + 1;
+                            }
+                            else
+                            {
+                                intNum = intNum + 2;
+                            }
                             string newName = name.Substring(0, index) + intNum + name.Substring(index + match.Length);
                             currentLevel.SetParameter(BuiltInParameter.DATUM_TEXT, newName);
                         }

+ 71 - 0
MBI/SAGA.MBI/ToolCommand.cs

@@ -20,6 +20,8 @@ using SAGA.DotNetUtils;
 using SAGA.DotNetUtils.Logger;
 using SAGA.DotNetUtils.Others;
 using SAGA.MBI.Common;
+using SAGA.MBI.DataArrange;
+using SAGA.MBI.Model;
 using SAGA.MBI.Tools;
 using SAGA.MBI.ToolsData;
 using SAGA.MBI.ToolsData.CheckBase;
@@ -567,5 +569,74 @@ namespace SAGA.MBI
         }
     }
     #endregion
+    /// <summary>
+    /// 增加缺失元空间
+    /// </summary>
+    [Transaction(TransactionMode.Manual)]
+    [Regeneration(RegenerationOption.Manual)]
+    public class AddSiSpaceCommand : ExternalCommand
+    {
+        public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
+        {
+            List<string> errorIds = new List<string>();
+            List<string> totalIds = new List<string>();
+            try
+            {
+                var tip = MessageShow.Question("确认增加缺失元空间信息");
+                if (tip)
+                {
+                    MFloor floor = ExternalDataWrapper.Current.Doc.GetCurMFloor();
+                    if (floor != null)
+                    {
+                        var context = DalCommon.DownLoadFloorDataByBIMFloorInfo(floor);
+                        context.OpenDocument();
+                        var doc = context.RevitDoc;
+                        var revitSpaces = doc.GetSpaces();
+                        var platSpaces = context.MSpaces;
+                        foreach (var space in revitSpaces)
+                        {
+                            if (!space.IsSpace())
+                            {
+                                continue;
+                            }
+                            var spaceid = space.GetCloudBIMId();
+                            var mspace = platSpaces.FirstOrDefault(t => t.BimID == spaceid);
+                            if (mspace == null)
+                            {
+                                totalIds.Add(space.Id.ToString());
+                                mspace = DalSpace.GetSpace(space);
+                                mspace.Operator = DocumentChangedOperator.Add;
+                                if (!mspace.AddObject())
+                                {
+                                    errorIds.Add(space.Id.ToString());
+                                }
+                            }
+                        }
+                       
+                    }
+                    MessageBox.Show("总共修改:"+totalIds.Count);
+                    if (errorIds.Any()) ;
+                    {
+                        MessageBox.Show("错误Ids:" + string.Join(";",errorIds));
+                    }
+                }
+            }
+            catch (Exception e)
+            {
+                MessageShow.Show(e);
+                return Result.Cancelled;
+            }
+            return Result.Succeeded;
+        }
+
 
+        /// <summary>
+        /// Onlys show the dialog when a document is open, as Dockable dialogs are only available
+        /// when a document is open.
+        /// </summary>
+        public override bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
+        {
+            return true;
+        }
+    }
 }

+ 53 - 24
MBI/SAGA.MBI/WinView/Space/SpaceManager.cs

@@ -133,32 +133,61 @@ namespace SAGA.MBI.WinView
                 var phase = doc.GetElement(phaseId) as Phase;
                 #region 创建新的节点
                 List<XYZ> points = new List<XYZ>();
-                //using (SubTransaction sub=new SubTransaction(doc)) 
-                //{
-                //    var spaceSipliter=doc.GetElements<>()
-                //}
-               // PlanTopologySetting
-               // doc.Create.newsp
-                //doc.get_PlanTopology(,)
-                //var topology = doc.get_PlanTopology(level, phase);
-                //foreach (PlanCircuit topologyCircuit in topology.Circuits)
-                //{
-                //    var point = topologyCircuit.GetPointInside();
-                //    var xyz = new XYZ(point.U, point.V, level.ProjectElevation); //适当升高一些
-                //    points.Add(xyz);
-                //}
+                using (SubTransaction sub = new SubTransaction(doc))
+                {
+                    //把所有的空间分割转换成房间分割,然后获取封闭区域
+
+                    try
+                    {
+                        sub.Start();
+                        var virWalls = doc.FilterElements<CurveElement>((line) =>
+                        {
+                            var categoryId = line.Category.Id.IntegerValue;
+                            return categoryId == (int) BuiltInCategory.OST_MEPSpaceSeparationLines && line is ModelLine;
+                        }).OfType<ModelLine>();
+                        CurveArray curveArray = new CurveArray();
+                        foreach (var modelLine in virWalls)
+                        {
+                            curveArray.Append(modelLine.GeometryCurve);
+                        }
+                        #region 创建房间分割
+
+                        Plane p = Plane.CreateByNormalAndOrigin(view.ViewDirection, view.Origin);
+                        var sp = SketchPlane.Create(doc, p);
+                       doc.Create.NewRoomBoundaryLines(sp, curveArray, view);
+
+                        #endregion
 
-                //foreach (var point in points)
-                //{
-                //    var oldSpace = doc.GetSpaceAtPoint(point, phase);
-                //    if (oldSpace == null)
-                //    {
-                //        doc.Create.NewSpace(level, phase, new UV(point.X, point.Y));
-                //    }
-                //}
+                        #region 获取封闭区域
+                        var topology = doc.get_PlanTopology(level, phase);
+                        foreach (PlanCircuit topologyCircuit in topology.Circuits)
+                        {
+                            var point = topologyCircuit.GetPointInside();
+                            var xyz = new XYZ(point.U, point.V, level.ProjectElevation+1); //适当升高一些
+                            points.Add(xyz);
+                        }                   
+                        #endregion
+                    }
+                    catch (Exception e)
+                    {
+                    }
+                    finally
+                    {
+                        sub.RollBack();
+                    }
+                }
+                #endregion
+                #region 创建空间
+                foreach (var point in points)
+                {
+                    var oldSpace = doc.GetSpaceAtPoint(point, phase);
+                    if (oldSpace == null)
+                    {
+                        doc.Create.NewSpace(level, phase, new UV(point.X, point.Y));
+                    }
+                }
+               // var newSpaces = doc.Create.NewSpaces2(level, phase, view); 
                 #endregion
-                // doc.Create
-                var newSpaces = doc.Create.NewSpaces2(level, phase, view);
             }
 
         }

+ 1 - 1
MBI/SAGA.MBI/WinView/Space/WinConfirm.xaml

@@ -19,7 +19,7 @@
                <RowDefinition Height="*"></RowDefinition>
                <RowDefinition Height="100"></RowDefinition>
            </Grid.RowDefinitions>
-        <TextBlock Grid.Row="0" VerticalAlignment="Center" FontSize="18" Margin="30" Text="{Binding ShowMessage}"/>
+        <TextBlock Grid.Row="0" VerticalAlignment="Center" FontSize="18" Margin="30" Text="{Binding ShowMessage}" TextWrapping = "Wrap"/>
         <WrapPanel Grid.Row="1"  HorizontalAlignment="Center">
             <Button Name="btnSure" Content="{Binding BtnSure}" Click="btnSure_Click" Width="170"/>
             <Button Name="btnCancel" Content="{Binding BtnCancel}" Click="btnCancel_Click"/>