# Class ModelProductClass

Represents class (IfcWindow, IfcWall etc) There is one instance of this class for each unique IFC class. Therefore reference equality can be used to compare instances.

#### Example

```typescript` ModelProductClass.getOrAdd("IfcWindow") === ModelProductClass.predefined.window; // true ModelProductClass.ifcBuildingStorey === ModelProductClass.getOrAdd("IfcBuildingStorey"); // true ``

##### Index

### Properties

id
objectCount
objectsWithGeometryCount
referencedDisciplinesSet
spatialRole
type
predefined

### Accessors

referencedDisciplines

### Methods

addReferencedClass
is
clearCache
getOrAdd
isValidId
parse
reset

## Properties

### `Readonly` id

id: string

### `Readonly` objectCount

objectCount: number

The number of BimIfcObject instances using this class.

### `Readonly` objectsWithGeometryCount

objectsWithGeometryCount: number

The number of instances where BimIfcObject.hasGeometry is true and using this class.

### `Readonly` referencedDisciplinesSet

referencedDisciplinesSet: DeepImmutable<Set<Discipline>>

The set of disciplines with ifcproducts that have references to this class.

### `Readonly` spatialRole

spatialRole: SpatialRole

### `Readonly` type

type:
| "beam"
| "covering"
| "furniture"
| "roof"
| "space"
| "other"
| "columns"
| "walls"
| "doors"
| "flow"
| "reinforcement"
| "floor"
| "stairs"
| "windows"
| "annotations"

### `Static` `Readonly` predefined

predefined: Readonly<Record<PredefinedClassIdWithoutPrefix, ModelProductClass>>

Represents all known IFC classes. These classes can be used with the is operator to check if an object belongs to a specific IFC class. They can also be used to create user interface lists or perform other operations related to IFC classes. However, to determine the actual classes in use for the currently loaded IFC files, refer to BimCoreApi.ifc.classes.

#### Example

    function checkIfBuildingStorey(o: BimIfcObject): boolean {
      return o.class.is(ModelProductClass.predefined.buildingStorey);
    }

## Accessors

### referencedDisciplines

- get referencedDisciplines(): DeepImmutableObject<Discipline>[]

  Gets an array of all disciplines with ifcproducts that have references to this class.

  #### Returns DeepImmutableObject<Discipline>[]

## Methods

### addReferencedClass

- addReferencedClass(discipline: Discipline): void

  Adds a referenced discipline to the set of referenced disciplines.

  #### Parameters

  - discipline: Discipline

    The discipline to add.

  #### Returns void

### is

- is(
  c:
  | ModelProductClass
  | "beam"
  | "covering"
  | "furniture"
  | "roof"
  | "space"
  | "other"
  | "columns"
  | "walls"
  | "doors"
  | "flow"
  | "reinforcement"
  | "floor"
  | "stairs"
  | "windows"
  | "annotations"
  | "IfcWindow"
  | "IfcPlate"
  | "IfcBuildingElementProxy"
  | "IfcActuator"
  | "IfcAirTerminal"
  | "IfcAirTerminalBox"
  | "IfcAirToAirHeatRecovery"
  | "IfcAlarm"
  | "IfcAlignment"
  | "IfcAlignmentCant"
  | "IfcAlignmentHorizontal"
  | "IfcAlignmentSegment"
  | "IfcAlignmentVertical"
  | "IfcAnnotation"
  | "IfcAudioVisualAppliance"
  | "IfcBeam"
  | "IfcBeamStandardCase"
  | "IfcBearing"
  | "IfcBoiler"
  | "IfcBorehole"
  | "IfcBridge"
  | "IfcBridgePart"
  | "IfcBuilding"
  | "IfcBuildingElementPart"
  | "IfcBuildingStorey"
  | "IfcBuiltElement"
  | "IfcBurner"
  | "IfcCableCarrierFitting"
  | "IfcCableCarrierSegment"
  | "IfcCableFitting"
  | "IfcCableSegment"
  | "IfcCaissonFoundation"
  | "IfcChamferEdgeFeature"
  | "IfcChiller"
  | "IfcChimney"
  | "IfcCivilElement"
  | "IfcCoil"
  | "IfcColumn"
  | "IfcColumnStandardCase"
  | "IfcCommunicationsAppliance"
  | "IfcCompressor"
  | "IfcCondenser"
  | "IfcController"
  | "IfcConveyorSegment"
  | "IfcCooledBeam"
  | "IfcCoolingTower"
  | "IfcCourse"
  | "IfcCovering"
  | "IfcCurtainWall"
  | "IfcDamper"
  | "IfcDeepFoundation"
  | "IfcDiscreteAccessory"
  | "IfcDistributionBoard"
  | "IfcDistributionChamberElement"
  | "IfcDistributionControlElement"
  | "IfcDistributionElement"
  | "IfcDistributionFlowElement"
  | "IfcDistributionPort"
  | "IfcDoor"
  | "IfcDoorStandardCase"
  | "IfcDuctFitting"
  | "IfcDuctSegment"
  | "IfcDuctSilencer"
  | "IfcEarthworksCut"
  | "IfcEarthworksElement"
  | "IfcEarthworksFill"
  | "IfcElectricalElement"
  | "IfcElectricAppliance"
  | "IfcElectricDistributionBoard"
  | "IfcElectricDistributionPoint"
  | "IfcElectricFlowStorageDevice"
  | "IfcElectricFlowTreatmentDevice"
  | "IfcElectricGenerator"
  | "IfcElectricMotor"
  | "IfcElectricTimeControl"
  | "IfcElementAssembly"
  | "IfcEnergyConversionDevice"
  | "IfcEngine"
  | "IfcEquipmentElement"
  | "IfcEvaporativeCooler"
  | "IfcEvaporator"
  | "IfcExternalSpatialElement"
  | "IfcFacility"
  | "IfcFacilityPartCommon"
  | "IfcFan"
  | "IfcFastener"
  | "IfcFilter"
  | "IfcFireSuppressionTerminal"
  | "IfcFlowController"
  | "IfcFlowFitting"
  | "IfcFlowInstrument"
  | "IfcFlowMeter"
  | "IfcFlowMovingDevice"
  | "IfcFlowSegment"
  | "IfcFlowStorageDevice"
  | "IfcFlowTerminal"
  | "IfcFlowTreatmentDevice"
  | "IfcFooting"
  | "IfcFurnishingElement"
  | "IfcFurniture"
  | "IfcGeographicElement"
  | "IfcGeomodel"
  | "IfcGeoslice"
  | "IfcGeotechnicalStratum"
  | "IfcGrid"
  | "IfcHeatExchanger"
  | "IfcHumidifier"
  | "IfcImpactProtectionDevice"
  | "IfcInterceptor"
  | "IfcJunctionBox"
  | "IfcKerb"
  | "IfcLamp"
  | "IfcLightFixture"
  | "IfcLinearElement"
  | "IfcLinearPositioningElement"
  | "IfcLiquidTerminal"
  | "IfcMarineFacility"
  | "IfcMarinePart"
  | "IfcMechanicalFastener"
  | "IfcMedicalDevice"
  | "IfcMember"
  | "IfcMemberStandardCase"
  | "IfcMobileTelecommunicationsAppliance"
  | "IfcMooringDevice"
  | "IfcMotorConnection"
  | "IfcNavigationElement"
  | "IfcOpeningElement"
  | "IfcOpeningStandardCase"
  | "IfcOutlet"
  | "IfcPavement"
  | "IfcPile"
  | "IfcPipeFitting"
  | "IfcPipeSegment"
  | "IfcPlateStandardCase"
  | "IfcProject"
  | "IfcProjectionElement"
  | "IfcProtectiveDevice"
  | "IfcProtectiveDeviceTrippingUnit"
  | "IfcProxy"
  | "IfcPump"
  | "IfcRail"
  | "IfcRailing"
  | "IfcRailway"
  | "IfcRailwayPart"
  | "IfcRamp"
  | "IfcRampFlight"
  | "IfcReferent"
  | "IfcReinforcedSoil"
  | "IfcReinforcingBar"
  | "IfcReinforcingMesh"
  | "IfcRoad"
  | "IfcRoadPart"
  | "IfcRoof"
  | "IfcRoundedEdgeFeature"
  | "IfcSanitaryTerminal"
  | "IfcSensor"
  | "IfcShadingDevice"
  | "IfcSign"
  | "IfcSignal"
  | "IfcSite"
  | "IfcSlab"
  | "IfcSlabElementedCase"
  | "IfcSlabStandardCase"
  | "IfcSolarDevice"
  | "IfcSpace"
  | "IfcSpaceHeater"
  | "IfcSpatialZone"
  | "IfcStackTerminal"
  | "IfcStair"
  | "IfcStairFlight"
  | "IfcStructuralCurveAction"
  | "IfcStructuralCurveConnection"
  | "IfcStructuralCurveMember"
  | "IfcStructuralCurveMemberVarying"
  | "IfcStructuralCurveReaction"
  | "IfcStructuralLinearAction"
  | "IfcStructuralLinearActionVarying"
  | "IfcStructuralPlanarAction"
  | "IfcStructuralPlanarActionVarying"
  | "IfcStructuralPointAction"
  | "IfcStructuralPointConnection"
  | "IfcStructuralPointReaction"
  | "IfcStructuralSurfaceAction"
  | "IfcStructuralSurfaceConnection"
  | "IfcStructuralSurfaceMember"
  | "IfcStructuralSurfaceMemberVarying"
  | "IfcStructuralSurfaceReaction"
  | "IfcSurfaceFeature"
  | "IfcSwitchingDevice"
  | "IfcSystemFurnitureElement"
  | "IfcTank"
  | "IfcTendon"
  | "IfcTendonAnchor"
  | "IfcTendonConduit"
  | "IfcTrackElement"
  | "IfcTransformer"
  | "IfcTransportElement"
  | "IfcTubeBundle"
  | "IfcUnitaryControlElement"
  | "IfcUnitaryEquipment"
  | "IfcUnknown"
  | "IfcValve"
  | "IfcVehicle"
  | "IfcVibrationDamper"
  | "IfcVibrationIsolator"
  | "IfcVirtualElement"
  | "IfcVoidingFeature"
  | "IfcWall"
  | "IfcWallElementedCase"
  | "IfcWallStandardCase"
  | "IfcWasteTerminal"
  | "IfcWindowStandardCase",
  ): boolean

  Checks if the current instance is of the specified class (ModelProductClass, PredefinedIfcClassId) or type (ModelProductClassType).

  #### Parameters

  - c:
    | ModelProductClass
    | "beam"
    | "covering"
    | "furniture"
    | "roof"
    | "space"
    | "other"
    | "columns"
    | "walls"
    | "doors"
    | "flow"
    | "reinforcement"
    | "floor"
    | "stairs"
    | "windows"
    | "annotations"
    | "IfcWindow"
    | "IfcPlate"
    | "IfcBuildingElementProxy"
    | "IfcActuator"
    | "IfcAirTerminal"
    | "IfcAirTerminalBox"
    | "IfcAirToAirHeatRecovery"
    | "IfcAlarm"
    | "IfcAlignment"
    | "IfcAlignmentCant"
    | "IfcAlignmentHorizontal"
    | "IfcAlignmentSegment"
    | "IfcAlignmentVertical"
    | "IfcAnnotation"
    | "IfcAudioVisualAppliance"
    | "IfcBeam"
    | "IfcBeamStandardCase"
    | "IfcBearing"
    | "IfcBoiler"
    | "IfcBorehole"
    | "IfcBridge"
    | "IfcBridgePart"
    | "IfcBuilding"
    | "IfcBuildingElementPart"
    | "IfcBuildingStorey"
    | "IfcBuiltElement"
    | "IfcBurner"
    | "IfcCableCarrierFitting"
    | "IfcCableCarrierSegment"
    | "IfcCableFitting"
    | "IfcCableSegment"
    | "IfcCaissonFoundation"
    | "IfcChamferEdgeFeature"
    | "IfcChiller"
    | "IfcChimney"
    | "IfcCivilElement"
    | "IfcCoil"
    | "IfcColumn"
    | "IfcColumnStandardCase"
    | "IfcCommunicationsAppliance"
    | "IfcCompressor"
    | "IfcCondenser"
    | "IfcController"
    | "IfcConveyorSegment"
    | "IfcCooledBeam"
    | "IfcCoolingTower"
    | "IfcCourse"
    | "IfcCovering"
    | "IfcCurtainWall"
    | "IfcDamper"
    | "IfcDeepFoundation"
    | "IfcDiscreteAccessory"
    | "IfcDistributionBoard"
    | "IfcDistributionChamberElement"
    | "IfcDistributionControlElement"
    | "IfcDistributionElement"
    | "IfcDistributionFlowElement"
    | "IfcDistributionPort"
    | "IfcDoor"
    | "IfcDoorStandardCase"
    | "IfcDuctFitting"
    | "IfcDuctSegment"
    | "IfcDuctSilencer"
    | "IfcEarthworksCut"
    | "IfcEarthworksElement"
    | "IfcEarthworksFill"
    | "IfcElectricalElement"
    | "IfcElectricAppliance"
    | "IfcElectricDistributionBoard"
    | "IfcElectricDistributionPoint"
    | "IfcElectricFlowStorageDevice"
    | "IfcElectricFlowTreatmentDevice"
    | "IfcElectricGenerator"
    | "IfcElectricMotor"
    | "IfcElectricTimeControl"
    | "IfcElementAssembly"
    | "IfcEnergyConversionDevice"
    | "IfcEngine"
    | "IfcEquipmentElement"
    | "IfcEvaporativeCooler"
    | "IfcEvaporator"
    | "IfcExternalSpatialElement"
    | "IfcFacility"
    | "IfcFacilityPartCommon"
    | "IfcFan"
    | "IfcFastener"
    | "IfcFilter"
    | "IfcFireSuppressionTerminal"
    | "IfcFlowController"
    | "IfcFlowFitting"
    | "IfcFlowInstrument"
    | "IfcFlowMeter"
    | "IfcFlowMovingDevice"
    | "IfcFlowSegment"
    | "IfcFlowStorageDevice"
    | "IfcFlowTerminal"
    | "IfcFlowTreatmentDevice"
    | "IfcFooting"
    | "IfcFurnishingElement"
    | "IfcFurniture"
    | "IfcGeographicElement"
    | "IfcGeomodel"
    | "IfcGeoslice"
    | "IfcGeotechnicalStratum"
    | "IfcGrid"
    | "IfcHeatExchanger"
    | "IfcHumidifier"
    | "IfcImpactProtectionDevice"
    | "IfcInterceptor"
    | "IfcJunctionBox"
    | "IfcKerb"
    | "IfcLamp"
    | "IfcLightFixture"
    | "IfcLinearElement"
    | "IfcLinearPositioningElement"
    | "IfcLiquidTerminal"
    | "IfcMarineFacility"
    | "IfcMarinePart"
    | "IfcMechanicalFastener"
    | "IfcMedicalDevice"
    | "IfcMember"
    | "IfcMemberStandardCase"
    | "IfcMobileTelecommunicationsAppliance"
    | "IfcMooringDevice"
    | "IfcMotorConnection"
    | "IfcNavigationElement"
    | "IfcOpeningElement"
    | "IfcOpeningStandardCase"
    | "IfcOutlet"
    | "IfcPavement"
    | "IfcPile"
    | "IfcPipeFitting"
    | "IfcPipeSegment"
    | "IfcPlateStandardCase"
    | "IfcProject"
    | "IfcProjectionElement"
    | "IfcProtectiveDevice"
    | "IfcProtectiveDeviceTrippingUnit"
    | "IfcProxy"
    | "IfcPump"
    | "IfcRail"
    | "IfcRailing"
    | "IfcRailway"
    | "IfcRailwayPart"
    | "IfcRamp"
    | "IfcRampFlight"
    | "IfcReferent"
    | "IfcReinforcedSoil"
    | "IfcReinforcingBar"
    | "IfcReinforcingMesh"
    | "IfcRoad"
    | "IfcRoadPart"
    | "IfcRoof"
    | "IfcRoundedEdgeFeature"
    | "IfcSanitaryTerminal"
    | "IfcSensor"
    | "IfcShadingDevice"
    | "IfcSign"
    | "IfcSignal"
    | "IfcSite"
    | "IfcSlab"
    | "IfcSlabElementedCase"
    | "IfcSlabStandardCase"
    | "IfcSolarDevice"
    | "IfcSpace"
    | "IfcSpaceHeater"
    | "IfcSpatialZone"
    | "IfcStackTerminal"
    | "IfcStair"
    | "IfcStairFlight"
    | "IfcStructuralCurveAction"
    | "IfcStructuralCurveConnection"
    | "IfcStructuralCurveMember"
    | "IfcStructuralCurveMemberVarying"
    | "IfcStructuralCurveReaction"
    | "IfcStructuralLinearAction"
    | "IfcStructuralLinearActionVarying"
    | "IfcStructuralPlanarAction"
    | "IfcStructuralPlanarActionVarying"
    | "IfcStructuralPointAction"
    | "IfcStructuralPointConnection"
    | "IfcStructuralPointReaction"
    | "IfcStructuralSurfaceAction"
    | "IfcStructuralSurfaceConnection"
    | "IfcStructuralSurfaceMember"
    | "IfcStructuralSurfaceMemberVarying"
    | "IfcStructuralSurfaceReaction"
    | "IfcSurfaceFeature"
    | "IfcSwitchingDevice"
    | "IfcSystemFurnitureElement"
    | "IfcTank"
    | "IfcTendon"
    | "IfcTendonAnchor"
    | "IfcTendonConduit"
    | "IfcTrackElement"
    | "IfcTransformer"
    | "IfcTransportElement"
    | "IfcTubeBundle"
    | "IfcUnitaryControlElement"
    | "IfcUnitaryEquipment"
    | "IfcUnknown"
    | "IfcValve"
    | "IfcVehicle"
    | "IfcVibrationDamper"
    | "IfcVibrationIsolator"
    | "IfcVirtualElement"
    | "IfcVoidingFeature"
    | "IfcWall"
    | "IfcWallElementedCase"
    | "IfcWallStandardCase"
    | "IfcWasteTerminal"
    | "IfcWindowStandardCase"

    The class or type to check against.

  #### Returns boolean

  `true` if the current instance is of the specified class or type, `false` otherwise.

  #### Remarks

  If you wish to peform the check with a string and it might not be one of the PredefinedIfcClassId. Then you can always fall back to comparing against id directly. However remember that such a comparison is case sensitive.

  #### Example

      // Fastest
      function checkIfBuildingStorey(o: BimIfcObject): boolean {
        return o.class.is(ModelProductClass.predefined.buildingStorey);
      }
      // Fast. Check if type/category is 'walls' (IfcClassType)
      function checkIfWallsType(o: BimIfcObject): boolean {
        return o.class.is('walls');
      }

      // Slowest but still fast enough for many use cases
       function checkIfBuildingStorey(o: BimIfcObject): boolean {
        return o.class.is('IfcBuildingStorey'); // Compare using PredefinedIfcClassId
      }

### `Static` clearCache

- clearCache(): void

  Clears the internal instance cache. After calling this, subsequent calls to getOrAdd will create new instances. Existing references to previously cached instances remain valid but will no longer be returned by getOrAdd.

  Use this in server-side scenarios where multiple models are processed sequentially to prevent unbounded cache growth.

  #### Returns void

### `Static` getOrAdd

- getOrAdd(id: string): ModelProductClass

  Retrieves an instance of ModelProductClass based on the provided `id`. Lookup is case insensitive. Given the same id then the same instance is always returned. The instance is cached and reused up until reset after that new instances are created, cached and reused, until the next call to reset etc. If the instance does not exist in the cache, a new instance is created and added to the cache.

  #### Parameters

  - id: string

    The id of the ModelProductClass to retrieve or add to the cache. The id is case insensitive.

  #### Returns ModelProductClass

  The ModelProductClass instance associated with the provided `id`.

  #### Throws

  Error if the provided `id` is not a valid class id on the format (IfcXxx).

### `Static` isValidId

- isValidId(id: string): boolean

  Checks if the given string looks like valid ID for a class (format is IfcXxx).

  #### Parameters

  - id: string

    The string to check.

  #### Returns boolean

  `true` if the string is a valid class ID, `false` otherwise.

### `Static` parse

- parse(id: string): ModelProductClass

  Parse a id string and retrieves the corresponding ModelProductClass instance. Parsing is case insensitive. Given the same id then the same instance is always returned. The instance is cached and reused up until reset after that new instances are created, cached and reused, until the next call to reset etc. If the instance does not exist in the cache, a new instance is created and added to the cache.

  #### Parameters

  - id: string

    The id of the ModelProductClass to retrieve or add to the cache. The id is case insensitive.

  #### Returns ModelProductClass

  The ModelProductClass instance associated with the provided `id`.

  #### Throws

  Error if the provided `id` is not a valid class id on the format (IfcXxx).

### `Static` reset

- reset(): void

  Resets to the original state. referencedDisciplinesSet is cleared. objectCount and objectsWithGeometryCount are set to 0.

  #### Returns void