瀏覽代碼

mxg:修正虚拟墙无法导出问题;弧形墙Location导出为Line问题

mengxiangge 5 年之前
父節點
當前提交
1c5d30a167

+ 42 - 0
JBIM/ExportStart/FLogger.cs

@@ -0,0 +1,42 @@
+/* ==============================================================================
+ * 功能描述:FLogger  
+ * 创 建 者:Garrett
+ * 创建日期:2019/8/2 16:07:06
+ * ==============================================================================*/
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Net.Mime;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ExportStart
+{
+    /// <summary>
+    /// FLogger
+    /// </summary>
+    class FLogger
+    {
+        private string m_LoggerPath = @"D:\log.txt";
+        private FLogger()
+        { }
+
+        private static FLogger m_Instance = null;
+
+        public static FLogger Instance
+        {
+            get
+            {
+                if(m_Instance==null)
+                    m_Instance=new FLogger();
+                return m_Instance;
+            }
+        }
+
+        public void Debug(string str)
+        {
+            File.AppendAllText(m_LoggerPath,str+"\r\n");
+        }
+    }
+}

+ 7 - 0
JBIM/JBIM/Definition/GeometryLocation.cs

@@ -42,5 +42,12 @@ namespace JBIM.Definition
             result.Points.AddRange(xyzes);
             return result;
         }
+
+        public static GeometryLocation CreateArcLocation(List<XYZ> xyzes)
+        {
+            var result = new GeometryLocation(LocationType.Arc);
+            result.Points.AddRange(xyzes);
+            return result;
+        }
     }
 }

+ 4 - 1
JBIM/RevitToJBim/ComponentParse/ParseCore.cs

@@ -136,7 +136,10 @@ namespace RevitToJBim.ComponentParse
             else if (location is LocationCurve curve)
             {
                 var useCurve = curve.Curve.GetPoints();
-                return GeometryLocation.CreateLineLocation(useCurve.Select(xyz=>BimConvert.ConvertToXYZ(xyz)).ToList());
+                if(curve.Curve is Line)
+                    return GeometryLocation.CreateLineLocation(useCurve.Select(xyz => BimConvert.ConvertToXYZ(xyz)).ToList());
+                else if(curve.Curve is Arc)
+                    return GeometryLocation.CreateArcLocation(useCurve.Select(xyz => BimConvert.ConvertToXYZ(xyz)).ToList());
             }
 
             return null;

+ 3 - 3
JBIM/RevitToJBim/ComponentParse/ParseVirtualWall.cs

@@ -25,17 +25,17 @@ namespace RevitToJBim.ComponentParse
     {
         public override List<string> FastIndex()
         {
-            return new List<string>() { typeof(SpatialElement).FullName };
+            return new List<string>() { typeof(CurveElement).FullName };
         }
         public override bool Match(ElementWrapper wrapper)
         {
-            return wrapper.RefElement is SpatialElement;
+            return wrapper.RefElement is CurveElement;
         }
 
 
         protected override List<BimId> ParseInner(ElementWrapper wrapper, JBimParseContext context)
         {
-            if (!(wrapper.RefElement is SpatialElement se))
+            if (!(wrapper.RefElement is CurveElement se))
             {
                 return null;
             }

+ 2 - 2
JBIM/RevitToJBim/MbiExport.cs

@@ -50,10 +50,10 @@ namespace RevitToJBim
                 var result = BimJsonUtil.Serializer(mbiDocument);
                 var stream = ZipUtils.ZipString(result,"export.json");
                
-                var resultResponse=HttpUtils.PostFormDataFile("http://192.168.20.225:8080/revit-algorithm/upload-json-zip/upload", stream);
+                //var resultResponse=HttpUtils.PostFormDataFile("http://192.168.20.225:8080/revit-algorithm/upload-json-zip/upload", stream);
                 string fileName = DateTime.Now.ToString("yyyyMMddHHmmss");
                 string path = Path.Combine(@"D:\", $"{fileName}.json");
-                File.WriteAllText(path, resultResponse.ToString());
+                File.WriteAllText(path, result.ToString());
                 System.Diagnostics.Process.Start("notepad.exe", path);
             }
             catch (Exception ex)

+ 1 - 1
JBIM/StartVisionSelector/Program.cs

@@ -11,7 +11,7 @@ namespace StartVisionSelector
         public static void Main(string[] args)
         {
             string path = @"E:\导出测试\testR17.rvt";
-            path = @"E:\导出测试\testR18.rvt";
+            //path = @"E:\导出测试\testR18.rvt";
             //path = @"E:\导出测试\testR16.rvt";
 
             Console.WriteLine("start");