123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- /*-------------------------------------------------------------------------
- * 功能描述:ParseVirtualWall
- * 作者:xulisong
- * 创建时间: 2019/6/25 17:54:31
- * 版本号:v1.0
- * -------------------------------------------------------------------------*/
- using Autodesk.Revit.DB;
- using JBIM;
- using JBIM.Component;
- using JBIM.Definition;
- using RevitExport.Export;
- using RevitToJBim.Common;
- using SAGA.RevitUtils.Extends;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace RevitToJBim.ComponentParse
- {
- [UsableParse]
- public class ParseVirtualWall : ParseBase
- {
- public override List<string> FastIndex()
- {
- return new List<string>() { typeof(SpatialElement).FullName };
- }
- public override bool Match(ElementWrapper wrapper)
- {
- return wrapper.RefElement is SpatialElement;
- }
- protected override List<BimId> ParseInner(ElementWrapper wrapper, JBimParseContext context)
- {
- if (!(wrapper.RefElement is SpatialElement se))
- {
- return null;
- }
- VirtualWall jObject = new VirtualWall();
- ParseCore.AttachObject(jObject, wrapper);
- context.AddBimObject(jObject);
- //jObject.Location = ParseCore.GetLocation(se.Location);
- var locations = new List<JBIM.Definition.XYZ>();
- var useCurve = (se.Location as LocationCurve).Curve;
- locations.Add(BimConvert.ConvertToXYZ(useCurve.StartPoint()));
- locations.Add(BimConvert.ConvertToXYZ(useCurve.EndPoint()));
- jObject.Location = GeometryLocation.CreateLineLocation(locations);
- Polygon outLine = new Polygon(locations);
- jObject.OutLine.Add(outLine);
- return new List<BimId>() { jObject.Id };
- }
- }
- }
|