Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
Bentley 中国优先社区
  • Welcome to Bentley Communities
  • Bentley's Communities
  • Bentley 中国优先社区
  • Cancel
Bentley 中国优先社区
技术资料库 03-imodel读取几何数据
    • Sign In
    Bentley 中国优先社区 requires membership for participation - click to join
    • -Bentley 中文技术资料库
      • +AutoPIPE
      • +Bentley Civil
      • +Bentley Navigator
      • +Bentley Substation
      • +BRCM
      • +BridgeMasterModeler/OpenBridgeModeler
      • -i-model / DgnDb
        • DgnDb i-model Importer
        • DgnDb介绍
        • i-model 1.0/1.5 SDK
        • i-model常见问题解答
        • 为何一个DGN文件发布成iModel2.0后体积增大了快100倍?
        • 为何我用Mstn V8iSS4发布的.imodel无法用Navigator CE Update2打开
        • 发布带有图片的i-model
        • 哪里能找到Revit转i-model的插件?
        • 如何利用iTwin平台发布.imodel格式的文件?
        • 如何简单判断i-model的版本
        • 如何运行github上的simple-viewer-app例子代码
        • 将带有文件链接的dgn发布成imodel
        • 我只有MicroStation V8iSS3,如何将DGN发布成移动端用的imodel?
        • -新版imodel
          • 01-imodel开发文档
          • 02-imodel培训视频
          • 03-imodel读取几何数据
          • 04-imodel获取schemas
          • 05-imodel获取instances
          • 06-imodel格式转换
          • 07-imodel关键技术之TT
          • 08-如何对cell元素进行嵌套遍历
          • 09-如何给元素加links信息
          • 10-如何创建几何元素
          • 11-如何遍历元素的tag信息
          • 12-如何获取imodel文件的odbc连接
          • 13 - 如何通过视图访问imodel数据
        • 查询i-model的来源
        • 给一个DGN中元素添加EC属性
      • +LumenRT/ContextCapture
      • +MicroStation
      • +MOSES
      • +OpenBuildings Designer
      • +OpenFlows
      • +OpenPlant
      • +OpenPlant Electrical CCK
      • Plaxis 地质分析
      • +ProjectWise
      • +ProStructures
      • +SACS
      • +STAAD.Pro
      • +SYNCHRO Pro
      • +其 它
      • +建筑设计之思考(赵大师专作)
      • +桥梁大师<BridgeMaster>
      • +现浇箱梁
      • +软件激活及授权
    • +iTwin 数字孪生平台
    • Bentley二次开发资料库
    • +常见问题汇总
    • Bentley-Learn 官方教学平台-使用方法
    • +中国优先社区使用指南
    • +Bentley学习资料库
    • +Bentley用户成功活动精选
    • +服务合作伙伴计划

     
     Questions about this article, topic, or product? Click here. 

    03-imodel读取几何数据

    通过imodel类的Elements属性,我们可以很容易的遍历文件中的几何元素属性,示例代码如下:

    foreach (IModelElement element in imodel.Elements)
    {
    strInfo = "";
    strInfo += "\n\n\n";
    strInfo += "id = ";
    strInfo += element.Element.ElementId.ToString();

    //元素几何类型
    string strGeo = String.Format("{0}", element.Geometry.GetType());
    strInfo += "\n几何类型=";
    strInfo += strGeo;

    ////元素instance类
    strInfo += "\ninstance类型=";
    foreach (Class c in element.Classes)
    {
    strInfo += c.Name;
    strInfo += "\n";
    }

    //元素属性信息
    foreach (Dynamics o in element.Objects) //由element到instance
    {
    strInfo += "\nDynamicsName = ";
    strInfo += o.ToString();

    foreach (Property p in o.Class.Properties) //如果已知property名字:dynamic dydata = o; 然后通过dynata.property名字访问
    {
    if (!o.ECInstance[p.Name].IsNull)
    {
    strInfo += "\n";
    strInfo += p.Name;
    strInfo += "=";
    strInfo += o.ECInstance[p.Name].NativeValue;
    }
    }
    }

           //如果有子元素,需要递归调用foreach (IModelElement e in ele.Children)
    }

    • imodel
    • Share
    • History
    • More
    • Cancel
    • lijun.ma Created by lijun.ma
    • When: Sat, Jan 31 2015 3:21 AM
    • lijun.ma Last revision by lijun.ma
    • When: Sun, Feb 1 2015 9:43 PM
    • Revisions: 2
    • Comments: 3
    • Sign in to reply
    Parents
    • xiaoxiao ai
      Offline xiaoxiao ai over 6 years ago

      请问IModelElement element.LevelName和imodel中的图层信息是对应的吗?

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • More
      • Cancel
    Comment
    • xiaoxiao ai
      Offline xiaoxiao ai over 6 years ago

      请问IModelElement element.LevelName和imodel中的图层信息是对应的吗?

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • More
      • Cancel
    Children
    No Data
    Recommended
    Related
    Communities
    • Home
    • Getting Started
    • Community Central
    • Products
    • Support
    • Secure File Upload
    • Feedback
    Support and Services
    • Home
    • Product Support
    • Downloads
    • Subscription Services Portal
    Training and Learning
    • Home
    • About Bentley Institute
    • My Learning History
    • Reference Books
    Social Media
    •    LinkedIn
    •    Facebook
    •    Twitter
    •    YouTube
    •    RSS Feed
    •    Email

    © 2023 Bentley Systems, Incorporated  |  Contact Us  |  Privacy |  Terms of Use  |  Cookies