ParseVirtualWall.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*-------------------------------------------------------------------------
  2. * 功能描述:ParseVirtualWall
  3. * 作者:xulisong
  4. * 创建时间: 2019/6/25 17:54:31
  5. * 版本号:v1.0
  6. * -------------------------------------------------------------------------*/
  7. using Autodesk.Revit.DB;
  8. using JBIM;
  9. using JBIM.Component;
  10. using JBIM.Definition;
  11. using RevitExport.Export;
  12. using RevitToJBim.Common;
  13. using SAGA.RevitUtils.Extends;
  14. using System;
  15. using System.Collections.Generic;
  16. using System.Linq;
  17. using System.Text;
  18. using System.Threading.Tasks;
  19. namespace RevitToJBim.ComponentParse
  20. {
  21. [UsableParse]
  22. public class ParseVirtualWall : ParseBase
  23. {
  24. public override List<string> FastIndex()
  25. {
  26. return new List<string>() { typeof(CurveElement).FullName };
  27. }
  28. public override bool Match(ElementWrapper wrapper)
  29. {
  30. return wrapper.RefElement is CurveElement;
  31. }
  32. protected override List<BimId> ParseInner(ElementWrapper wrapper, JBimParseContext context)
  33. {
  34. if (!(wrapper.RefElement is CurveElement se))
  35. {
  36. return null;
  37. }
  38. VirtualWall jObject = new VirtualWall();
  39. ParseCore.AttachObject(jObject, wrapper);
  40. context.AddBimObject(jObject);
  41. //jObject.Location = ParseCore.GetLocation(se.Location);
  42. var locations = new List<JBIM.Definition.XYZ>();
  43. var useCurve = (se.Location as LocationCurve).Curve;
  44. locations.Add(BimConvert.ConvertToXYZ(useCurve.StartPoint()));
  45. locations.Add(BimConvert.ConvertToXYZ(useCurve.EndPoint()));
  46. jObject.Location = GeometryLocation.CreateLineLocation(locations);
  47. Polygon outLine = new Polygon(locations);
  48. jObject.OutLine.Add(outLine);
  49. return new List<BimId>() { jObject.Id };
  50. }
  51. }
  52. }