当前位置:网站首页>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
- SAR影像质量评估
- Time standard library
- JS number is insufficient, and 0 is added
- Win11时间怎么显示星期几?Win11怎么显示今天周几?
- Tsconfig of typescript TS basics JSON configuration options
- Vs custom template - take the custom class template as an example
- How to turn on win11 game mode? How to turn on game mode in win11
- Reinforcement learning - learning notes 9 | multi step TD target
- Dayu200 experience officer MPPT photovoltaic power generation project dayu200, hi3861, Huawei cloud iotda
猜你喜欢

谈谈制造企业如何制定敏捷的数字化转型策略

客户案例|华律网,通过观测云大幅缩短故障定位时间

Embedded development: how to choose the right RTOS for the project?

vite Unrestricted file system access to

Reinforcement learning - learning notes 9 | multi step TD target

What if the win11u disk does not display? Solution to failure of win11 plug-in USB flash disk
Talk about relational database and serverless

强化学习-学习笔记9 | Multi-Step-TD-Target

三元表达式、各生成式、匿名函数

Time standard library
随机推荐
Ant destination multiple selection
OpenGL jobs - shaders
Use json Stringify() to realize deep copy, be careful, there may be a huge hole
Why can't win11 display seconds? How to solve the problem that win11 time does not display seconds?
Get the week start time and week end time of the current date
SAR影像质量评估
Use blocconsumer to build responsive components and monitor status at the same time
变量与常量
Jerry's key to initiate pairing [chapter]
Paint basic graphics with custompaint
How polardb-x does distributed database hotspot analysis
An in-depth understanding of fp/fn/precision/recall
Win11时间怎么显示星期几?Win11怎么显示今天周几?
Latest Android advanced interview questions summary, Android interview questions and answers
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)
23. Merge K ascending linked lists -c language
Kaggle-Titanic
What is the difference between the three values of null Nan undefined in JS
强化学习-学习笔记9 | Multi-Step-TD-Target