当前位置:网站首页>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;
}
边栏推荐
- Write in front -- Talking about program development
- OpenGL job coordinate system
- The essence of analog Servlet
- Two methods of calling WCF service by C #
- OpenGL homework - Hello, triangle
- Cannot find module 'xxx' or its corresponding type declaration
- Kaggle-Titanic
- [open source] Net ORM accessing Firebird database
- Redis - basic use (key, string, list, set, Zset, hash, geo, bitmap, hyperloglog, transaction)
- [开源] .Net ORM 访问 Firebird 数据库
猜你喜欢

Add get disabled for RC form

Application practice | the efficiency of the data warehouse system has been comprehensively improved! Data warehouse construction based on Apache Doris in Tongcheng digital Department

反爬通杀神器

Index summary (assault version)

Vs custom template - take the custom class template as an example

用语雀写文章了,功能真心强大!

Record a garbled code during servlet learning

应用实践 | 数仓体系效率全面提升!同程数科基于 Apache Doris 的数据仓库建设

ByteDance Android interview, summary of knowledge points + analysis of interview questions

Two methods of calling WCF service by C #
随机推荐
648. Word replacement
NVR hard disk video recorder is connected to easycvr through the national standard gb28181 protocol. What is the reason why the device channel information is not displayed?
[open source] Net ORM accessing Firebird database
. Net automapper use
建立自己的网站(18)
npm uninstall和rm直接删除的区别
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微服务 Service Fabric 】因证书过期导致Service Fabric集群挂掉(升级无法完成,节点不可用)
三元表达式、各生成式、匿名函数
使用 BlocConsumer 同时构建响应式组件和监听状态
Preparing for the interview and sharing experience
Remember aximp once Use of exe tool
Reinforcement learning - learning notes 9 | multi step TD target
The whole network "chases" Zhong Xuegao
JS number is insufficient, and 0 is added
MIT6.S081-Lab9 FS [2021Fall]
OpenGL job coordinate system
Build your own website (18)
Node:504 error reporting
双塔模型的最强出装,谷歌又开始玩起“老古董”了?