67 lines
2.1 KiB
C#
67 lines
2.1 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 RevitBeam : RevitComponent
|
|||
|
|
{
|
|||
|
|
public RevitBeam(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.L = Convert.ToDouble(sheet.Cells["H18"].Value);
|
|||
|
|
this.SectionB = Convert.ToDouble(sheet.Cells["H19"].Value);
|
|||
|
|
this.SectionH = Convert.ToDouble(sheet.Cells["H20"].Value);
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// Revit中的定位点
|
|||
|
|
/// </summary>
|
|||
|
|
public XYZ rOrigin => new XYZ(base.Xl, base.Yw, base.Zh + SectionH / 2 / 1000) / 304.8 * 1000;
|
|||
|
|
/// <summary>
|
|||
|
|
/// 方向
|
|||
|
|
/// </summary>
|
|||
|
|
public XYZ rDirection => new XYZ(Math.Cos(Radians), Math.Sin(Radians), 0);
|
|||
|
|
/// <summary>
|
|||
|
|
/// 终点
|
|||
|
|
/// </summary>
|
|||
|
|
public XYZ rEndPoint => rOrigin + rDirection * L / 304.8;
|
|||
|
|
|
|||
|
|
public double Radians => Math.PI / 180 * DegreesWithXAxis;
|
|||
|
|
/// <summary>
|
|||
|
|
/// 梁长
|
|||
|
|
/// </summary>
|
|||
|
|
public double L { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 截面梁宽
|
|||
|
|
/// </summary>
|
|||
|
|
public double SectionB { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 截面梁高
|
|||
|
|
/// </summary>
|
|||
|
|
public double SectionH { get; set; }
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|