当前位置:网站首页>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;
}
边栏推荐
- It's worth seeing. Interview sites and interview skills
- Redis - basic use (key, string, list, set, Zset, hash, geo, bitmap, hyperloglog, transaction)
- 强化学习-学习笔记9 | Multi-Step-TD-Target
- Write in front -- Talking about program development
- MIT6.S081-Lab9 FS [2021Fall]
- ByteDance Android interview, summary of knowledge points + analysis of interview questions
- . Net automapper use
- 强化学习-学习笔记9 | Multi-Step-TD-Target
- How to make agile digital transformation strategy for manufacturing enterprises
- VTOL in Px4_ att_ Control source code analysis [supplement]
猜你喜欢
反爬通杀神器
Crawler (17) - Interview (2) | crawler interview question bank
vite Unrestricted file system access to
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?
Ternary expressions, generative expressions, anonymous functions
[开源] .Net ORM 访问 Firebird 数据库
【Azure微服务 Service Fabric 】因证书过期导致Service Fabric集群挂掉(升级无法完成,节点不可用)
建立自己的网站(18)
Overseas agent recommendation
Px4 autonomous flight
随机推荐
EasyCVR配置中心录像计划页面调整分辨率时的显示优化
The whole network "chases" Zhong Xuegao
The essence of analog Servlet
Jerry's about TWS pairing mode configuration [chapter]
Two methods of calling WCF service by C #
谈谈制造企业如何制定敏捷的数字化转型策略
Lingyun going to sea | saihe & Huawei cloud: jointly help the sustainable development of cross-border e-commerce industry
Matplotlib快速入门
【Azure微服务 Service Fabric 】如何转移Service Fabric集群中的种子节点(Seed Node)
vite Unrestricted file system access to
如何实现横版游戏中角色的移动控制
Get the exact offset of the element
Open source OA development platform: contract management user manual
海外代理推荐
Jerry's configuration of TWS cross pairing [article]
【Azure微服务 Service Fabric 】因证书过期导致Service Fabric集群挂掉(升级无法完成,节点不可用)
ByteDance Android interview, summary of knowledge points + analysis of interview questions
Leetcode SQL first day
The free styling service of Dyson's official direct store is now open for appointment. Pioneer Technology interprets the styling concept of hair care and helps consumers unlock diversified and shiny s
[azure microservice service fabric] the service fabric cluster hangs up because the certificate expires (the upgrade cannot be completed, and the node is unavailable)