当前位置:网站首页>Revit secondary development - get the thickness / length / height of the beam
Revit secondary development - get the thickness / length / height of the beam
2022-07-07 22:22:00 【Hey, hey, hey, hey, hey】
Thickness of beam / length / Height cannot be obtained directly , It can be calculated according to geometric information .
/// <summary>
/// Get beam thickness / wide / length
/// </summary>
/// <param name="inst"></param>
/// <returns></returns>
public double GetBeamThick(FamilyInstance inst)
{
double dThick = 0;
Line loc = (inst.Location as LocationCurve).Curve as Line;
XYZ dir = loc.Direction;
Options opts = new Options();
GeometryElement gelem = inst.get_Geometry(opts);
foreach (GeometryObject gobj in gelem)
{
if (gobj is GeometryInstance)
{
GeometryInstance gins = gobj as GeometryInstance;
GeometryElement ge = gins.GetInstanceGeometry();
foreach (GeometryObject go in ge)
{
Solid solid = go as Solid;
if (solid != null && solid.Volume > 0)
{
foreach (Face face in solid.Faces)
{
XYZ faceDir = face.ComputeNormal(new UV());
if (faceDir.IsAlmostEqualTo(dir) || faceDir.IsAlmostEqualTo(-dir))
{
BoundingBoxUV uvBox = face.GetBoundingBox();
XYZ min = face.Evaluate(uvBox.Min);
XYZ max = face.Evaluate(uvBox.Max);
double height = Math.Abs(max.Z - min.Z);
double length = max.DistanceTo(min);
dThick = Math.Sqrt(length*length-height*height );
break;
}
}
}
}
}
else if (gobj is Solid)
{
Solid solid = gobj as Solid;
if (solid != null && solid.Volume > 0)
{
foreach (Face face in solid.Faces)
{
XYZ faceDir = face.ComputeNormal(new UV());
if (faceDir.IsAlmostEqualTo(dir) || faceDir.IsAlmostEqualTo(-dir))
{
BoundingBoxUV uvBox = face.GetBoundingBox();
XYZ min = face.Evaluate(uvBox.Min);
XYZ max = face.Evaluate(uvBox.Max);
double height = Math.Abs(max.Z - min.Z);
double length = max.DistanceTo(min);
dThick = Math.Sqrt(length*length-height*height);
break;
}
}
}
}
}
return dThick * 304.8;
}
边栏推荐
- What if the win11u disk does not display? Solution to failure of win11 plug-in USB flash disk
- 强化学习-学习笔记9 | Multi-Step-TD-Target
- DBSync新增对MongoDB、ES的支持
- Antd date component appears in English
- 【Azure微服务 Service Fabric 】如何转移Service Fabric集群中的种子节点(Seed Node)
- Tsconfig of typescript TS basics JSON configuration options
- How polardb-x does distributed database hotspot analysis
- How to choose the appropriate automated testing tools?
- Main functions of OS, Sys and random Standard Libraries
- Dayu200 experience officer MPPT photovoltaic power generation project dayu200, hi3861, Huawei cloud iotda
猜你喜欢
L'enregistreur de disque dur NVR est connecté à easycvr par le Protocole GB 28181. Quelle est la raison pour laquelle l'information sur le canal de l'appareil n'est pas affichée?
反爬通杀神器
Blender exchange group, welcome to the water group ~
Two kinds of updates lost and Solutions
大数据开源项目,一站式全自动化全生命周期运维管家ChengYing(承影)走向何方?
The strongest installation of the twin tower model, Google is playing "antique" again?
Redis - basic use (key, string, list, set, Zset, hash, geo, bitmap, hyperloglog, transaction)
Kirin Xin'an operating system derivative solution | storage multipath management system, effectively improving the reliability of data transmission
【JDBC Part 1】概述、获取连接、CRUD
Build your own website (18)
随机推荐
Two methods of calling WCF service by C #
Get the week start time and week end time of the current date
Ant destination multiple selection
The whole network "chases" Zhong Xuegao
Anti climbing killer
反爬通杀神器
Leetcode SQL first day
UWA问答精选
Display optimization when the resolution of easycvr configuration center video recording plan page is adjusted
Typescript TS basic knowledge type declaration
Reinforcement learning - learning notes 9 | multi step TD target
NVR硬盤錄像機通過國標GB28181協議接入EasyCVR,設備通道信息不顯示是什麼原因?
PKPM 2020 software installation package download and installation tutorial
Use json Stringify() to realize deep copy, be careful, there may be a huge hole
How to close eslint related rules
Why can't win11 display seconds? How to solve the problem that win11 time does not display seconds?
Which financial products will yield high returns in 2022?
Kaggle-Titanic
Tcp/ip protocol stack
【Azure微服务 Service Fabric 】在SF节点中开启Performance Monitor及设置抓取进程的方式