123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- /* ==============================================================================
- * 功能描述:ParseGrid
- * 创 建 者:Garrett
- * 创建日期:2019/6/26 15:16:06
- * ==============================================================================*/
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Autodesk.Revit.DB;
- using JBIM;
- using JBIM.Definition;
- using RevitExport.Export;
- using RevitToJBim.Common;
- using SAGA.RevitUtils.Extends;
- using JGrid=JBIM.Component.Grid;
- namespace RevitToJBim.ComponentParse
- {
- /// <summary>
- /// ParseGrid
- /// </summary>
- [UsableParseAttribute]
- class ParseGrid : ParseBase
- {
- public override List<string> FastIndex()
- {
- return new List<string>(){typeof(Grid).FullName};
- }
- public override bool Match(ElementWrapper wrapper)
- {
- return wrapper.RefElement is Grid;
- }
- protected override List<BimId> ParseInner(ElementWrapper wrapper, JBimParseContext context)
- {
- var refElement = wrapper.RefElement as Grid;
- if (refElement == null)
- {
- return null;
- }
- JGrid jObject = new JGrid();
- //ElementType
- ParseCore.AttachObject(jObject, wrapper);
- //Name,SourceId
- jObject.Name = refElement.Name;
- //Location
- var locations = refElement.GetCurve().Tessellate();
- jObject.Location = GeometryLocation.CreateLineLocation(BimConvert.ConvertToXYZs(locations.ToList()));
- //Id
- context.AddBimObject(jObject);
- return new List<BimId>() { jObject.Id };
- }
- }
- }
|