当前位置:网站首页>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;
}
边栏推荐
- 海外代理推荐
- Blender exchange group, welcome to the water group ~
- 【Azure微服务 Service Fabric 】在SF节点中开启Performance Monitor及设置抓取进程的方式
- Main functions of OS, Sys and random Standard Libraries
- 2022 how to evaluate and select low code development platforms?
- Interview question 01.02 Determine whether it is character rearrangement - auxiliary array algorithm
- Codemail auto collation code of visual studio plug-in
- null == undefined
- Px4 autonomous flight
- How does win11 time display the day of the week? How does win11 display the day of the week today?
猜你喜欢

反爬通杀神器

Record a garbled code during servlet learning

强化学习-学习笔记9 | Multi-Step-TD-Target
![[azure microservice service fabric] the service fabric cluster hangs up because the certificate expires (the upgrade cannot be completed, and the node is unavailable)](/img/35/1bb21c100980eb1075dbbcb922e181.png)
[azure microservice service fabric] the service fabric cluster hangs up because the certificate expires (the upgrade cannot be completed, and the node is unavailable)

Win11如何解禁键盘?Win11解禁键盘的方法

Two methods of calling WCF service by C #

大数据开源项目,一站式全自动化全生命周期运维管家ChengYing(承影)走向何方?

Where is the big data open source project, one-stop fully automated full life cycle operation and maintenance steward Chengying (background)?

Index summary (assault version)
![[JDBC Part 1] overview, get connection, CRUD](/img/53/d79f29f102c81c9b0b7b439c78603b.png)
[JDBC Part 1] overview, get connection, CRUD
随机推荐
100million single men and women "online dating", supporting 13billion IPOs
Use partial derivatives to display normals in unity
使用 BlocConsumer 同时构建响应式组件和监听状态
Open source OA development platform: contract management user manual
Interview question 01.02 Determine whether it is character rearrangement - auxiliary array algorithm
Get the week start time and week end time of the current date
Cannot find module 'xxx' or its corresponding type declaration
Crawler (17) - Interview (2) | crawler interview question bank
如何选择合适的自动化测试工具?
Relationship between URL and URI
Blender exchange group, welcome to the water group ~
The cyberspace office announced the measures for data exit security assessment, which will come into force on September 1
Jerry's initiation of ear pairing, reconnection, and opening of discoverable and connectable cyclic functions [chapter]
Talk about relational database and serverless
Overseas agent recommendation
How to quickly check whether the opening area ratio of steel mesh conforms to ipc7525
Use json Stringify() to realize deep copy, be careful, there may be a huge hole
Remember aximp once Use of exe tool
How polardb-x does distributed database hotspot analysis
Google SEO external chain backlinks research tool recommendation