附录 E
(资料性)
示例
E.3.2 - CSG基本体(Csg Primitive)
示例概述(Example overview)
这些示例演示了使用各种几何形状表示类型来表达建筑构件代理的简单几何形状。所有示例文件使用相同的数据集基本结构,仅在用于定义同一形状(1m×1m×2m的方块)的几何表示项上有所不同。
示例IFC文件提供的基本结构包括:
- 由以下提供的数据集基本上下文: IfcProject(项目) 及引用实体:
- IfcOwnerHistory(所有者历史) 提供创建项目数据集的用户、应用程序及时间戳;
- IfcGeometricRepresentationContext(几何表示上下文) 提供通用上下文,包括表示类型、维度、坐标系和精度;
- IfcUnitAssignment(单位分配) 提供数据集使用的默认单位,
- 由单个以下实体提供的项目基本空间结构: IfcBuilding(建筑) 及引用实体:
- IfcLocalPlacement(局部定位) 用于创建建筑物的局部对象坐标系——它作为建筑物内所有对象的父坐标系;
- IfcRelAggregates(聚合关系) 用于将 IfcBuilding(建筑) to the IfcProject(项目) 链接为项目空间结构的最上层项,
- 由单个以下实体提供形状表示的代理元素: IfcBuildingElementProxy(建筑构件代理) 及引用实体:
- IfcLocalPlacement(局部定位) 用于创建代理相对于建筑物对象坐标系的局部对象坐标系;
- IfcProductDefinitionShape(产品定义形状) 用于在局部对象坐标系中定义几何形状。

同一方块几何可使用不同的三维模型来表达。示例 IFC 文件介绍了扫掠实体模型、表面模型、边界表示模型、构造实体几何模型和细分曲面模型。
可使用构造实体几何模型来表达方块几何,将其表示为CSG基本体。

IFC-SPF 源代码(IFC-SPF source)
ISO-10303-21;
HEADER;
/* NOTE a valid model view name has to be asserted, replacing 'notYetAssigned' ----------------- */
FILE_DESCRIPTION(
( 'ViewDefinition [notYetAssigned]'
,'Comment [manual creation of example file]'
)
,'2;1');
/* NOTE standard header information according to GB/T 16656.21 ---------------------------------- */
FILE_NAME(
'csg-primitive.ifc',
'2012-06-15T18:00:00',
('redacted'),
('redacted'),
'redacted',
'redacted',
'reference file created for the IFC4 specification');
FILE_SCHEMA(('IFC4X3_ADD2'));
ENDSEC;
DATA;
/* --------------------------------------------------------------------------------------------- */
/* general entities required for all IFC data sets, defining the context for the exchange ------ */
#100= IFCPROJECT('0xScRe4drECQ4DMSqUjd6d',#110,'proxy with CSG',$,$,$,$,(#201),#301);
/* single owner history sufficient if not otherwise required by the view definition ------------ */
/* provides the person and application creating the data set, and the time it is created ------- */
#110= IFCOWNERHISTORY(#111,#115,$,.ADDED.,1320688800,$,$,1320688800);
#111= IFCPERSONANDORGANIZATION(#112,#113,$);
#112= IFCPERSON($,'redacted','redacted',$,$,$,$,$);
#113= IFCORGANIZATION($,'redacted',$,$,$);
#115= IFCAPPLICATION(#113,'redacted','redacted','redacted');
/* each IFC data set containing geometry has to define a geometric representation context ------ */
/* the attribute 'ContextType' has to be 'Model' for 3D model geometry ------------------------- */
#201= IFCGEOMETRICREPRESENTATIONCONTEXT($,'Model',3,1.0E-5,#210,$);
/* the attribute 'ContextIdentifier' has to be 'Body' for the main 3D shape representation ----- */
#202= IFCGEOMETRICREPRESENTATIONSUBCONTEXT('Body','Model',*,*,*,*,#201,$,.MODEL_VIEW.,$);
#210= IFCAXIS2PLACEMENT3D(#901,$,$);
/* each IFC data set containing geometry has to define at absolute minimum length and angle ---- */
/* here length is milli metre as SI unit, and plane angle is 'degree' as non SI unit ----------- */
#301= IFCUNITASSIGNMENT((#311,#312));
#311= IFCSIUNIT(*,.LENGTHUNIT.,.MILLI.,.METRE.);
#312= IFCCONVERSIONBASEDUNIT(#313,.PLANEANGLEUNIT.,'degree',#314);
#313= IFCDIMENSIONALEXPONENTS(0,0,0,0,0,0,0);
#314= IFCMEASUREWITHUNIT(IFCPLANEANGLEMEASURE(0.017453293),#315);
#315= IFCSIUNIT(*,.PLANEANGLEUNIT.,$,.RADIAN.);
/* each IFC data set containing elements in a building context has to include a building ------- */
/* at absolute minimum (could have a site and stories as well) --------------------------------- */
#500= IFCBUILDING('2FCZDorxHDT8NI01kdXi8P',$,'Test Building',$,$,#511,$,$,.ELEMENT.,$,$,$);
/* if the building is the uppermost spatial structure element it defines the absolut position -- */
#511= IFCLOCALPLACEMENT($,#512);
/* no rotation - z and x axes set to '$' are therefore identical to "world coordinate system" -- */
#512= IFCAXIS2PLACEMENT3D(#901,$,$);
/* if the building is the uppermost spatial structure element it is assigned to the project ---- */
#519= IFCRELAGGREGATES('2YBqaV_8L15eWJ9DA1sGmT',$,$,$,#100,(#500));
/* shared coordinates - it is permissable to share common instances to reduce file size -------- */
#901= IFCCARTESIANPOINT((0.,0.,0.));
#902= IFCDIRECTION((1.,0.,0.));
#903= IFCDIRECTION((0.,1.,0.));
#904= IFCDIRECTION((0.,0.,1.));
#905= IFCDIRECTION((-1.,0.,0.));
#906= IFCDIRECTION((0.,-1.,0.));
#907= IFCDIRECTION((0.,0.,-1.));
/* --------------------------------------------------------------------------------------------- */
/* proxy element with CSG shape representation, assigned to the building ----------------------- */
#1000= IFCBUILDINGELEMENTPROXY('1kTvXnbbzCWw8lcMd1dR4o',$,'P-1','sample CSG',$,#1001,#1010,$,$);
/* proxy element placement relative to the building -------------------------------------------- */
#1001= IFCLOCALPLACEMENT(#511,#1002);
/* set local placement to 1 meter on x-axis, and 0 on y, and 0 on z axes ----------------------- */
/* no rotation - z and x axes set to '$' are therefore identical to those of building ---------- */
#1002= IFCAXIS2PLACEMENT3D(#1003,$,$);
#1003= IFCCARTESIANPOINT((1000.,0.,0.));
/* proxy element shape representation ---------------------------------------------------------- */
#1010= IFCPRODUCTDEFINITIONSHAPE($,$,(#1020));
/* a single shape representation of type 'CSG' is included ------------------------------------- */
#1020= IFCSHAPEREPRESENTATION(#202,'Body','CSG',(#1021));
/* CSG representation consisting of a single primitive ---------------------------------------- */
/* box, 1m width, 1m depth, 2m height ---------------------------------------------------------- */
#1021= IFCCSGSOLID(#1022);
#1022= IFCBLOCK(#1023,1000.,1000.,2000.);
#1023= IFCAXIS2PLACEMENT3D(#1024,$,$);
#1024= IFCCARTESIANPOINT((-500.,-500.,0.));
/* proxy element assigned to the building ------------------------------------------------------ */
#10000=IFCRELCONTAINEDINSPATIALSTRUCTURE('2TnxZkTXT08eDuMuhUUFNy',$,'Physical model',$,(#1000),#500);
ENDSEC;
END-ISO-10303-21;