using Autodesk.Revit.DB; using OfficeOpenXml; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CDM.Interop.Revit.RevitCompoent { class RevitColumn : RevitComponent { //公制单位 public RevitColumn(string path) { using (ExcelPackage package = new ExcelPackage(new FileStream(path, FileMode.Open))) { ExcelWorksheet sheet = package.Workbook.Worksheets[1]; //ExcelWorksheet sheet = package.Workbook.Worksheets["基本构件"]; this.Name = sheet.Cells["G2"].Value.ToString(); this.Comment = sheet.Cells["G4"].Value.ToString(); base.Xl = Convert.ToDouble(sheet.Cells["H14"].Value); base.Yw = Convert.ToDouble(sheet.Cells["H15"].Value); base.Zh = Convert.ToDouble(sheet.Cells["H16"].Value); base.DegreesWithXAxis = Convert.ToDouble(sheet.Cells["H17"].Value); this.SectionB = Convert.ToDouble(sheet.Cells["H18"].Value); this.SectionH = Convert.ToDouble(sheet.Cells["H19"].Value); this.L = Convert.ToDouble(sheet.Cells["H20"].Value); } } /// /// 柱高 /// public double L { get; private set; } /// /// 柱截面宽 /// public double SectionB { get; private set; } /// /// 柱截面高 /// public double SectionH { get; private set; } /// /// CDM定位点 /// public XYZ cOrigion => new XYZ(Xl, Yw, Zh); public double BaseOffest => Zh * 1000; public double TopOffest => Zh * 1000 + L; /// /// revit中的定位点(英制) /// public XYZ rOrigin => (cOrigion + new XYZ(SectionB / 2 / 1000, 0, 0)) * 1000 / 304.8; } }