• 大小: 51MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2022-05-25
  • 语言: C/C++
  • 标签: IFC  BIM实例  

资源简介

IFC文件解析,有C# C++ VB.Net实例

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using IfcEngine;

namespace ifceditor
{
    public partial class Form1 : Form
    {
        private Int32 model;
        private Entity[] myEntities;
        private List myInstances = new List();

        public Form1()
        {
            model = 0;
            InitializeComponent();
            textBoxFileName.Text = AppDomain.CurrentDomain.baseDirectory + “myFile.ifc“;
        }

        private void button1_Click(object sender EventArgs e)
        {
            string fileName = textBoxFileName.Text;

            if (model != 0)
            {
                IfcEngine.x86.sdaiCloseModel(model);
            }

            model = IfcEngine.x86.sdaiOpenModelBN(0 fileName “IFC2X3_TC1.exp“);
            if (model != 0)
            {
                IntPtr outputValue = IntPtr.Zero;
                IfcEngine.x86.GetSPFFHeaderItem(model 9 0 IfcEngine.x86.sdaiSTRING out outputValue);
                string s = Marshal.PtrToStringAnsi(outputValue);
                if (s.Contains(“IFC2“) == false)
                {
                    IfcEngine.x86.sdaiCloseModel(model);
                    model = 0;
                    if (s.Contains(“IFC4“) == true)
                    {
                        model = IfcEngine.x86.sdaiOpenModelBN(0 fileName “IFC4.exp“);
                    }
                }
            }

            treeViewLP.Nodes.Clear();
            if (model != 0)
            {
                Int32 cnt = IfcEngine.x86.engiGetEntityCount(model)
                      i = 0;

                myEntities = new Entity[cnt];
                while (i < cnt) {
                    myEntities[i] = new Entity(IfcEngine.x86.engiGetEntityElement(model i));
                    myEntities[i].attributeCnt = IfcEngine.x86.engiGetEntityNoArguments(myEntities[i].ifcEntity);
                    myEntities[i].instanceCnt = IfcEngine.x86.sdaiGetMemberCount(IfcEngine.x86.sdaiGetEntityExtent(model myEntities[i].ifcEntity));
                    i++;
                }

                while (i != 0) {
                    i--;
                    Int32 ifcParentEntity = IfcEngine.x86.engiGetEntityParent(myEntities[i].ifcEntity);
                    if (ifcParentEntity != 0)
                    {
                        Int32 j = 0;
                        while (j < cnt)
                        {
                            if (ifcParentEntity == myEntities[j].ifcEntity)
                            {
                                if (myEntities[j].child != null)
                                {
                                    myEntities[i].next = myEntities[j].child;
                                }
                           

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2015-10-09 21:17  IFCEngineDLLv1.04 (build 4000+)\bin\
     目录           0  2015-10-11 09:36  IFCEngineDLLv1.04 (build 4000+)\bin\32bit\
     文件      117248  2015-10-09 21:46  IFCEngineDLLv1.04 (build 4000+)\bin\32bit\chkDisk4Ifc-32bit.exe
     文件     1998168  2014-03-26 02:03  IFCEngineDLLv1.04 (build 4000+)\bin\32bit\d3dx9_43.dll
     文件       12419  2015-08-10 10:08  IFCEngineDLLv1.04 (build 4000+)\bin\32bit\example.ifc
     文件      549759  2015-08-10 10:08  IFCEngineDLLv1.04 (build 4000+)\bin\32bit\example.ifcxml
     文件     1764864  2015-10-09 21:47  IFCEngineDLLv1.04 (build 4000+)\bin\32bit\HelloHouse-C++_32bit.exe
     文件      132608  2015-10-09 22:01  IFCEngineDLLv1.04 (build 4000+)\bin\32bit\HelloWall-32bit.exe
     文件      138240  2015-10-09 22:01  IFCEngineDLLv1.04 (build 4000+)\bin\32bit\HelloWall-32bit-Unicode.exe
     文件       87552  2015-10-11 09:15  IFCEngineDLLv1.04 (build 4000+)\bin\32bit\HelloWall-C#_32bit.exe
     文件      266688  2014-03-26 02:03  IFCEngineDLLv1.04 (build 4000+)\bin\32bit\IFC2X3_TC1.exp
     文件        3624  2014-07-12 12:09  IFCEngineDLLv1.04 (build 4000+)\bin\32bit\IFC2X3-Settings.xml
     文件      387456  2014-03-26 02:03  IFCEngineDLLv1.04 (build 4000+)\bin\32bit\IFC4.exp
     文件        6630  2014-05-29 14:09  IFCEngineDLLv1.04 (build 4000+)\bin\32bit\IFC4-Settings.xml
     文件       29184  2015-10-11 08:00  IFCEngineDLLv1.04 (build 4000+)\bin\32bit\IfcEditor-C#_32bit.exe
     文件      124416  2015-10-09 21:53  IFCEngineDLLv1.04 (build 4000+)\bin\32bit\ifceditor-C++_Unicode_32bit.exe
     文件      796160  2015-10-09 14:15  IFCEngineDLLv1.04 (build 4000+)\bin\32bit\ifcengine.dll
     文件       66048  2015-10-11 09:27  IFCEngineDLLv1.04 (build 4000+)\bin\32bit\IFCViewer-C#_32bit.exe
     文件      118272  2015-10-09 21:39  IFCEngineDLLv1.04 (build 4000+)\bin\32bit\ifcviewer-C++_Unicode_32bit.exe
     文件       62464  2015-10-11 07:56  IFCEngineDLLv1.04 (build 4000+)\bin\32bit\IFCViewer-VB.NET_32bit.exe
     文件        4769  2014-03-28 21:55  IFCEngineDLLv1.04 (build 4000+)\bin\32bit\input.ifc
     文件     4342600  2014-03-26 02:03  IFCEngineDLLv1.04 (build 4000+)\bin\32bit\mfc100.dll
     文件      768848  2014-03-26 02:03  IFCEngineDLLv1.04 (build 4000+)\bin\32bit\msvcr100.dll
     文件       36963  2015-03-13 18:41  IFCEngineDLLv1.04 (build 4000+)\bin\32bit\myFile.ifc
     文件       86016  2015-10-09 21:38  IFCEngineDLLv1.04 (build 4000+)\bin\32bit\simpleOpenIFCFile_32bit.exe
     目录           0  2015-10-11 09:35  IFCEngineDLLv1.04 (build 4000+)\bin\64bit\
     文件      125952  2015-10-09 21:46  IFCEngineDLLv1.04 (build 4000+)\bin\64bit\chkDisk4Ifc-64bit.exe
     文件     2401112  2014-03-26 02:03  IFCEngineDLLv1.04 (build 4000+)\bin\64bit\D3DX9_43.dll
     文件       12419  2015-08-10 10:11  IFCEngineDLLv1.04 (build 4000+)\bin\64bit\example.ifc
     文件       58967  2015-08-10 10:11  IFCEngineDLLv1.04 (build 4000+)\bin\64bit\example.ifcxml
     文件      151040  2015-10-09 22:01  IFCEngineDLLv1.04 (build 4000+)\bin\64bit\HelloWall-64bit.exe
............此处省略1135个文件信息

评论

共有 条评论

相关资源