添加项目文件。
This commit is contained in:
68
CDMUtil/ToCDM/CDMBeam.cs
Normal file
68
CDMUtil/ToCDM/CDMBeam.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using Autodesk.Revit.DB;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace CDM.Interop.Revit.CDMComponent
|
||||
{
|
||||
class CDMBeam : CDMComponent
|
||||
{
|
||||
//梁定位线始终在几何中心线,仅适用于水平-矩形-不发生旋转的矩形混凝土梁
|
||||
public CDMBeam(FamilyInstance beam)
|
||||
{
|
||||
self = beam;
|
||||
|
||||
base.SymbolId = beam.GetTypeId();
|
||||
base.EleId = beam.Id;
|
||||
base.LevelId = beam.Host.Id;
|
||||
base.CDMTypeId = HcdmType.CDMBeam;
|
||||
|
||||
m_b = GetPara(beam, "b");
|
||||
m_h = GetPara(beam, "h");
|
||||
if (beam.HasSweptProfile() == true)
|
||||
{
|
||||
Line line = beam.GetSweptProfile().GetDrivingCurve() as Line;
|
||||
//var c = (LocationCurve)beam.Location;
|
||||
//Line line = c.Curve as Line;
|
||||
var rOrigin = line.Origin;
|
||||
var rDirection = line.Direction;
|
||||
base.Xl = rOrigin.X * 0.3048;
|
||||
base.Yw = rOrigin.Y * 0.3048;
|
||||
base.Zh = (rOrigin.Z - m_h.AsDouble() / 2) * 0.3048;
|
||||
base.DegreesWithXAxis = rDirection.AngleTo(new XYZ(1, 0, 0)) * 180 / Math.PI;
|
||||
if (Math.Round(rDirection.Y, 2, MidpointRounding.AwayFromZero) < 0)
|
||||
{
|
||||
DegreesWithXAxis += 180;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("可能存在重叠梁");
|
||||
}
|
||||
//base.Name = beam.Symbol.FamilyName + "@" + beam.Name;
|
||||
|
||||
}
|
||||
private Parameter m_b;
|
||||
private Parameter m_h;
|
||||
|
||||
/// <summary>
|
||||
/// 梁长
|
||||
/// </summary>
|
||||
public double L => self.GetSweptProfile().GetDrivingCurve().Length * 304.8;
|
||||
/// <summary>
|
||||
/// 截面梁宽
|
||||
/// </summary>
|
||||
public string SectionB => m_b.AsValueString();
|
||||
/// <summary>
|
||||
/// 截面梁高
|
||||
/// </summary>
|
||||
public string SectionH => m_h.AsValueString();
|
||||
/// <summary>
|
||||
/// 顶部高程
|
||||
/// </summary>
|
||||
private FamilyInstance self;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user