一、STEP标准简介

  STEP,它是Standard for the Exchange of Product model data的缩写。
产品数据交换标准STEP (Product data exchange standard STEP) 指国际标准化组织(ISO)制定的系列标准ISO 10303 《产品数据的表达与交换》。这个标准的主要目的是解决制造业中计算机环境下的设计和制造(CAD/CAM)的数据交换和企业数据共享的问题。中国陆续将其制定为同名国家标准,标准号为GB/T 16656。

  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语言
  STEP标准描述方法中的一个重要的标准是ISO 10303 - 11 EXPRESS语言参考手册。EXPRESS语言是描述方法的核心,也是STEP标准的基础。该标准是一种形式化描述语言,但不是计算机编程语言。它吸收了现代编程语言的优点,主要目的是为了建立产品的数据模型,对产品的几何、拓扑、材料、管理信息等进行描述。

  EXPRESS语言为了能够描述客观事物、客观事物的特性、事物之间的关系,它引入了实体(ENTITY)和模式(SCHEMA)的概念。在EXPRESS语言中把一般的事物(或概念)抽象为实体,若干实体的集合组成模式。这意味着小的概念可组成大的概念。事物的特性在EXPRESS语言中用实体的属性(attribute)表示。实体的属性可以是简单数据类型,如实数数据类型可描述实体与数字有关或与几何有关的特性,字符串数据类型可描述实体或属性的名称或需要用文字说明的特性。当然属性还可以是聚合数据类型或布尔数据类型用以描述相对复杂的产品特性。

  描述实体之间的关系用子类(SUBTYPE)和超类(SUPERTYPE)说明的办法。一个实体可以是某一实体的子类,也可以是某个其他实体的超类。例如,人这一概念可以分为男人和女人。在EXPRESS中把“人”这个实体作为“男人实体”和“女人实体”的超类,而“男人实体”和“女人实体”作为“人实体”的子类。这种子类和超类的说明可以描述客观事物之间的复杂网状关系。EXPRESS语言还允许定义复杂的函数以描述客观事物中任何复杂的数量关系或逻辑(布尔)关系,并进行相应的几何和拓扑等描述。

  为了能够直观的表示所建立的数据模型,在标准中还规定可以用EXPRESS-G图表示实体、实体的属性,实体和属性之间的关系、实体之间的关系等等。这种表示法主要使用框图和框图之间的连线的办法,非常直观,易于理解。

EXPRESS 代码如下所示:

SCHEMA家族;

ENTITY人
(ONEOF(男,女))的抽象超模;
名字:STRING;
母亲:可选女性;
父亲:可选男性;
END_ENTITY; ENTITY女性
(人)的子类型;
END_ENTITY; ENTITY男性
(Person)的SUBTYPE;
END_ENTITY; END_SCHEMA;

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

  • 一个女人可以扮演一个母亲的角色
  • 一个男人可以扮演一个父亲的角色
 
三、将STEP物理文件转换为XML将STEP物理文件转换为XML
  xBIM Toolkit实现了100%的IFC2x3和IFC4模式,它支持所有物理表示。 STEP21EXPRESS中定义的数据的物理表示。它是IFC的原始定义,非常适合产品建模。从这个简单的例子中可能并不明显,但是EXPRESS比任何XSD更有意识,更容易阅读。EXPRESS定义如下所示:
ENTITY IfcAppliedValue
SUPERTYPE OF (ONEOF
(IfcCostValue));
Name : OPTIONAL IfcLabel;
Description : OPTIONAL IfcText;
AppliedValue : OPTIONAL IfcAppliedValueSelect;
UnitBasis : OPTIONAL IfcMeasureWithUnit;
ApplicableDate : OPTIONAL IfcDate;
FixedUntilDate : OPTIONAL IfcDate;
Category : OPTIONAL IfcLabel;
Condition : OPTIONAL IfcLabel;
ArithmeticOperator : OPTIONAL IfcArithmeticOperatorEnum;
Components : OPTIONAL LIST [:?] OF IfcAppliedValue;
INVERSE
HasExternalReference : SET [:?] OF IfcExternalReferenceRelationship FOR RelatedResourceObjects;
END_ENTITY;

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

ISO--;
HEADER;
FILE_DESCRIPTION ((''), '2;1');
FILE_NAME ('', '2016-10-27T13:14:43', (''), (''), 'Xbim File Processor version 3.2.0.0', 'Xbim version 3.2.0.0', '');
FILE_SCHEMA (('IFC4'));
ENDSEC;
DATA;
#=IFCPROJECT('2t0OftVsP8UBH3rtAB$yJv',#,'Basic Creation',$,$,$,$,(#,#),#);
#=IFCOWNERHISTORY(#,#,$,.ADDED.,$,$,$,);
#=IFCPERSON($,'Santini Aichel','Johann Blasius',$,$,$,$,$);
#=IFCORGANIZATION($,'Independent Architecture',$,$,$);
#=IFCPERSONANDORGANIZATION(#,#,$);
#=IFCORGANIZATION($,'xBIM Team',$,$,$);
#=IFCAPPLICATION(#,$,'xBIM Toolkit','xBIM');
#=IFCUNITASSIGNMENT((#,#,#,#,#,#,#,#,#));
#=IFCSIUNIT(*,.LENGTHUNIT.,.MILLI.,.METRE.);
#=IFCSIUNIT(*,.AREAUNIT.,$,.SQUARE_METRE.);
#=IFCSIUNIT(*,.VOLUMEUNIT.,$,.CUBIC_METRE.);
#=IFCSIUNIT(*,.SOLIDANGLEUNIT.,$,.STERADIAN.);
#=IFCSIUNIT(*,.PLANEANGLEUNIT.,$,.RADIAN.);
#=IFCSIUNIT(*,.MASSUNIT.,$,.GRAM.);
#=IFCSIUNIT(*,.TIMEUNIT.,$,.SECOND.);
#=IFCSIUNIT(*,.THERMODYNAMICTEMPERATUREUNIT.,$,.DEGREE_CELSIUS.);
#=IFCSIUNIT(*,.LUMINOUSINTENSITYUNIT.,$,.LUMEN.);
#=IFCCARTESIANPOINT((.,.,.));
#=IFCAXIS2PLACEMENT3D(#,$,$);
#=IFCGEOMETRICREPRESENTATIONCONTEXT('Building Model','Model',,.E-,#,$);
#=IFCCARTESIANPOINT((.,.));
#=IFCAXIS2PLACEMENT2D(#,$);
#=IFCGEOMETRICREPRESENTATIONCONTEXT('Building Plan View','Plan',,.E-,#,$);
#=IFCWALL('1YTVCro6L0$OJQL2X7wICY',#,'The very first wall',$,$,$,$,$,$);
#=IFCPROPERTYSINGLEVALUE('Text property',$,IFCTEXT('Any arbitrary text you like'),$);
#=IFCPROPERTYSINGLEVALUE('Length property',$,IFCLENGTHMEASURE(.),$);
#=IFCPROPERTYSINGLEVALUE('Number property',$,IFCNUMERICMEASURE(789.2),$);
#=IFCPROPERTYSINGLEVALUE('Logical property',$,IFCLOGICAL(.T.),$);
#=IFCPROPERTYSET('2u_olyjv13oRt0GvSVSxHS',#,'Basic set of properties',$,(#,#,#,#));
#=IFCRELDEFINESBYPROPERTIES('3I5GuvWn95PRXcxoFGfJAL',#,$,$,(#),#);
ENDSEC;
END-ISO--;

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

还要注意,由于XML数据的性质和复杂性甚至简单的IFC模型,XML模型总会使用更多的内存和CPU资源。

XSD定义如下所示:

<xs:element name="IfcAppliedValue" type="ifc:IfcAppliedValue" substitutionGroup="ifc:Entity" nillable="true"/>
<xs:complexType name="IfcAppliedValue">
<xs:complexContent>
<xs:extension base="ifc:Entity">
<xs:sequence>
<xs:element name="AppliedValue" nillable="true" minOccurs="">
<xs:complexType>
<xs:group ref="ifc:IfcAppliedValueSelect"/>
</xs:complexType>
</xs:element>
<xs:element name="UnitBasis" type="ifc:IfcMeasureWithUnit" nillable="true" minOccurs=""/>
<xs:element name="Components" nillable="true" minOccurs="">
<xs:complexType>
<xs:sequence>
<xs:element ref="ifc:IfcAppliedValue" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute ref="ifc:itemType" fixed="ifc:IfcAppliedValue"/>
<xs:attribute ref="ifc:cType" fixed="list"/>
<xs:attribute ref="ifc:arraySize" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="Name" type="ifc:IfcLabel" use="optional"/>
<xs:attribute name="Description" type="ifc:IfcText" use="optional"/>
<xs:attribute name="ApplicableDate" type="ifc:IfcDate" use="optional"/>
<xs:attribute name="FixedUntilDate" type="ifc:IfcDate" use="optional"/>
<xs:attribute name="Category" type="ifc:IfcLabel" use="optional"/>
<xs:attribute name="Condition" type="ifc:IfcLabel" use="optional"/>
<xs:attribute name="ArithmeticOperator" type="ifc:IfcArithmeticOperatorEnum" use="optional"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>

与上面相同的例子看起来像IFCXML。请注意,IFC4 XML比IFC2x3 XML简洁得多,但模型的文件还是比较大。

<?xml version="1.0" encoding="utf-8"?>
<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">
<header>
<time_stamp>--31T09::</time_stamp>
<preprocessor_version>Xbim File Processor version 4.0.0.0</preprocessor_version>
<originating_system>Xbim version 4.0.0.0</originating_system>
</header>
<IfcProject id="i1" GlobalId="1Ozgvj0H5Bd8HqZRp$$1gG" Name="Basic Creation">
<OwnerHistory id="i2" xsi:type="IfcOwnerHistory" ChangeAction="added" CreationDate="">
<OwningUser id="i5" xsi:type="IfcPersonAndOrganization">
<ThePerson id="i3" xsi:type="IfcPerson" FamilyName="Santini Aichel" GivenName="Johann Blasius" MiddleNames="" PrefixTitles="" SuffixTitles="" />
<TheOrganization id="i4" xsi:type="IfcOrganization" Name="Independent Architecture" />
</OwningUser>
<OwningApplication id="i6" xsi:type="IfcApplication" Version="4.0" ApplicationFullName="xBIM Toolkit" ApplicationIdentifier="xBIM">
<ApplicationDeveloper id="i7" xsi:type="IfcOrganization" Name="xBIM Team" />
</OwningApplication>
</OwnerHistory>
<RepresentationContexts>
<IfcGeometricRepresentationContext id="i20" pos="" ContextIdentifier="Building Model" ContextType="Model" CoordinateSpaceDimension="" Precision="1E-05">
<WorldCoordinateSystem>
<IfcAxis2Placement3D id="i19">
<Location id="i18" xsi:type="IfcCartesianPoint" Coordinates="0 0 0" />
</IfcAxis2Placement3D>
</WorldCoordinateSystem>
</IfcGeometricRepresentationContext>
<IfcGeometricRepresentationContext id="i23" pos="" ContextIdentifier="Building Plan View" ContextType="Plan" CoordinateSpaceDimension="" Precision="1E-05">
<WorldCoordinateSystem>
<IfcAxis2Placement2D id="i22">
<Location id="i21" xsi:type="IfcCartesianPoint" Coordinates="0 0" />
</IfcAxis2Placement2D>
</WorldCoordinateSystem>
</IfcGeometricRepresentationContext>
</RepresentationContexts>
<UnitsInContext id="i8" xsi:type="IfcUnitAssignment">
<Units>
<IfcSIUnit id="i9" pos="" UnitType="lengthunit" Prefix="milli" Name="metre" />
<IfcSIUnit id="i10" pos="" UnitType="areaunit" Name="square_metre" />
<IfcSIUnit id="i11" pos="" UnitType="volumeunit" Name="cubic_metre" />
<IfcSIUnit id="i12" pos="" UnitType="solidangleunit" Name="steradian" />
<IfcSIUnit id="i13" pos="" UnitType="planeangleunit" Name="radian" />
<IfcSIUnit id="i14" pos="" UnitType="massunit" Name="gram" />
<IfcSIUnit id="i15" pos="" UnitType="timeunit" Name="second" />
<IfcSIUnit id="i16" pos="" UnitType="thermodynamictemperatureunit" Name="degree_celsius" />
<IfcSIUnit id="i17" pos="" UnitType="luminousintensityunit" Name="lumen" />
</Units>
</UnitsInContext>
</IfcProject>
<IfcWall id="i24" GlobalId="0CYq5lt8fES8dUWMOwav6U" Name="The very first wall">
<OwnerHistory ref="i2" xsi:type="IfcOwnerHistory" xsi:nil="true" />
<IsDefinedBy>
<IfcRelDefinesByProperties id="i25" pos="" GlobalId="1Wt5lOOef8C8PngqD19enP">
<OwnerHistory ref="i2" xsi:type="IfcOwnerHistory" xsi:nil="true" />
<RelatingPropertyDefinition>
<IfcPropertySet id="i26" GlobalId="0JTSUXsqP9QRLClhbnQBnS" Name="Basic set of properties">
<OwnerHistory ref="i2" xsi:type="IfcOwnerHistory" xsi:nil="true" />
<HasProperties>
<IfcPropertySingleValue id="i27" pos="" Name="Text property">
<NominalValue>
<IfcText-wrapper>Any arbitrary text you like</IfcText-wrapper>
</NominalValue>
</IfcPropertySingleValue>
<IfcPropertySingleValue id="i28" pos="" Name="Length property">
<NominalValue>
<IfcLengthMeasure-wrapper></IfcLengthMeasure-wrapper>
</NominalValue>
</IfcPropertySingleValue>
<IfcPropertySingleValue id="i29" pos="" Name="Number property">
<NominalValue>
<IfcNumericMeasure-wrapper>789.2</IfcNumericMeasure-wrapper>
</NominalValue>
</IfcPropertySingleValue>
<IfcPropertySingleValue id="i30" pos="" Name="Logical property">
<NominalValue>
<IfcLogical-wrapper>true</IfcLogical-wrapper>
</NominalValue>
</IfcPropertySingleValue>
</HasProperties>
</IfcPropertySet>
</RelatingPropertyDefinition>
</IfcRelDefinesByProperties>
</IsDefinedBy>
</IfcWall>
</ifcXML>

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

using System;
using Xbim.Ifc;
using Xbim.Ifc4.Interfaces; namespace BasicExamples
{
public class StepToXmlExample
{
public static void Convert()
{
//open STEP21 file
using (var stepModel = IfcStore.Open("SampleHouse.ifc"))
{
//save as XML
stepModel.SaveAs("SampleHouse.ifcxml"); //open XML file
using (var xmlModel = IfcStore.Open("SampleHouse.ifcxml"))
{
//just have a look that it contains the same number of entities and walls.
var stepCount = stepModel.Instances.Count;
var xmlCount = xmlModel.Instances.Count; var stepWallsCount = stepModel.Instances.CountOf<IIfcWall>();
var xmlWallsCount = xmlModel.Instances.CountOf<IIfcWall>(); Console.WriteLine($"STEP21 file has {stepCount} entities. XML file has {xmlCount} entities.");
Console.WriteLine($"STEP21 file has {stepWallsCount} walls. XML file has {xmlWallsCount} walls.");
}
} }
}
}
 

最新文章

  1. 【WCF】自定义地址头的筛选器
  2. 关于 Raphael
  3. jQuery标签选择器
  4. logstash无法使用conf启动
  5. JavaWeb学习总结-04 Servlet 学习和使用
  6. javascript基础07
  7. HBuilder打包ios应用
  8. 神、上帝以及老天爷[HDU2048]
  9. 学习资料 50个常用的sql语句
  10. (五)ASP.NET中动态生成控件
  11. 【Codeforces】#345 Div1
  12. HowTo: SVN undo add without reverting local changes
  13. Oracle EBS-SQL (WIP-9):检查车间任务超发料.sql
  14. 12C CLONE PDB and config service_listener
  15. struts2标签库----控制标签详解
  16. cf219d 基础换根法
  17. symmfony
  18. python 爬虫数据存入csv格式方法
  19. java课件运行实践
  20. Installing Apache Spark on Ubuntu 16.04

热门文章

  1. java.lang.NoClassDefFoundError: javax/servlet/ServletInputStream
  2. ios 中生成随机数
  3. 关于jquery文件上传插件&#160;uploadify&#160;3.1的使用
  4. 关于windows 2008 64位系统驱动的加载问题
  5. ICMPv6和IPv6 NDP
  6. css——样式的优先级
  7. java的算法实现冒泡
  8. vim配置C++开发环境 win10
  9. JS中的异步
  10. Swoole 源码分析——进程管理 Swoole_Process