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 RevitFloor : RevitComponent { public RevitFloor(string path) { using (ExcelPackage package = new ExcelPackage(new FileStream(path, FileMode.Open))) { //ExcelWorksheet sheet = package.Workbook.Worksheets["基本构件"]; ExcelWorksheet sheet = package.Workbook.Worksheets[1]; 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.Length = Convert.ToDouble(sheet.Cells["H18"].Value); this.Width = Convert.ToDouble(sheet.Cells["H19"].Value); this.Thickness = Convert.ToDouble(sheet.Cells["H20"].Value); ExcelWorksheet sheet1 = package.Workbook.Worksheets[2]; //ExcelWorksheet sheet1 = package.Workbook.Worksheets["方形洞口"]; Openings = new List() { new RevitOpening() { Xl=Convert.ToDouble(sheet1.Cells["H7"].Value), Yw=Convert.ToDouble(sheet1.Cells["H8"].Value), Zh=Zh, Length=Convert.ToDouble(sheet1.Cells["H9"].Value), Width=Convert.ToDouble(sheet1.Cells["H10"].Value) }, new RevitOpening() { Xl=Convert.ToDouble(sheet1.Cells["H11"].Value), Yw=Convert.ToDouble(sheet1.Cells["H12"].Value), Zh=Zh, Length=Convert.ToDouble(sheet1.Cells["H13"].Value), Width=Convert.ToDouble(sheet1.Cells["H14"].Value) } }; } } /// /// 板厚 /// public double Thickness { get; internal set; } public XYZ cOrigin => new XYZ(Xl, Yw, Zh); public XYZ rOrigin => new XYZ(Xl, Yw, Zh) * 1000 / 304.8; public double Offest => Zh * 1000; /// /// 板长 /// public double Length { get; set; } /// /// 板宽 /// public double Width { get; set; } public List Openings { get; set; } } }