STEP,它是Standard for the Exchange of Product model data的縮寫。
產品數據交換標準STEP (Product data exchange standard STEP) 指國際標準化組織(ISO)制定的系列標準ISO 10303 《產品數據的表達與交換》。這個標準的主要目的是解決製造業中計算機環境下的設計和製造(CAD/CAM)的數據交換和企業數據共享的問題。中國陸續將其制定爲同名國家標準,標準號爲GB/T 16656。html
STEP 可適用於在CAD,計算機輔助製造,計算機輔助工程,產品數據管理/企業數據建模和其餘系統之間交換數據。2014年12月,ISO發佈了初版新的主要應用協議AP242基於模型的3d工程,它們以向上兼容的方式組合和替換了之前的如下AP:express
此外AP242版本1包含擴展和重大更新編程
xBIM 使用的是最新的STEP ISO 10303-21 簡稱 STEP21. app
EXPRESS語言爲了可以描述客觀事物、客觀事物的特性、事物之間的關係,它引入了實體(ENTITY)和模式(SCHEMA)的概念。在EXPRESS語言中把通常的事物(或概念)抽象爲實體,若干實體的集合組成模式。這意味着小的概念可組成大的概念。事物的特性在EXPRESS語言中用實體的屬性(attribute)表示。實體的屬性能夠是簡單數據類型,如實數數據類型可描述實體與數字有關或與幾何有關的特性,字符串數據類型可描述實體或屬性的名稱或須要用文字說明的特性。固然屬性還能夠是聚合數據類型或布爾數據類型用以描述相對複雜的產品特性。編程語言
描述實體之間的關係用子類(SUBTYPE)和超類(SUPERTYPE)說明的辦法。一個實體能夠是某一實體的子類,也能夠是某個其餘實體的超類。例如,人這一律念能夠分爲男人和女人。在EXPRESS中把「人」這個實體做爲「男人實體」和「女人實體」的超類,而「男人實體」和「女人實體」做爲「人實體」的子類。這種子類和超類的說明能夠描述客觀事物之間的複雜網狀關係。EXPRESS語言還容許定義複雜的函數以描述客觀事物中任何複雜的數量關係或邏輯(布爾)關係,並進行相應的幾何和拓撲等描述。函數
爲了可以直觀的表示所創建的數據模型,在標準中還規定能夠用EXPRESS-G圖表示實體、實體的屬性,實體和屬性之間的關係、實體之間的關係等等。這種表示法主要使用框圖和框圖之間的連線的辦法,很是直觀,易於理解。工具
EXPRESS 代碼以下所示:ui
SCHEMA家族;
ENTITY人
(ONEOF(男,女))的抽象超模;
名字:STRING;
母親:可選女性;
父親:可選男性;
END_ENTITY;
ENTITY女性
(人)的子類型;
END_ENTITY;
ENTITY男性
(Person)的SUBTYPE;
END_ENTITY;
END_SCHEMA;
它包含一個超類型實體人與兩個亞型男性和女性。因爲Person被聲明爲ABSTRACT(抽象),所以只有(ONEOF)亞型男性或女性能夠存在。每一個人的事件都有一個強制性的名字屬性,而且能夠選擇屬性母親和父親。對於某些實體類型的屬性,有一種固定的閱讀方式:spa
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 [1:?] OF IfcAppliedValue; INVERSE HasExternalReference : SET [0:?] OF IfcExternalReferenceRelationship FOR RelatedResourceObjects; END_ENTITY;
STEP表示也很是緊湊和有意識。一旦習慣,它也易於閱讀和導航。設計
ISO-10303-21; 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; #1=IFCPROJECT('2t0OftVsP8UBH3rtAB$yJv',#2,'Basic Creation',$,$,$,$,(#20,#23),#8); #2=IFCOWNERHISTORY(#5,#6,$,.ADDED.,$,$,$,0); #3=IFCPERSON($,'Santini Aichel','Johann Blasius',$,$,$,$,$); #4=IFCORGANIZATION($,'Independent Architecture',$,$,$); #5=IFCPERSONANDORGANIZATION(#3,#4,$); #7=IFCORGANIZATION($,'xBIM Team',$,$,$); #6=IFCAPPLICATION(#7,$,'xBIM Toolkit','xBIM'); #8=IFCUNITASSIGNMENT((#9,#10,#11,#12,#13,#14,#15,#16,#17)); #9=IFCSIUNIT(*,.LENGTHUNIT.,.MILLI.,.METRE.); #10=IFCSIUNIT(*,.AREAUNIT.,$,.SQUARE_METRE.); #11=IFCSIUNIT(*,.VOLUMEUNIT.,$,.CUBIC_METRE.); #12=IFCSIUNIT(*,.SOLIDANGLEUNIT.,$,.STERADIAN.); #13=IFCSIUNIT(*,.PLANEANGLEUNIT.,$,.RADIAN.); #14=IFCSIUNIT(*,.MASSUNIT.,$,.GRAM.); #15=IFCSIUNIT(*,.TIMEUNIT.,$,.SECOND.); #16=IFCSIUNIT(*,.THERMODYNAMICTEMPERATUREUNIT.,$,.DEGREE_CELSIUS.); #17=IFCSIUNIT(*,.LUMINOUSINTENSITYUNIT.,$,.LUMEN.); #18=IFCCARTESIANPOINT((0.,0.,0.)); #19=IFCAXIS2PLACEMENT3D(#18,$,$); #20=IFCGEOMETRICREPRESENTATIONCONTEXT('Building Model','Model',3,1.E-05,#19,$); #21=IFCCARTESIANPOINT((0.,0.)); #22=IFCAXIS2PLACEMENT2D(#21,$); #23=IFCGEOMETRICREPRESENTATIONCONTEXT('Building Plan View','Plan',2,1.E-05,#22,$); #24=IFCWALL('1YTVCro6L0$OJQL2X7wICY',#2,'The very first wall',$,$,$,$,$,$); #27=IFCPROPERTYSINGLEVALUE('Text property',$,IFCTEXT('Any arbitrary text you like'),$); #28=IFCPROPERTYSINGLEVALUE('Length property',$,IFCLENGTHMEASURE(56.),$); #29=IFCPROPERTYSINGLEVALUE('Number property',$,IFCNUMERICMEASURE(789.2),$); #30=IFCPROPERTYSINGLEVALUE('Logical property',$,IFCLOGICAL(.T.),$); #26=IFCPROPERTYSET('2u_olyjv13oRt0GvSVSxHS',#2,'Basic set of properties',$,(#27,#28,#29,#30)); #25=IFCRELDEFINESBYPROPERTIES('3I5GuvWn95PRXcxoFGfJAL',#2,$,$,(#24),#26); ENDSEC; END-ISO-10303-21;
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="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比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>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() { //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."); } } } } }