目录

STEP 简要介绍

STEP简要介绍:自动化系统和集成-产品数据表示和交换。代表“产品模型数据交换标准”。可以代表计算机辅助设计(CAD)和相关信息中得3D对象。STEP 可适用于在CAD,计算机辅助制造,计算机辅助工程,产品数据管理/企业数据建模和其他系统之间交换数据。2014年12月,ISO发布了第一版新的主要应用协议AP242基于模型的3d工程,它们以向上兼容的方式组合和替换了以前的以下AP:

  • AP 201,明确的绘图。与产品相关的简单2D绘图几何。没有关联,没有组装层次。
  • AP 202,联想绘图。有关联的2D / 3D绘图,但没有产品结构。
  • AP 203,机械零件和组件的配置控制3D设计
  • AP 204,使用边界表示的机械设计
  • AP 214,汽车机械设计过程的核心数据

此外AP242版本1包含扩展和重大更新

  • 几何尺寸和公差
  • 运动学
  • 镶嵌

xBIM 使用的是最新的STEP ISO 10303-21 简称 STEP21.

EXPRESS 简要介绍

EXPRESS 是一个标准的数据建模语言和产品数据。一个简单EXPRESS 数据模型如图1所示

图 1 EXPRESS-G图

EXPRESS 代码如下所示:

  1. SCHEMA家族;
  2.  
  3. ENTITY
  4. ONEOF(男,女))的抽象超模;
  5. 名字:STRING;
  6. 母亲:可选女性;
  7. 父亲:可选男性;
  8. END_ENTITY;
  9.  
  10. ENTITY女性
  11. (人)的子类型;
  12. END_ENTITY;
  13.  
  14. ENTITY男性
  15. Person)的SUBTYPE;
  16. END_ENTITY;
  17.  
  18. END_SCHEMA;

它包含一个超类型实体与两个亚型男性女性。由于Person被声明为ABSTRACT(抽象),因此只有(ONEOF)亚型男性女性可以存在。每个人的事件都有一个强制性的名字属性,并且可以选择属性母亲父亲。对于某些实体类型的属性,有一种固定的阅读方式:

  • 一个女人可以扮演一个母亲的角色
  • 一个男人可以扮演一个父亲的角色

xBIM Tookit 实现100%的 IFC2 x 3和 IFC4模式,并且支持所有的物理表示。STEP21 实在EXPRESS定义的数据的物理表示。这是IFC的原始定义。非常适合产品建模。从这个简单的例子可能不是太明显。但EXPRESS比任何XSD更有意识。更容易阅读。EXPRESS定义如下:

  1. ENTITY IfcAppliedValue
  2. SUPERTYPE OF (ONEOF
  3. (IfcCostValue));
  4. Name : OPTIONAL IfcLabel;
  5. Description : OPTIONAL IfcText;
  6. AppliedValue : OPTIONAL IfcAppliedValueSelect;
  7. UnitBasis : OPTIONAL IfcMeasureWithUnit;
  8. ApplicableDate : OPTIONAL IfcDate;
  9. FixedUntilDate : OPTIONAL IfcDate;
  10. Category : OPTIONAL IfcLabel;
  11. Condition : OPTIONAL IfcLabel;
  12. ArithmeticOperator : OPTIONAL IfcArithmeticOperatorEnum;
  13. Components : OPTIONAL LIST [:?] OF IfcAppliedValue;
  14. INVERSE
  15. HasExternalReference : SET [:?] OF IfcExternalReferenceRelationship FOR RelatedResourceObjects;
  16. END_ENTITY;

STEP表示也非常紧凑和有意识。一旦习惯了它,也很容易阅读和导航。

  1. ISO--;
  2. HEADER;
  3. FILE_DESCRIPTION ((''), '2;1');
  4. FILE_NAME ('', '2016-10-27T13:14:43', (''), (''), 'Xbim File Processor version 3.2.0.0', 'Xbim version 3.2.0.0', '');
  5. FILE_SCHEMA (('IFC4'));
  6. ENDSEC;
  7. DATA;
  8. #=IFCPROJECT('2t0OftVsP8UBH3rtAB$yJv',#,'Basic Creation',$,$,$,$,(#,#),#);
  9. #=IFCOWNERHISTORY(#,#,$,.ADDED.,$,$,$,);
  10. #=IFCPERSON($,'Santini Aichel','Johann Blasius',$,$,$,$,$);
  11. #=IFCORGANIZATION($,'Independent Architecture',$,$,$);
  12. #=IFCPERSONANDORGANIZATION(#,#,$);
  13. #=IFCORGANIZATION($,'xBIM Team',$,$,$);
  14. #=IFCAPPLICATION(#,$,'xBIM Toolkit','xBIM');
  15. #=IFCUNITASSIGNMENT((#,#,#,#,#,#,#,#,#));
  16. #=IFCSIUNIT(*,.LENGTHUNIT.,.MILLI.,.METRE.);
  17. #=IFCSIUNIT(*,.AREAUNIT.,$,.SQUARE_METRE.);
  18. #=IFCSIUNIT(*,.VOLUMEUNIT.,$,.CUBIC_METRE.);
  19. #=IFCSIUNIT(*,.SOLIDANGLEUNIT.,$,.STERADIAN.);
  20. #=IFCSIUNIT(*,.PLANEANGLEUNIT.,$,.RADIAN.);
  21. #=IFCSIUNIT(*,.MASSUNIT.,$,.GRAM.);
  22. #=IFCSIUNIT(*,.TIMEUNIT.,$,.SECOND.);
  23. #=IFCSIUNIT(*,.THERMODYNAMICTEMPERATUREUNIT.,$,.DEGREE_CELSIUS.);
  24. #=IFCSIUNIT(*,.LUMINOUSINTENSITYUNIT.,$,.LUMEN.);
  25. #=IFCCARTESIANPOINT((.,.,.));
  26. #=IFCAXIS2PLACEMENT3D(#,$,$);
  27. #=IFCGEOMETRICREPRESENTATIONCONTEXT('Building Model','Model',,.E-,#,$);
  28. #=IFCCARTESIANPOINT((.,.));
  29. #=IFCAXIS2PLACEMENT2D(#,$);
  30. #=IFCGEOMETRICREPRESENTATIONCONTEXT('Building Plan View','Plan',,.E-,#,$);
  31. #=IFCWALL('1YTVCro6L0$OJQL2X7wICY',#,'The very first wall',$,$,$,$,$,$);
  32. #=IFCPROPERTYSINGLEVALUE('Text property',$,IFCTEXT('Any arbitrary text you like'),$);
  33. #=IFCPROPERTYSINGLEVALUE('Length property',$,IFCLENGTHMEASURE(.),$);
  34. #=IFCPROPERTYSINGLEVALUE('Number property',$,IFCNUMERICMEASURE(789.2),$);
  35. #=IFCPROPERTYSINGLEVALUE('Logical property',$,IFCLOGICAL(.T.),$);
  36. #=IFCPROPERTYSET('2u_olyjv13oRt0GvSVSxHS',#,'Basic set of properties',$,(#,#,#,#));
  37. #=IFCRELDEFINESBYPROPERTIES('3I5GuvWn95PRXcxoFGfJAL',#,$,$,(#),#);
  38. ENDSEC;
  39. END-ISO--;

IFC也由XSD定义,XSD从EXPRESS定义派生,其物理表示是众所周知的XML。XSD定义不包含所有的IFC功能,如WHERE规则和INVERSE属性,这些功能对于数据中的双向导航非常方便。IFC4也做了一些反转关系,并且在EXPRESS和XSD之间使用了不同的映射规则,因此任何为IFC2x3 XML编写的工具对于IFC4都是完全没有用的。使用xBIM为IFC2x3编写的代码非常容易升级到与IFC4兼容。

备注:由于XML数据的性质和简单IFC模型的复杂性。XML 格式模型始终使用更多CPU 和内存资源。

XSD 定义如下所示:

  1. <xs:element name="IfcAppliedValue" type="ifc:IfcAppliedValue" substitutionGroup="ifc:Entity" nillable="true"/>
  2. <xs:complexType name="IfcAppliedValue">
  3. <xs:complexContent>
  4. <xs:extension base="ifc:Entity">
  5. <xs:sequence>
  6. <xs:element name="AppliedValue" nillable="true" minOccurs="0">
  7. <xs:complexType>
  8. <xs:group ref="ifc:IfcAppliedValueSelect"/>
  9. </xs:complexType>
  10. </xs:element>
  11. <xs:element name="UnitBasis" type="ifc:IfcMeasureWithUnit" nillable="true" minOccurs="0"/>
  12. <xs:element name="Components" nillable="true" minOccurs="0">
  13. <xs:complexType>
  14. <xs:sequence>
  15. <xs:element ref="ifc:IfcAppliedValue" maxOccurs="unbounded"/>
  16. </xs:sequence>
  17. <xs:attribute ref="ifc:itemType" fixed="ifc:IfcAppliedValue"/>
  18. <xs:attribute ref="ifc:cType" fixed="list"/>
  19. <xs:attribute ref="ifc:arraySize" use="optional"/>
  20. </xs:complexType>
  21. </xs:element>
  22. </xs:sequence>
  23. <xs:attribute name="Name" type="ifc:IfcLabel" use="optional"/>
  24. <xs:attribute name="Description" type="ifc:IfcText" use="optional"/>
  25. <xs:attribute name="ApplicableDate" type="ifc:IfcDate" use="optional"/>
  26. <xs:attribute name="FixedUntilDate" type="ifc:IfcDate" use="optional"/>
  27. <xs:attribute name="Category" type="ifc:IfcLabel" use="optional"/>
  28. <xs:attribute name="Condition" type="ifc:IfcLabel" use="optional"/>
  29. <xs:attribute name="ArithmeticOperator" type="ifc:IfcArithmeticOperatorEnum" use="optional"/>
  30. </xs:extension>
  31. </xs:complexContent>
  32. </xs:complexType>

上面的例子看起来像IFCXML格式。但是请注意,IFC4 XML 比IFC2x3XML 要少很多。但模型的文件还是比较大。

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <ifcXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ifc="http://www.buildingsmart-tech.org/ifcXML/IFC4/Add1" xsi:schemaLocation="http://www.buildingsmart-tech.org/ifcXML/IFC4/Add1 http://www.buildingsmart-tech.org/ifcXML/IFC4/Add1/IFC4_ADD1.xsd" id="uos_1" express="http://www.buildingsmart-tech.org/ifc/IFC4/Add1/IFC4_ADD1.exp" configuration="http://www.buildingsmart-tech.org/ifcXML/IFC4/Add1/IFC4_ADD1_config.xml" xmlns="http://www.buildingsmart-tech.org/ifcXML/IFC4/Add1">
  3. <header>
  4. <time_stamp>2016-10-31T09:35:30</time_stamp>
  5. <preprocessor_version>Xbim File Processor version 4.0.0.0</preprocessor_version>
  6. <originating_system>Xbim version 4.0.0.0</originating_system>
  7. </header>
  8. <IfcProject id="i1" GlobalId="1Ozgvj0H5Bd8HqZRp$$1gG" Name="Basic Creation">
  9. <OwnerHistory id="i2" xsi:type="IfcOwnerHistory" ChangeAction="added" CreationDate="0">
  10. <OwningUser id="i5" xsi:type="IfcPersonAndOrganization">
  11. <ThePerson id="i3" xsi:type="IfcPerson" FamilyName="Santini Aichel" GivenName="Johann Blasius" MiddleNames="" PrefixTitles="" SuffixTitles="" />
  12. <TheOrganization id="i4" xsi:type="IfcOrganization" Name="Independent Architecture" />
  13. </OwningUser>
  14. <OwningApplication id="i6" xsi:type="IfcApplication" Version="4.0" ApplicationFullName="xBIM Toolkit" ApplicationIdentifier="xBIM">
  15. <ApplicationDeveloper id="i7" xsi:type="IfcOrganization" Name="xBIM Team" />
  16. </OwningApplication>
  17. </OwnerHistory>
  18. <RepresentationContexts>
  19. <IfcGeometricRepresentationContext id="i20" pos="0" ContextIdentifier="Building Model" ContextType="Model" CoordinateSpaceDimension="3" Precision="1E-05">
  20. <WorldCoordinateSystem>
  21. <IfcAxis2Placement3D id="i19">
  22. <Location id="i18" xsi:type="IfcCartesianPoint" Coordinates="0 0 0" />
  23. </IfcAxis2Placement3D>
  24. </WorldCoordinateSystem>
  25. </IfcGeometricRepresentationContext>
  26. <IfcGeometricRepresentationContext id="i23" pos="1" ContextIdentifier="Building Plan View" ContextType="Plan" CoordinateSpaceDimension="2" Precision="1E-05">
  27. <WorldCoordinateSystem>
  28. <IfcAxis2Placement2D id="i22">
  29. <Location id="i21" xsi:type="IfcCartesianPoint" Coordinates="0 0" />
  30. </IfcAxis2Placement2D>
  31. </WorldCoordinateSystem>
  32. </IfcGeometricRepresentationContext>
  33. </RepresentationContexts>
  34. <UnitsInContext id="i8" xsi:type="IfcUnitAssignment">
  35. <Units>
  36. <IfcSIUnit id="i9" pos="0" UnitType="lengthunit" Prefix="milli" Name="metre" />
  37. <IfcSIUnit id="i10" pos="1" UnitType="areaunit" Name="square_metre" />
  38. <IfcSIUnit id="i11" pos="2" UnitType="volumeunit" Name="cubic_metre" />
  39. <IfcSIUnit id="i12" pos="3" UnitType="solidangleunit" Name="steradian" />
  40. <IfcSIUnit id="i13" pos="4" UnitType="planeangleunit" Name="radian" />
  41. <IfcSIUnit id="i14" pos="5" UnitType="massunit" Name="gram" />
  42. <IfcSIUnit id="i15" pos="6" UnitType="timeunit" Name="second" />
  43. <IfcSIUnit id="i16" pos="7" UnitType="thermodynamictemperatureunit" Name="degree_celsius" />
  44. <IfcSIUnit id="i17" pos="8" UnitType="luminousintensityunit" Name="lumen" />
  45. </Units>
  46. </UnitsInContext>
  47. </IfcProject>
  48. <IfcWall id="i24" GlobalId="0CYq5lt8fES8dUWMOwav6U" Name="The very first wall">
  49. <OwnerHistory ref="i2" xsi:type="IfcOwnerHistory" xsi:nil="true" />
  50. <IsDefinedBy>
  51. <IfcRelDefinesByProperties id="i25" pos="0" GlobalId="1Wt5lOOef8C8PngqD19enP">
  52. <OwnerHistory ref="i2" xsi:type="IfcOwnerHistory" xsi:nil="true" />
  53. <RelatingPropertyDefinition>
  54. <IfcPropertySet id="i26" GlobalId="0JTSUXsqP9QRLClhbnQBnS" Name="Basic set of properties">
  55. <OwnerHistory ref="i2" xsi:type="IfcOwnerHistory" xsi:nil="true" />
  56. <HasProperties>
  57. <IfcPropertySingleValue id="i27" pos="0" Name="Text property">
  58. <NominalValue>
  59. <IfcText-wrapper>Any arbitrary text you like</IfcText-wrapper>
  60. </NominalValue>
  61. </IfcPropertySingleValue>
  62. <IfcPropertySingleValue id="i28" pos="1" Name="Length property">
  63. <NominalValue>
  64. <IfcLengthMeasure-wrapper>56</IfcLengthMeasure-wrapper>
  65. </NominalValue>
  66. </IfcPropertySingleValue>
  67. <IfcPropertySingleValue id="i29" pos="2" Name="Number property">
  68. <NominalValue>
  69. <IfcNumericMeasure-wrapper>789.2</IfcNumericMeasure-wrapper>
  70. </NominalValue>
  71. </IfcPropertySingleValue>
  72. <IfcPropertySingleValue id="i30" pos="3" Name="Logical property">
  73. <NominalValue>
  74. <IfcLogical-wrapper>true</IfcLogical-wrapper>
  75. </NominalValue>
  76. </IfcPropertySingleValue>
  77. </HasProperties>
  78. </IfcPropertySet>
  79. </RelatingPropertyDefinition>
  80. </IfcRelDefinesByProperties>
  81. </IsDefinedBy>
  82. </IfcWall>
  83. </ifcXML>

通过以上两种格式对比,那么我的观点就是IFC 作为STEP21存储和处理要好得多。但xBIM 也支持XML ,在个别的情况下需要转换为STEP21。

  1. using System;
  2. using Xbim.Ifc;
  3. using Xbim.Ifc4.Interfaces;
  4.  
  5. namespace BasicExamples
  6. {
  7. public class StepToXmlExample
  8. {
  9. public static void Convert()
  10. {
  11. //打开 STEP21 文件
  12. using (var stepModel = IfcStore.Open("SampleHouse.ifc"))
  13. {
  14. //保存为XML格式
  15. stepModel.SaveAs("SampleHouse.ifcxml");
  16.  
  17. //打开XML格式
  18. using (var xmlModel = IfcStore.Open("SampleHouse.ifcxml"))
  19. {
  20. //实体数量
  21. var stepCount = stepModel.Instances.Count;
  22. var xmlCount = xmlModel.Instances.Count;
  23. //墙壁数量
  24. var stepWallsCount = stepModel.Instances.CountOf<IIfcWall>();
  25. var xmlWallsCount = xmlModel.Instances.CountOf<IIfcWall>();
  26.  
  27. Console.WriteLine($"STEP21 file has {stepCount} entities. XML file has {xmlCount} entities.");
  28. Console.WriteLine($"STEP21 file has {stepWallsCount} walls. XML file has {xmlWallsCount} walls.");
  29. }
  30. }
  31.  
  32. }
  33. }
  34. }

xBIM 格式之间转换的更多相关文章

  1. 【转】Notepad++中Windows,Unix,Mac三种格式之间的转换

    原文网址:http://www.crifan.com/files/doc/docbook/rec_soft_npp/release/htmls/npp_func_windows_unix_mac.ht ...

  2. Python-时间戳、元组时间的格式、自定义时间格式之间的转换

    一.时间戳.元组时间的格式.自定义时间格式之间的转换 1.下面是三者之间的转换关系: 2.代码如下: import time import datetime print(time.time()) #获 ...

  3. .net amr格式文件转换成mp3格式文件的方法

    前言:winform端对于音频文件的格式多有限制,大多数不支持amr格式的文件的播放.但是,手机端传过来的音频文件大多数是amr格式的文件,所以,要想在winform客户端支持音频文件的播放,可以通过 ...

  4. Linux下常见音频格式之间的转换方法

    Linux下常见音频格式之间的转换方法[转] 下面简单介绍下Linux环境常见音频格式之间的转换方法: MP3 相关工具: lameOGG 相关工具: vorbis-toolsAPE 相关工具: ma ...

  5. Java中几种常用数据类型之间转换的方法

    Java中几种常用的数据类型之间转换方法: 1. short-->int 转换 exp: short shortvar=0; int intvar=0; shortvar= (short) in ...

  6. datetime,Timestamp和datetime64之间转换

    引入工具包 import datetime import numpy as np import pandas as pd 总览 from IPython.display import Image fr ...

  7. js时间戳与日期格式之间相互转换

    ###js时间戳与日期格式之间相互转换 将时间戳转换成日期格式 // 简单的一句代码 var date = new Date(时间戳); //获取一个时间对象 /** 1. 下面是获取时间日期的方法, ...

  8. 二、Python系列——time时间格式的转换及计算

    # -*- coding:utf-8 -*- import pandas as pd import time import datetime start_date = '2020-06-08' # 一 ...

  9. 字符串对象跟xml格式的转换

    package com.sunshen.jfids.testWebService.task; import java.io.File; import java.io.StringWriter; imp ...

随机推荐

  1. HDU 2084 数塔(简单DP入门)

    数塔 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submiss ...

  2. Quoit Design(最近点对+分治)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1007 Quoit Design Time Limit: 10000/5000 MS (Java/Oth ...

  3. BOX

    题目连接:http://acm.tju.edu.cn/toj/showp2392.html2392.   Box Time Limit: 1.0 Seconds   Memory Limit: 655 ...

  4. PL/SQL游标详解

    刚打开游标的时候,是位于一个空行,要用fetch into 才能到第一行. 只是要注意用更新游标的时候,不能在游标期间commit. 否则会报ORA-01002: fetch out of seque ...

  5. UEP-树和表

    Model Select:表格要展示的数据Tree DataSource:树的数据源数据源是自定义java类实现接口:ITreeRetriever创建根节点.判断子节点.创建子节点 --数据源 pac ...

  6. PHP defined() 函数

    定义和用法 defined() 函数检查某常量是否存在. 若常量存在,则返回 true,否则返回 false. 语法 defined(name) 参数 描述 name 必需.规定要检查的常量的名称. ...

  7. ThinkPHP配置文件的加载

    分类: thinkphp(39) 版权声明:本文为博主原创文章,未经博主允许不得转载. 惯例配置->应用配置->模式配置->调试配置->状态配置->模块配置->扩展 ...

  8. Eclipse报错An internal error occurred during: "J2EE Component Mapping Update". java.lang.NullPointerException

    Eclipse每次打开.java文件时,报错信息如下: An internal error occurred during: "J2EE Component Mapping Update&q ...

  9. maven pom.xml 详细

    一.什么是POM Project Object Model,项目对象模型.通过xml格式保存的pom.xml文件.作用类似ant的build.xml文件,功能更强大.该文件用于管理:源代码.配置文件. ...

  10. java基础学习总结——java读取properties文件总结

    摘录自:http://www.cnblogs.com/xdp-gacl/p/3640211.html 一.java读取properties文件总结 在java项目中,操作properties文件是经常 ...