EaBIM一直以来积极响应国家“十二五”推进建筑业信息化的号召,对建筑领域的信息技术开展深入技术交流和探讨!致力于打造“BIM-建筑师-生态技术”三位一体综合资源交流共享平台,希望为BIM与可持续设计理念及技术的普及做出微小的贡献!!!

EaBIM

 找回密码
 注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

搜索
查看: 511|回复: 1
打印 上一主题 下一主题

进入束几何访问Joined Beam Geometry Access

[复制链接]

1514

主题

7465

帖子

1万

积分

admin

Rank: 10Rank: 10Rank: 10Rank: 10Rank: 10Rank: 10Rank: 10Rank: 10Rank: 10Rank: 10

积分
12404

社区QQ达人

跳转到指定楼层
楼主
发表于 2014-1-9 12:41:00 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

We have already discussed situations where an element's geometry needs to be accessed in various ways depending on the circumstances, such as the retrieval ofunmodified element geometry or the different approaches required to accesscolumn and stair geometry, depending on whether the element has its own solid definition or is reusing the solid defined by the symbol it references. Here is a similar solution to obtain the geometry of a beam joined with columns from my colleagues Katsuaki Takamizawa and Harry Mattison:
Question: The NewRebar SDK sample works well with a standalone beam and can access the edges of the beam geometry using the following sequence of calls, illustrated using RevitLookup:

However, it rejects a beam joined with columns because it cannot access its edges. In this case, the edges can be obtained differently like this:

Should the access to edges (and geometry in general) be implemented differently depending on whether a beam is joined or not? We need to find the beam coordinates to add rebars to it.
Answer: I am unable to reproduce the problem you describe.
The following code used with a specific file finds the same number of edges for both the joined and non-joined beams.
[Transaction( TransactionMode.Automatic )][Regeneration( RegenerationOption.Manual )]public class CmdGetColumnGeometry : IExternalCommand{  public Result Execute(     ExternalCommandData commandData,     ref string message,     ElementSet elements )  {    Document doc = commandData.Application      .ActiveUIDocument.Document;     Options options = new Options();     options.ComputeReferences = true;     GeometryElement geomElement = doc      .Selection.PickObject( ObjectType.Element )      .Element.get_Geometry( options );     int edgeCount = 0;    foreach( GeometryObject geomObj       in geomElement.Objects )    {      if( geomObj is GeometryInstance )      {        GeometryInstance inst = geomObj           as GeometryInstance;         if( inst != null )        {          GeometryElement geomElem             = inst.GetSymbolGeometry();           foreach( Object o in geomElem.Objects )          {            Solid solid = o as Solid;            if( solid != null )            {              foreach( Face face in solid.Faces )              {                foreach( EdgeArray edgeArray                   in face.EdgeLoops )                {                  edgeCount += edgeArray.Size;                }              }            }          }        }      }    }    TaskDialog.Show( "Revit", "Edges: "       + edgeCount.ToString() );     return Result.Succeeded;  }}
Response: The problem seems to be specific to concrete beams. The code above did not find the geometry objects of a concrete beam joined with columns.
Answer: You are right in that, depending on the specific element and condition, the GeometryElement may contain the desired geometry as a Solid or GeometryInstance. The following code handles both of these cases, as described in Chapter 20 of the Developer Guide:
  Document doc = commandData.Application    .ActiveUIDocument.Document;   Options options = new Options();  options.ComputeReferences = true;   GeometryElement geomElement = doc.Selection    .PickObject( ObjectType.Element )    .Element.get_Geometry( options );   int ctr = 0;  foreach( GeometryObject geomObj     in geomElement.Objects )  {    if( geomObj is Solid )    {      FaceArray faces = ( ( Solid ) geomObj ).Faces;      ctr += faces.Size;    }     if( geomObj is GeometryInstance )    {      GeometryInstance inst = geomObj         as GeometryInstance;       if( inst != null )      {        GeometryElement geomElem           = inst.GetSymbolGeometry();         foreach( Object o in geomElem.Objects )        {          Solid solid = o as Solid;          if( solid != null )          {            ctr += solid.Faces.Size;          }        }      }    }  }  TaskDialog.Show( "Revit", "Faces: " + ctr );}
Response: Thank you, your code above and also the code in Chapter 20.5 of the developer guide worked for the concrete beam.

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
收藏收藏 转播转播 分享分享 分享淘帖 支持支持 反对反对
工作时间:工作日的9:00-12:00/13:30-18:00,节假日不在线,请勿留言

30

主题

905

帖子

1486

积分

BIM经理

Rank: 6Rank: 6Rank: 6Rank: 6Rank: 6Rank: 6

积分
1486
2F
发表于 2014-2-20 14:43:21 | 只看该作者
路过!!! 不发表意见……
*滑块验证:
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|EaBIM网 ( 苏ICP备2020058923号-1  苏公网安备32011502011255号

GMT+8, 2024-11-16 18:53

Powered by Discuz! X3.2 Licensed

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表