63 lines
2.0 KiB
C#
63 lines
2.0 KiB
C#
|
|
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);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 柱高
|
|||
|
|
/// </summary>
|
|||
|
|
public double L { get; private set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 柱截面宽
|
|||
|
|
/// </summary>
|
|||
|
|
public double SectionB { get; private set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 柱截面高
|
|||
|
|
/// </summary>
|
|||
|
|
public double SectionH { get; private set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// CDM定位点
|
|||
|
|
/// </summary>
|
|||
|
|
public XYZ cOrigion => new XYZ(Xl, Yw, Zh);
|
|||
|
|
|
|||
|
|
public double BaseOffest => Zh * 1000;
|
|||
|
|
public double TopOffest => Zh * 1000 + L;
|
|||
|
|
/// <summary>
|
|||
|
|
/// revit中的定位点(英制)
|
|||
|
|
/// </summary>
|
|||
|
|
public XYZ rOrigin => (cOrigion + new XYZ(SectionB / 2 / 1000, 0, 0)) * 1000 / 304.8;
|
|||
|
|
}
|
|||
|
|
}
|