Class TIfcPersistent

Unit

Declaration

type TIfcPersistent = class abstract(TComponent)

Description

Abstract class that can be serialized to / deserialized from an IFC file. This is not part of the official IFC standard, it is added for CGE purposes.

It is a TComponent, because all IFC classes are owned by a common owner. This way we avoid complicated memory management ("who is responsible for freeing who", or reference counting as we did for X3D nodes), and we can easily free all IFC classes by freeing the owner.

Hierarchy

  • TObject
  • TPersistent
  • TComponent
  • TIfcPersistent

Overview

Methods

Protected function WantsGlobalId: Boolean; virtual;

Properties

Published property GlobalId: String read FGlobalId write FGlobalId;

Description

Methods

Protected function WantsGlobalId: Boolean; virtual;

If True, instances of this class will have GlobalId auto-assigned at saving, and they will be saved as part of the "data" list in IFC JSON files.

Strictly following the spec, this should be only defined for TIfcRoot, because only IfcRoot has GlobalId. In reality, we need GlobalId at TIfcPersistent to load some files, and we sometimes need WantsGlobalId = True to save some files.

Properties

Published property GlobalId: String read FGlobalId write FGlobalId;

Globally unique identifier for the object instance.

Note: Not declared as TGUID, because TGUID cannot be published, but also we don't really need it: for our purposes, this identifier is just an arbitrary string.

Note: IFC 4.3 specification puts this only at IfcRoot, not at every IFC class. But testcase https://github.com/buildingsmart-community/Community-Sample-Test-Files/blob/main/IFC%204.0.2.1%20(IFC%204)/ISO%20Spec%20archive/wall-with-opening-and-window.json (from IFC 4.0) shows this can be present at any IFC class, in particular TIfcGeometricRepresentationContext.

In fact, TIfcGeometricRepresentationContext needs to have GlobalId to be successfully saved (avoid recursively trying to serialize it) in some cases. We indicate such classes with WantsGlobalId.

IFC JSON documentation says this, which seems to (unfortunately it is not unambiguous enough...) allow this at any IFC class: "Whereas the globalId attribute is only available to those elements that are descendent of the IfcRoot entity in the EXPRESS schema, we encourage a broader use of this globalId, to enable referencing between objects in a JSON file when useful.".


Generated by PasDoc 0.16.0-snapshot.