目录

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 代码如下所示:

SCHEMA家族;

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

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

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

xBIM Tookit 实现100%的 IFC2 x 3和 IFC4模式,并且支持所有的物理表示。STEP21 实在EXPRESS定义的数据的物理表示。这是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定义,XSD从EXPRESS定义派生,其物理表示是众所周知的XML。XSD定义不包含所有的IFC功能,如WHERE规则和INVERSE属性,这些功能对于数据中的双向导航非常方便。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="0">
<xs:complexType>
<xs:group ref="ifc:IfcAppliedValueSelect"/>
</xs:complexType>
</xs:element>
<xs:element name="UnitBasis" type="ifc:IfcMeasureWithUnit" nillable="true" minOccurs="0"/>
<xs:element name="Components" nillable="true" minOccurs="0">
<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 比IFC2x3XML 要少很多。但模型的文件还是比较大。

<?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>2016-10-31T09:35:30</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="0">
<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="0" ContextIdentifier="Building Model" ContextType="Model" CoordinateSpaceDimension="3" Precision="1E-05">
<WorldCoordinateSystem>
<IfcAxis2Placement3D id="i19">
<Location id="i18" xsi:type="IfcCartesianPoint" Coordinates="0 0 0" />
</IfcAxis2Placement3D>
</WorldCoordinateSystem>
</IfcGeometricRepresentationContext>
<IfcGeometricRepresentationContext id="i23" pos="1" ContextIdentifier="Building Plan View" ContextType="Plan" CoordinateSpaceDimension="2" 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="0" UnitType="lengthunit" Prefix="milli" Name="metre" />
<IfcSIUnit id="i10" pos="1" UnitType="areaunit" Name="square_metre" />
<IfcSIUnit id="i11" pos="2" UnitType="volumeunit" Name="cubic_metre" />
<IfcSIUnit id="i12" pos="3" UnitType="solidangleunit" Name="steradian" />
<IfcSIUnit id="i13" pos="4" UnitType="planeangleunit" Name="radian" />
<IfcSIUnit id="i14" pos="5" UnitType="massunit" Name="gram" />
<IfcSIUnit id="i15" pos="6" UnitType="timeunit" Name="second" />
<IfcSIUnit id="i16" pos="7" UnitType="thermodynamictemperatureunit" Name="degree_celsius" />
<IfcSIUnit id="i17" pos="8" 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="0" 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="0" Name="Text property">
<NominalValue>
<IfcText-wrapper>Any arbitrary text you like</IfcText-wrapper>
</NominalValue>
</IfcPropertySingleValue>
<IfcPropertySingleValue id="i28" pos="1" Name="Length property">
<NominalValue>
<IfcLengthMeasure-wrapper>56</IfcLengthMeasure-wrapper>
</NominalValue>
</IfcPropertySingleValue>
<IfcPropertySingleValue id="i29" pos="2" Name="Number property">
<NominalValue>
<IfcNumericMeasure-wrapper>789.2</IfcNumericMeasure-wrapper>
</NominalValue>
</IfcPropertySingleValue>
<IfcPropertySingleValue id="i30" pos="3" 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()
{
//打开 STEP21 文件
using (var stepModel = IfcStore.Open("SampleHouse.ifc"))
{
//保存为XML格式
stepModel.SaveAs("SampleHouse.ifcxml"); //打开XML格式
using (var xmlModel = IfcStore.Open("SampleHouse.ifcxml"))
{
//实体数量
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.");
}
} }
}
}

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. 关于int *a[常量]与int (*a)[常量]的分析与区分(详解)

    前言: 小伙伴私信我说,int *a[常量]与int (*a)[常量]这个区分不开,C指针,确实是C中最难的部分,也是学C++,JAVA,包括你以后上岗用的非常频繁的东西,在这里我就简单论述一下吧,具 ...

  2. hdu_1012(水题。。。不能再水)

    #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> using ...

  3. class 文件反编译器的 java 实现

    最近由于公司项目需要,了解了很多关于类加载方面的知识,给项目带来了一些热部署方面的突破. 由于最近手头工作不太忙,同时驱于对更底层知识的好奇与渴求,因此决定学习了一下 class 文件结构,并通过一周 ...

  4. 创建jedis对象

    1.先在taotao-parent的pom.xml中复制 以下内容到rest的pom.xml中 <!-- Redis客户端 --> <dependency> <group ...

  5. ASP.NET没有魔法——ASP.NET OAuth、jwt、OpenID Connect

    上一篇文章介绍了OAuth2.0以及如何使用.Net来实现基于OAuth的身份验证,本文是对上一篇文章的补充,主要是介绍OAuth与Jwt以及OpenID Connect之间的关系与区别. 本文主要内 ...

  6. c#委托事件入门--第二讲:事件入门

    上文 c#委托事件入门--第一讲:委托入门 中和大家介绍了委托,学习委托必不可少的就要说下事件.以下思明仍然从事件是什么.为什么用事件.怎么实现事件和总结介绍一下事件 1.事件是什么:. 1.1 NE ...

  7. PHP条件语句if的使用

    方法/步骤 if(条件){是否执行的代码...}:这样的用法常用于判断单一条件,当然,可以可以用逻辑符号将多个条件组合成同一条件. if else语句:如果条件不成立,就会执行else后面{}里的代码 ...

  8. async函数解析

    转载请注明出处:async函数解析 async函数是基于Generator函数实现的,也就是说是Generator函数的语法糖.在之前的文章有介绍过Generator函数语法和异步应用,如果对其不了解 ...

  9. asp.net -mvc框架复习(10)-基于三层架构与MVC搭建项目框架

    一.三种模式比较 1.MVC框架(适合大型项目) (1).V视图 (网页部分) (2).M模型 (业务逻辑+数据访问+实体类) (3).C控制器 (介于M和V之间,起到引导作用) 2.三层架构 (1) ...

  10. 开源纯C#工控网关+组态软件(八)表达式编译器

    一.   引子 监控画面的主要功能之一就是跟踪下位机变量变化,并将这些变化展现为动画.大部分时候,界面上一个图元组件的某个状态,与单一变量Tag绑定,比如电机的运行态,绑定一个MotorRunning ...