@margoengine/ifc 0.0.0-stage → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,51 @@
1
+ //#region src/schema-tree.ts
2
+ var e = /* @__PURE__ */ new Map();
3
+ function t(t) {
4
+ let n = t.toUpperCase().startsWith("IFC4X3") ? "IFC4X3" : "IFC4", r = e.get(n);
5
+ if (r) return r;
6
+ let i = /* @__PURE__ */ new Map([["IFCOBJECTDEFINITION", {
7
+ name: "IfcObjectDefinition",
8
+ children: []
9
+ }]]);
10
+ for (let e of (n === "IFC4X3" ? "ObjectDefinition:Context,Object,TypeObject Context:Project,ProjectLibrary Object:Actor,Control,Group,Process,Product,Resource TypeObject:TypeProcess,TypeProduct,TypeResource Actor:Occupant Control:ActionRequest,CostItem,CostSchedule,PerformanceHistory,Permit,ProjectOrder,WorkCalendar,WorkControl Group:Asset,Inventory,StructuralLoadGroup,StructuralResultGroup,System Process:Event,Procedure,Task Product:Annotation,Element,LinearElement,Port,PositioningElement,SpatialElement,StructuralActivity,StructuralItem Resource:ConstructionResource TypeProcess:EventType,ProcedureType,TaskType TypeProduct:ElementType,SpatialElementType TypeResource:ConstructionResourceType WorkControl:WorkPlan,WorkSchedule StructuralLoadGroup:StructuralLoadCase System:BuildingSystem,BuiltSystem,DistributionSystem,StructuralAnalysisModel,Zone Element:BuiltElement,CivilElement,DistributionElement,ElementAssembly,ElementComponent,FeatureElement,FurnishingElement,GeographicElement,GeotechnicalElement,TransportationDevice,VirtualElement LinearElement:AlignmentCant,AlignmentHorizontal,AlignmentSegment,AlignmentVertical Port:DistributionPort PositioningElement:Grid,LinearPositioningElement,Referent SpatialElement:ExternalSpatialStructureElement,SpatialStructureElement,SpatialZone StructuralActivity:StructuralAction,StructuralReaction StructuralItem:StructuralConnection,StructuralMember ConstructionResource:ConstructionEquipmentResource,ConstructionMaterialResource,ConstructionProductResource,CrewResource,LaborResource,SubContractResource ElementType:BuiltElementType,CivilElementType,DistributionElementType,ElementAssemblyType,ElementComponentType,FurnishingElementType,GeographicElementType,TransportationDeviceType SpatialElementType:SpatialStructureElementType,SpatialZoneType ConstructionResourceType:ConstructionEquipmentResourceType,ConstructionMaterialResourceType,ConstructionProductResourceType,CrewResourceType,LaborResourceType,SubContractResourceType DistributionSystem:DistributionCircuit BuiltElement:Beam,Bearing,BuildingElementProxy,Chimney,Column,Course,Covering,CurtainWall,DeepFoundation,Door,EarthworksElement,Footing,Kerb,Member,MooringDevice,NavigationElement,Pavement,Plate,Rail,Railing,Ramp,RampFlight,Roof,ShadingDevice,Slab,Stair,StairFlight,TrackElement,Wall,Window DistributionElement:DistributionControlElement,DistributionFlowElement ElementComponent:BuildingElementPart,DiscreteAccessory,Fastener,ImpactProtectionDevice,MechanicalFastener,ReinforcingElement,Sign,VibrationDamper,VibrationIsolator FeatureElement:FeatureElementAddition,FeatureElementSubtraction,SurfaceFeature FurnishingElement:Furniture,SystemFurnitureElement GeotechnicalElement:GeotechnicalAssembly,GeotechnicalStratum TransportationDevice:TransportElement,Vehicle LinearPositioningElement:Alignment ExternalSpatialStructureElement:ExternalSpatialElement SpatialStructureElement:BuildingStorey,Facility,FacilityPart,Site,Space StructuralAction:StructuralCurveAction,StructuralPointAction,StructuralSurfaceAction StructuralReaction:StructuralCurveReaction,StructuralPointReaction,StructuralSurfaceReaction StructuralConnection:StructuralCurveConnection,StructuralPointConnection,StructuralSurfaceConnection StructuralMember:StructuralCurveMember,StructuralSurfaceMember BuiltElementType:BeamType,BearingType,BuildingElementProxyType,ChimneyType,ColumnType,CourseType,CoveringType,CurtainWallType,DeepFoundationType,DoorType,FootingType,KerbType,MemberType,MooringDeviceType,NavigationElementType,PavementType,PlateType,RailType,RailingType,RampFlightType,RampType,RoofType,ShadingDeviceType,SlabType,StairFlightType,StairType,TrackElementType,WallType,WindowType DistributionElementType:DistributionControlElementType,DistributionFlowElementType ElementComponentType:BuildingElementPartType,DiscreteAccessoryType,FastenerType,ImpactProtectionDeviceType,MechanicalFastenerType,ReinforcingElementType,SignType,VibrationDamperType,VibrationIsolatorType FurnishingElementType:FurnitureType,SystemFurnitureElementType TransportationDeviceType:TransportElementType,VehicleType SpatialStructureElementType:SpaceType DeepFoundation:CaissonFoundation,Pile EarthworksElement:EarthworksFill,ReinforcedSoil Wall:WallStandardCase DistributionControlElement:Actuator,Alarm,Controller,FlowInstrument,ProtectiveDeviceTrippingUnit,Sensor,UnitaryControlElement DistributionFlowElement:DistributionChamberElement,EnergyConversionDevice,FlowController,FlowFitting,FlowMovingDevice,FlowSegment,FlowStorageDevice,FlowTerminal,FlowTreatmentDevice ReinforcingElement:ReinforcingBar,ReinforcingMesh,Tendon,TendonAnchor,TendonConduit FeatureElementAddition:ProjectionElement FeatureElementSubtraction:EarthworksCut,OpeningElement,VoidingFeature GeotechnicalAssembly:Borehole,Geomodel,Geoslice Facility:Bridge,Building,MarineFacility,Railway,Road FacilityPart:BridgePart,FacilityPartCommon,MarinePart,RailwayPart,RoadPart StructuralCurveAction:StructuralLinearAction StructuralSurfaceAction:StructuralPlanarAction StructuralCurveMember:StructuralCurveMemberVarying StructuralSurfaceMember:StructuralSurfaceMemberVarying DeepFoundationType:CaissonFoundationType,PileType DistributionControlElementType:ActuatorType,AlarmType,ControllerType,FlowInstrumentType,ProtectiveDeviceTrippingUnitType,SensorType,UnitaryControlElementType DistributionFlowElementType:DistributionChamberElementType,EnergyConversionDeviceType,FlowControllerType,FlowFittingType,FlowMovingDeviceType,FlowSegmentType,FlowStorageDeviceType,FlowTerminalType,FlowTreatmentDeviceType ReinforcingElementType:ReinforcingBarType,ReinforcingMeshType,TendonAnchorType,TendonConduitType,TendonType EnergyConversionDevice:AirToAirHeatRecovery,Boiler,Burner,Chiller,Coil,Condenser,CooledBeam,CoolingTower,ElectricGenerator,ElectricMotor,Engine,EvaporativeCooler,Evaporator,HeatExchanger,Humidifier,MotorConnection,SolarDevice,Transformer,TubeBundle,UnitaryEquipment FlowController:AirTerminalBox,Damper,DistributionBoard,ElectricDistributionBoard,ElectricTimeControl,FlowMeter,ProtectiveDevice,SwitchingDevice,Valve FlowFitting:CableCarrierFitting,CableFitting,DuctFitting,JunctionBox,PipeFitting FlowMovingDevice:Compressor,Fan,Pump FlowSegment:CableCarrierSegment,CableSegment,ConveyorSegment,DuctSegment,PipeSegment FlowStorageDevice:ElectricFlowStorageDevice,Tank FlowTerminal:AirTerminal,AudioVisualAppliance,CommunicationsAppliance,ElectricAppliance,FireSuppressionTerminal,Lamp,LightFixture,LiquidTerminal,MedicalDevice,MobileTelecommunicationsAppliance,Outlet,SanitaryTerminal,Signal,SpaceHeater,StackTerminal,WasteTerminal FlowTreatmentDevice:DuctSilencer,ElectricFlowTreatmentDevice,Filter,Interceptor EnergyConversionDeviceType:AirToAirHeatRecoveryType,BoilerType,BurnerType,ChillerType,CoilType,CondenserType,CooledBeamType,CoolingTowerType,ElectricGeneratorType,ElectricMotorType,EngineType,EvaporativeCoolerType,EvaporatorType,HeatExchangerType,HumidifierType,MotorConnectionType,SolarDeviceType,TransformerType,TubeBundleType,UnitaryEquipmentType FlowControllerType:AirTerminalBoxType,DamperType,DistributionBoardType,ElectricDistributionBoardType,ElectricTimeControlType,FlowMeterType,ProtectiveDeviceType,SwitchingDeviceType,ValveType FlowFittingType:CableCarrierFittingType,CableFittingType,DuctFittingType,JunctionBoxType,PipeFittingType FlowMovingDeviceType:CompressorType,FanType,PumpType FlowSegmentType:CableCarrierSegmentType,CableSegmentType,ConveyorSegmentType,DuctSegmentType,PipeSegmentType FlowStorageDeviceType:ElectricFlowStorageDeviceType,TankType FlowTerminalType:AirTerminalType,AudioVisualApplianceType,CommunicationsApplianceType,ElectricApplianceType,FireSuppressionTerminalType,LampType,LightFixtureType,LiquidTerminalType,MedicalDeviceType,MobileTelecommunicationsApplianceType,OutletType,SanitaryTerminalType,SignalType,SpaceHeaterType,StackTerminalType,WasteTerminalType FlowTreatmentDeviceType:DuctSilencerType,ElectricFlowTreatmentDeviceType,FilterType,InterceptorType" : "ObjectDefinition:Context,Object,TypeObject Context:Project,ProjectLibrary Object:Actor,Control,Group,Process,Product,Resource TypeObject:TypeProcess,TypeProduct,TypeResource Actor:Occupant Control:ActionRequest,CostItem,CostSchedule,PerformanceHistory,Permit,ProjectOrder,WorkCalendar,WorkControl Group:Asset,Inventory,StructuralLoadGroup,StructuralResultGroup,System Process:Event,Procedure,Task Product:Annotation,Element,Grid,Port,Proxy,SpatialElement,StructuralActivity,StructuralItem Resource:ConstructionResource TypeProcess:EventType,ProcedureType,TaskType TypeProduct:DoorStyle,ElementType,SpatialElementType,WindowStyle TypeResource:ConstructionResourceType WorkControl:WorkPlan,WorkSchedule StructuralLoadGroup:StructuralLoadCase System:BuildingSystem,DistributionSystem,StructuralAnalysisModel,Zone Element:BuildingElement,CivilElement,DistributionElement,ElementAssembly,ElementComponent,FeatureElement,FurnishingElement,GeographicElement,TransportElement,VirtualElement Port:DistributionPort SpatialElement:ExternalSpatialStructureElement,SpatialStructureElement,SpatialZone StructuralActivity:StructuralAction,StructuralReaction StructuralItem:StructuralConnection,StructuralMember ConstructionResource:ConstructionEquipmentResource,ConstructionMaterialResource,ConstructionProductResource,CrewResource,LaborResource,SubContractResource ElementType:BuildingElementType,CivilElementType,DistributionElementType,ElementAssemblyType,ElementComponentType,FurnishingElementType,GeographicElementType,TransportElementType SpatialElementType:SpatialStructureElementType,SpatialZoneType ConstructionResourceType:ConstructionEquipmentResourceType,ConstructionMaterialResourceType,ConstructionProductResourceType,CrewResourceType,LaborResourceType,SubContractResourceType DistributionSystem:DistributionCircuit BuildingElement:Beam,BuildingElementProxy,Chimney,Column,Covering,CurtainWall,Door,Footing,Member,Pile,Plate,Railing,Ramp,RampFlight,Roof,ShadingDevice,Slab,Stair,StairFlight,Wall,Window DistributionElement:DistributionControlElement,DistributionFlowElement ElementComponent:BuildingElementPart,DiscreteAccessory,Fastener,MechanicalFastener,ReinforcingElement,VibrationIsolator FeatureElement:FeatureElementAddition,FeatureElementSubtraction,SurfaceFeature FurnishingElement:Furniture,SystemFurnitureElement ExternalSpatialStructureElement:ExternalSpatialElement SpatialStructureElement:Building,BuildingStorey,Site,Space StructuralAction:StructuralCurveAction,StructuralPointAction,StructuralSurfaceAction StructuralReaction:StructuralCurveReaction,StructuralPointReaction,StructuralSurfaceReaction StructuralConnection:StructuralCurveConnection,StructuralPointConnection,StructuralSurfaceConnection StructuralMember:StructuralCurveMember,StructuralSurfaceMember BuildingElementType:BeamType,BuildingElementProxyType,ChimneyType,ColumnType,CoveringType,CurtainWallType,DoorType,FootingType,MemberType,PileType,PlateType,RailingType,RampFlightType,RampType,RoofType,ShadingDeviceType,SlabType,StairFlightType,StairType,WallType,WindowType DistributionElementType:DistributionControlElementType,DistributionFlowElementType ElementComponentType:BuildingElementPartType,DiscreteAccessoryType,FastenerType,MechanicalFastenerType,ReinforcingElementType,VibrationIsolatorType FurnishingElementType:FurnitureType,SystemFurnitureElementType SpatialStructureElementType:SpaceType Beam:BeamStandardCase Column:ColumnStandardCase Door:DoorStandardCase Member:MemberStandardCase Plate:PlateStandardCase Slab:SlabElementedCase,SlabStandardCase Wall:WallElementedCase,WallStandardCase Window:WindowStandardCase DistributionControlElement:Actuator,Alarm,Controller,FlowInstrument,ProtectiveDeviceTrippingUnit,Sensor,UnitaryControlElement DistributionFlowElement:DistributionChamberElement,EnergyConversionDevice,FlowController,FlowFitting,FlowMovingDevice,FlowSegment,FlowStorageDevice,FlowTerminal,FlowTreatmentDevice ReinforcingElement:ReinforcingBar,ReinforcingMesh,Tendon,TendonAnchor FeatureElementAddition:ProjectionElement FeatureElementSubtraction:OpeningElement,VoidingFeature StructuralCurveAction:StructuralLinearAction StructuralSurfaceAction:StructuralPlanarAction StructuralCurveMember:StructuralCurveMemberVarying StructuralSurfaceMember:StructuralSurfaceMemberVarying DistributionControlElementType:ActuatorType,AlarmType,ControllerType,FlowInstrumentType,ProtectiveDeviceTrippingUnitType,SensorType,UnitaryControlElementType DistributionFlowElementType:DistributionChamberElementType,EnergyConversionDeviceType,FlowControllerType,FlowFittingType,FlowMovingDeviceType,FlowSegmentType,FlowStorageDeviceType,FlowTerminalType,FlowTreatmentDeviceType ReinforcingElementType:ReinforcingBarType,ReinforcingMeshType,TendonAnchorType,TendonType EnergyConversionDevice:AirToAirHeatRecovery,Boiler,Burner,Chiller,Coil,Condenser,CooledBeam,CoolingTower,ElectricGenerator,ElectricMotor,Engine,EvaporativeCooler,Evaporator,HeatExchanger,Humidifier,MotorConnection,SolarDevice,Transformer,TubeBundle,UnitaryEquipment FlowController:AirTerminalBox,Damper,ElectricDistributionBoard,ElectricTimeControl,FlowMeter,ProtectiveDevice,SwitchingDevice,Valve FlowFitting:CableCarrierFitting,CableFitting,DuctFitting,JunctionBox,PipeFitting FlowMovingDevice:Compressor,Fan,Pump FlowSegment:CableCarrierSegment,CableSegment,DuctSegment,PipeSegment FlowStorageDevice:ElectricFlowStorageDevice,Tank FlowTerminal:AirTerminal,AudioVisualAppliance,CommunicationsAppliance,ElectricAppliance,FireSuppressionTerminal,Lamp,LightFixture,MedicalDevice,Outlet,SanitaryTerminal,SpaceHeater,StackTerminal,WasteTerminal FlowTreatmentDevice:DuctSilencer,Filter,Interceptor OpeningElement:OpeningStandardCase EnergyConversionDeviceType:AirToAirHeatRecoveryType,BoilerType,BurnerType,ChillerType,CoilType,CondenserType,CooledBeamType,CoolingTowerType,ElectricGeneratorType,ElectricMotorType,EngineType,EvaporativeCoolerType,EvaporatorType,HeatExchangerType,HumidifierType,MotorConnectionType,SolarDeviceType,TransformerType,TubeBundleType,UnitaryEquipmentType FlowControllerType:AirTerminalBoxType,DamperType,ElectricDistributionBoardType,ElectricTimeControlType,FlowMeterType,ProtectiveDeviceType,SwitchingDeviceType,ValveType FlowFittingType:CableCarrierFittingType,CableFittingType,DuctFittingType,JunctionBoxType,PipeFittingType FlowMovingDeviceType:CompressorType,FanType,PumpType FlowSegmentType:CableCarrierSegmentType,CableSegmentType,DuctSegmentType,PipeSegmentType FlowStorageDeviceType:ElectricFlowStorageDeviceType,TankType FlowTerminalType:AirTerminalType,AudioVisualApplianceType,CommunicationsApplianceType,ElectricApplianceType,FireSuppressionTerminalType,LampType,LightFixtureType,MedicalDeviceType,OutletType,SanitaryTerminalType,SpaceHeaterType,StackTerminalType,WasteTerminalType FlowTreatmentDeviceType:DuctSilencerType,FilterType,InterceptorType").split(" ")) {
11
+ let [t, n] = e.split(":"), r = `IFC${t.toUpperCase()}`;
12
+ for (let e of n.split(",")) {
13
+ let t = `Ifc${e}`;
14
+ i.set(t.toUpperCase(), {
15
+ name: t,
16
+ parent: r,
17
+ children: []
18
+ }), i.get(r).children.push(t.toUpperCase());
19
+ }
20
+ }
21
+ return e.set(n, r = { classes: i }), r;
22
+ }
23
+ function n(e, n, r) {
24
+ let i = r.toUpperCase();
25
+ if (typeof e != "string") {
26
+ let t = e.inheritance;
27
+ if (t) {
28
+ let e = n.toUpperCase();
29
+ return e === i || (t.get(i)?.some((t) => t.toUpperCase() === e) ?? !1);
30
+ }
31
+ e = e.schema;
32
+ }
33
+ let { classes: a } = t(e);
34
+ for (let e = n.toUpperCase(); e !== void 0; e = a.get(e)?.parent) if (e === i) return !0;
35
+ return !1;
36
+ }
37
+ function r(e, n) {
38
+ let { classes: r } = t(e), i = [];
39
+ for (let e = r.get(n.toUpperCase())?.parent; e !== void 0; e = r.get(e)?.parent) i.push(r.get(e).name);
40
+ return i;
41
+ }
42
+ function i(e, n) {
43
+ let { classes: r } = t(e), i = [], a = [...r.get(n.toUpperCase())?.children ?? []];
44
+ for (; a.length;) {
45
+ let e = r.get(a.shift());
46
+ i.push(e.name), a.push(...e.children);
47
+ }
48
+ return i;
49
+ }
50
+ //#endregion
51
+ export { i as n, r, n as t };
@@ -0,0 +1,2 @@
1
+ export declare const IFC4_TREE = "ObjectDefinition:Context,Object,TypeObject Context:Project,ProjectLibrary Object:Actor,Control,Group,Process,Product,Resource TypeObject:TypeProcess,TypeProduct,TypeResource Actor:Occupant Control:ActionRequest,CostItem,CostSchedule,PerformanceHistory,Permit,ProjectOrder,WorkCalendar,WorkControl Group:Asset,Inventory,StructuralLoadGroup,StructuralResultGroup,System Process:Event,Procedure,Task Product:Annotation,Element,Grid,Port,Proxy,SpatialElement,StructuralActivity,StructuralItem Resource:ConstructionResource TypeProcess:EventType,ProcedureType,TaskType TypeProduct:DoorStyle,ElementType,SpatialElementType,WindowStyle TypeResource:ConstructionResourceType WorkControl:WorkPlan,WorkSchedule StructuralLoadGroup:StructuralLoadCase System:BuildingSystem,DistributionSystem,StructuralAnalysisModel,Zone Element:BuildingElement,CivilElement,DistributionElement,ElementAssembly,ElementComponent,FeatureElement,FurnishingElement,GeographicElement,TransportElement,VirtualElement Port:DistributionPort SpatialElement:ExternalSpatialStructureElement,SpatialStructureElement,SpatialZone StructuralActivity:StructuralAction,StructuralReaction StructuralItem:StructuralConnection,StructuralMember ConstructionResource:ConstructionEquipmentResource,ConstructionMaterialResource,ConstructionProductResource,CrewResource,LaborResource,SubContractResource ElementType:BuildingElementType,CivilElementType,DistributionElementType,ElementAssemblyType,ElementComponentType,FurnishingElementType,GeographicElementType,TransportElementType SpatialElementType:SpatialStructureElementType,SpatialZoneType ConstructionResourceType:ConstructionEquipmentResourceType,ConstructionMaterialResourceType,ConstructionProductResourceType,CrewResourceType,LaborResourceType,SubContractResourceType DistributionSystem:DistributionCircuit BuildingElement:Beam,BuildingElementProxy,Chimney,Column,Covering,CurtainWall,Door,Footing,Member,Pile,Plate,Railing,Ramp,RampFlight,Roof,ShadingDevice,Slab,Stair,StairFlight,Wall,Window DistributionElement:DistributionControlElement,DistributionFlowElement ElementComponent:BuildingElementPart,DiscreteAccessory,Fastener,MechanicalFastener,ReinforcingElement,VibrationIsolator FeatureElement:FeatureElementAddition,FeatureElementSubtraction,SurfaceFeature FurnishingElement:Furniture,SystemFurnitureElement ExternalSpatialStructureElement:ExternalSpatialElement SpatialStructureElement:Building,BuildingStorey,Site,Space StructuralAction:StructuralCurveAction,StructuralPointAction,StructuralSurfaceAction StructuralReaction:StructuralCurveReaction,StructuralPointReaction,StructuralSurfaceReaction StructuralConnection:StructuralCurveConnection,StructuralPointConnection,StructuralSurfaceConnection StructuralMember:StructuralCurveMember,StructuralSurfaceMember BuildingElementType:BeamType,BuildingElementProxyType,ChimneyType,ColumnType,CoveringType,CurtainWallType,DoorType,FootingType,MemberType,PileType,PlateType,RailingType,RampFlightType,RampType,RoofType,ShadingDeviceType,SlabType,StairFlightType,StairType,WallType,WindowType DistributionElementType:DistributionControlElementType,DistributionFlowElementType ElementComponentType:BuildingElementPartType,DiscreteAccessoryType,FastenerType,MechanicalFastenerType,ReinforcingElementType,VibrationIsolatorType FurnishingElementType:FurnitureType,SystemFurnitureElementType SpatialStructureElementType:SpaceType Beam:BeamStandardCase Column:ColumnStandardCase Door:DoorStandardCase Member:MemberStandardCase Plate:PlateStandardCase Slab:SlabElementedCase,SlabStandardCase Wall:WallElementedCase,WallStandardCase Window:WindowStandardCase DistributionControlElement:Actuator,Alarm,Controller,FlowInstrument,ProtectiveDeviceTrippingUnit,Sensor,UnitaryControlElement DistributionFlowElement:DistributionChamberElement,EnergyConversionDevice,FlowController,FlowFitting,FlowMovingDevice,FlowSegment,FlowStorageDevice,FlowTerminal,FlowTreatmentDevice ReinforcingElement:ReinforcingBar,ReinforcingMesh,Tendon,TendonAnchor FeatureElementAddition:ProjectionElement FeatureElementSubtraction:OpeningElement,VoidingFeature StructuralCurveAction:StructuralLinearAction StructuralSurfaceAction:StructuralPlanarAction StructuralCurveMember:StructuralCurveMemberVarying StructuralSurfaceMember:StructuralSurfaceMemberVarying DistributionControlElementType:ActuatorType,AlarmType,ControllerType,FlowInstrumentType,ProtectiveDeviceTrippingUnitType,SensorType,UnitaryControlElementType DistributionFlowElementType:DistributionChamberElementType,EnergyConversionDeviceType,FlowControllerType,FlowFittingType,FlowMovingDeviceType,FlowSegmentType,FlowStorageDeviceType,FlowTerminalType,FlowTreatmentDeviceType ReinforcingElementType:ReinforcingBarType,ReinforcingMeshType,TendonAnchorType,TendonType EnergyConversionDevice:AirToAirHeatRecovery,Boiler,Burner,Chiller,Coil,Condenser,CooledBeam,CoolingTower,ElectricGenerator,ElectricMotor,Engine,EvaporativeCooler,Evaporator,HeatExchanger,Humidifier,MotorConnection,SolarDevice,Transformer,TubeBundle,UnitaryEquipment FlowController:AirTerminalBox,Damper,ElectricDistributionBoard,ElectricTimeControl,FlowMeter,ProtectiveDevice,SwitchingDevice,Valve FlowFitting:CableCarrierFitting,CableFitting,DuctFitting,JunctionBox,PipeFitting FlowMovingDevice:Compressor,Fan,Pump FlowSegment:CableCarrierSegment,CableSegment,DuctSegment,PipeSegment FlowStorageDevice:ElectricFlowStorageDevice,Tank FlowTerminal:AirTerminal,AudioVisualAppliance,CommunicationsAppliance,ElectricAppliance,FireSuppressionTerminal,Lamp,LightFixture,MedicalDevice,Outlet,SanitaryTerminal,SpaceHeater,StackTerminal,WasteTerminal FlowTreatmentDevice:DuctSilencer,Filter,Interceptor OpeningElement:OpeningStandardCase EnergyConversionDeviceType:AirToAirHeatRecoveryType,BoilerType,BurnerType,ChillerType,CoilType,CondenserType,CooledBeamType,CoolingTowerType,ElectricGeneratorType,ElectricMotorType,EngineType,EvaporativeCoolerType,EvaporatorType,HeatExchangerType,HumidifierType,MotorConnectionType,SolarDeviceType,TransformerType,TubeBundleType,UnitaryEquipmentType FlowControllerType:AirTerminalBoxType,DamperType,ElectricDistributionBoardType,ElectricTimeControlType,FlowMeterType,ProtectiveDeviceType,SwitchingDeviceType,ValveType FlowFittingType:CableCarrierFittingType,CableFittingType,DuctFittingType,JunctionBoxType,PipeFittingType FlowMovingDeviceType:CompressorType,FanType,PumpType FlowSegmentType:CableCarrierSegmentType,CableSegmentType,DuctSegmentType,PipeSegmentType FlowStorageDeviceType:ElectricFlowStorageDeviceType,TankType FlowTerminalType:AirTerminalType,AudioVisualApplianceType,CommunicationsApplianceType,ElectricApplianceType,FireSuppressionTerminalType,LampType,LightFixtureType,MedicalDeviceType,OutletType,SanitaryTerminalType,SpaceHeaterType,StackTerminalType,WasteTerminalType FlowTreatmentDeviceType:DuctSilencerType,FilterType,InterceptorType";
2
+ export declare const IFC4X3_TREE = "ObjectDefinition:Context,Object,TypeObject Context:Project,ProjectLibrary Object:Actor,Control,Group,Process,Product,Resource TypeObject:TypeProcess,TypeProduct,TypeResource Actor:Occupant Control:ActionRequest,CostItem,CostSchedule,PerformanceHistory,Permit,ProjectOrder,WorkCalendar,WorkControl Group:Asset,Inventory,StructuralLoadGroup,StructuralResultGroup,System Process:Event,Procedure,Task Product:Annotation,Element,LinearElement,Port,PositioningElement,SpatialElement,StructuralActivity,StructuralItem Resource:ConstructionResource TypeProcess:EventType,ProcedureType,TaskType TypeProduct:ElementType,SpatialElementType TypeResource:ConstructionResourceType WorkControl:WorkPlan,WorkSchedule StructuralLoadGroup:StructuralLoadCase System:BuildingSystem,BuiltSystem,DistributionSystem,StructuralAnalysisModel,Zone Element:BuiltElement,CivilElement,DistributionElement,ElementAssembly,ElementComponent,FeatureElement,FurnishingElement,GeographicElement,GeotechnicalElement,TransportationDevice,VirtualElement LinearElement:AlignmentCant,AlignmentHorizontal,AlignmentSegment,AlignmentVertical Port:DistributionPort PositioningElement:Grid,LinearPositioningElement,Referent SpatialElement:ExternalSpatialStructureElement,SpatialStructureElement,SpatialZone StructuralActivity:StructuralAction,StructuralReaction StructuralItem:StructuralConnection,StructuralMember ConstructionResource:ConstructionEquipmentResource,ConstructionMaterialResource,ConstructionProductResource,CrewResource,LaborResource,SubContractResource ElementType:BuiltElementType,CivilElementType,DistributionElementType,ElementAssemblyType,ElementComponentType,FurnishingElementType,GeographicElementType,TransportationDeviceType SpatialElementType:SpatialStructureElementType,SpatialZoneType ConstructionResourceType:ConstructionEquipmentResourceType,ConstructionMaterialResourceType,ConstructionProductResourceType,CrewResourceType,LaborResourceType,SubContractResourceType DistributionSystem:DistributionCircuit BuiltElement:Beam,Bearing,BuildingElementProxy,Chimney,Column,Course,Covering,CurtainWall,DeepFoundation,Door,EarthworksElement,Footing,Kerb,Member,MooringDevice,NavigationElement,Pavement,Plate,Rail,Railing,Ramp,RampFlight,Roof,ShadingDevice,Slab,Stair,StairFlight,TrackElement,Wall,Window DistributionElement:DistributionControlElement,DistributionFlowElement ElementComponent:BuildingElementPart,DiscreteAccessory,Fastener,ImpactProtectionDevice,MechanicalFastener,ReinforcingElement,Sign,VibrationDamper,VibrationIsolator FeatureElement:FeatureElementAddition,FeatureElementSubtraction,SurfaceFeature FurnishingElement:Furniture,SystemFurnitureElement GeotechnicalElement:GeotechnicalAssembly,GeotechnicalStratum TransportationDevice:TransportElement,Vehicle LinearPositioningElement:Alignment ExternalSpatialStructureElement:ExternalSpatialElement SpatialStructureElement:BuildingStorey,Facility,FacilityPart,Site,Space StructuralAction:StructuralCurveAction,StructuralPointAction,StructuralSurfaceAction StructuralReaction:StructuralCurveReaction,StructuralPointReaction,StructuralSurfaceReaction StructuralConnection:StructuralCurveConnection,StructuralPointConnection,StructuralSurfaceConnection StructuralMember:StructuralCurveMember,StructuralSurfaceMember BuiltElementType:BeamType,BearingType,BuildingElementProxyType,ChimneyType,ColumnType,CourseType,CoveringType,CurtainWallType,DeepFoundationType,DoorType,FootingType,KerbType,MemberType,MooringDeviceType,NavigationElementType,PavementType,PlateType,RailType,RailingType,RampFlightType,RampType,RoofType,ShadingDeviceType,SlabType,StairFlightType,StairType,TrackElementType,WallType,WindowType DistributionElementType:DistributionControlElementType,DistributionFlowElementType ElementComponentType:BuildingElementPartType,DiscreteAccessoryType,FastenerType,ImpactProtectionDeviceType,MechanicalFastenerType,ReinforcingElementType,SignType,VibrationDamperType,VibrationIsolatorType FurnishingElementType:FurnitureType,SystemFurnitureElementType TransportationDeviceType:TransportElementType,VehicleType SpatialStructureElementType:SpaceType DeepFoundation:CaissonFoundation,Pile EarthworksElement:EarthworksFill,ReinforcedSoil Wall:WallStandardCase DistributionControlElement:Actuator,Alarm,Controller,FlowInstrument,ProtectiveDeviceTrippingUnit,Sensor,UnitaryControlElement DistributionFlowElement:DistributionChamberElement,EnergyConversionDevice,FlowController,FlowFitting,FlowMovingDevice,FlowSegment,FlowStorageDevice,FlowTerminal,FlowTreatmentDevice ReinforcingElement:ReinforcingBar,ReinforcingMesh,Tendon,TendonAnchor,TendonConduit FeatureElementAddition:ProjectionElement FeatureElementSubtraction:EarthworksCut,OpeningElement,VoidingFeature GeotechnicalAssembly:Borehole,Geomodel,Geoslice Facility:Bridge,Building,MarineFacility,Railway,Road FacilityPart:BridgePart,FacilityPartCommon,MarinePart,RailwayPart,RoadPart StructuralCurveAction:StructuralLinearAction StructuralSurfaceAction:StructuralPlanarAction StructuralCurveMember:StructuralCurveMemberVarying StructuralSurfaceMember:StructuralSurfaceMemberVarying DeepFoundationType:CaissonFoundationType,PileType DistributionControlElementType:ActuatorType,AlarmType,ControllerType,FlowInstrumentType,ProtectiveDeviceTrippingUnitType,SensorType,UnitaryControlElementType DistributionFlowElementType:DistributionChamberElementType,EnergyConversionDeviceType,FlowControllerType,FlowFittingType,FlowMovingDeviceType,FlowSegmentType,FlowStorageDeviceType,FlowTerminalType,FlowTreatmentDeviceType ReinforcingElementType:ReinforcingBarType,ReinforcingMeshType,TendonAnchorType,TendonConduitType,TendonType EnergyConversionDevice:AirToAirHeatRecovery,Boiler,Burner,Chiller,Coil,Condenser,CooledBeam,CoolingTower,ElectricGenerator,ElectricMotor,Engine,EvaporativeCooler,Evaporator,HeatExchanger,Humidifier,MotorConnection,SolarDevice,Transformer,TubeBundle,UnitaryEquipment FlowController:AirTerminalBox,Damper,DistributionBoard,ElectricDistributionBoard,ElectricTimeControl,FlowMeter,ProtectiveDevice,SwitchingDevice,Valve FlowFitting:CableCarrierFitting,CableFitting,DuctFitting,JunctionBox,PipeFitting FlowMovingDevice:Compressor,Fan,Pump FlowSegment:CableCarrierSegment,CableSegment,ConveyorSegment,DuctSegment,PipeSegment FlowStorageDevice:ElectricFlowStorageDevice,Tank FlowTerminal:AirTerminal,AudioVisualAppliance,CommunicationsAppliance,ElectricAppliance,FireSuppressionTerminal,Lamp,LightFixture,LiquidTerminal,MedicalDevice,MobileTelecommunicationsAppliance,Outlet,SanitaryTerminal,Signal,SpaceHeater,StackTerminal,WasteTerminal FlowTreatmentDevice:DuctSilencer,ElectricFlowTreatmentDevice,Filter,Interceptor EnergyConversionDeviceType:AirToAirHeatRecoveryType,BoilerType,BurnerType,ChillerType,CoilType,CondenserType,CooledBeamType,CoolingTowerType,ElectricGeneratorType,ElectricMotorType,EngineType,EvaporativeCoolerType,EvaporatorType,HeatExchangerType,HumidifierType,MotorConnectionType,SolarDeviceType,TransformerType,TubeBundleType,UnitaryEquipmentType FlowControllerType:AirTerminalBoxType,DamperType,DistributionBoardType,ElectricDistributionBoardType,ElectricTimeControlType,FlowMeterType,ProtectiveDeviceType,SwitchingDeviceType,ValveType FlowFittingType:CableCarrierFittingType,CableFittingType,DuctFittingType,JunctionBoxType,PipeFittingType FlowMovingDeviceType:CompressorType,FanType,PumpType FlowSegmentType:CableCarrierSegmentType,CableSegmentType,ConveyorSegmentType,DuctSegmentType,PipeSegmentType FlowStorageDeviceType:ElectricFlowStorageDeviceType,TankType FlowTerminalType:AirTerminalType,AudioVisualApplianceType,CommunicationsApplianceType,ElectricApplianceType,FireSuppressionTerminalType,LampType,LightFixtureType,LiquidTerminalType,MedicalDeviceType,MobileTelecommunicationsApplianceType,OutletType,SanitaryTerminalType,SignalType,SpaceHeaterType,StackTerminalType,WasteTerminalType FlowTreatmentDeviceType:DuctSilencerType,ElectricFlowTreatmentDeviceType,FilterType,InterceptorType";
@@ -0,0 +1,16 @@
1
+ /** A model's schema name with, for IFC2X3 models, the inheritance readIFCData recorded (IFCData fits). */
2
+ export interface IFCSchemaSource {
3
+ schema: string;
4
+ inheritance?: ReadonlyMap<string, readonly string[]>;
5
+ }
6
+ /**
7
+ * Whether `type` is `ancestor` or one of its subtypes in `schema` (`IFC4`, `IFC4X3...`; `IFC2X3` uses the IFC4 tree),
8
+ * as the schema's SUBTYPE OF declarations chain. Names compare without case; a class outside the tree only matches
9
+ * itself. Pass readIFCData's result instead of a name to follow an IFC2X3 model's own recorded inheritance, where
10
+ * IFC2X3-only classes have their subtypes and IFC2X3 parents (for the classes present in that model).
11
+ */
12
+ export declare function isSubtypeOf(schema: string | IFCSchemaSource, type: string, ancestor: string): boolean;
13
+ /** The supertypes of `type`, nearest first, up to IfcObjectDefinition; empty for a class outside that tree. */
14
+ export declare function supertypesOf(schema: string, type: string): string[];
15
+ /** Every subtype of `type` (not `type` itself), in the schema's spelling, breadth first; empty for a leaf. */
16
+ export declare function subtypesOf(schema: string, type: string): string[];
@@ -0,0 +1,95 @@
1
+ /// <reference lib="esnext.disposable" preserve="true" />
2
+ // @ts-ignore optional peer: its types apply when it is installed
3
+ import type { EngineKernel } from '@margoengine/core';
4
+ // @ts-ignore optional peer: its types apply when it is installed
5
+ import { Material } from '@margoengine/materials';
6
+ // @ts-ignore optional peer: its types apply when it is installed
7
+ import type { MaterialMesh } from '@margoengine/materials';
8
+ // @ts-ignore optional peer: its types apply when it is installed
9
+ import type { Line, Lines } from '@margoengine/lines';
10
+ import type { IFCMeshGeometry, IFCScene } from './scene.js';
11
+ /** One placed geometry to cut: what `IFCScene.placementsOf` returns, with its element. */
12
+ export interface IFCSectionSource {
13
+ element: number;
14
+ geometry: IFCMeshGeometry;
15
+ /** Column-major placement into the planes' space. */
16
+ matrix: ArrayLike<number>;
17
+ }
18
+ /** What one plane cuts out of one element. */
19
+ export interface IFCSectionCut {
20
+ element: number;
21
+ /** Index of the plane in the list given. */
22
+ plane: number;
23
+ /** Cap triangles on the plane: x, y, z per corner, already trimmed by the other planes. */
24
+ positions: Float32Array;
25
+ indices: Uint32Array;
26
+ /** Cut edges, two points (six numbers) per segment, trimmed by the other planes. */
27
+ edges: Float32Array;
28
+ /** Section loops in the plane, closed ones first, x, y, z per point; `closed` of them are closed. */
29
+ loops: Float32Array[];
30
+ closed: number;
31
+ }
32
+ /** Options of sectionIFC. */
33
+ export interface IFCSectionOptions {
34
+ /** Open loop ends closer than this (meters) are joined. Default 1e-5. */
35
+ tolerance?: number;
36
+ signal?: AbortSignal;
37
+ }
38
+ /**
39
+ * Cuts `sources` by `planes` (`[a, b, c, d]`, what has `a x + b y + c z + d < 0` is cut away, as `clippingPlanes`)
40
+ * and returns, per element and plane, the cap triangles and cut edges, trimmed by the other planes, and the section
41
+ * loops. Pure CPU; throws a coded RangeError for a bad plane and the signal's reason when aborted.
42
+ */
43
+ export declare function sectionIFC(sources: Iterable<IFCSectionSource>, planes: readonly (readonly number[])[], options?: IFCSectionOptions): IFCSectionCut[];
44
+ /** Options of IFCSectionView. */
45
+ export interface IFCSectionViewOptions {
46
+ /** Draw caps. Default true. */
47
+ caps?: boolean;
48
+ /** Cap colour, sRGB 0..1, or 'element' for each element's own colour (its override, else its file colour). Default 'element'. */
49
+ capColor?: 'element' | readonly number[];
50
+ /** A Lines plugin of @margoengine/lines and its Line class, to draw cut edges. Default none (no edges). */
51
+ edges?: {
52
+ lines: Lines;
53
+ Line: typeof Line;
54
+ };
55
+ /** Edge width in CSS pixels. Default 2. */
56
+ edgeWidth?: number;
57
+ /** Edge colour, sRGB 0..1. Default black. */
58
+ edgeColor?: readonly number[];
59
+ /** As sectionIFC's. */
60
+ tolerance?: number;
61
+ }
62
+ /**
63
+ * Section caps and cut edges for an IFCScene's clipping planes: call `update()` after changing the planes or which
64
+ * elements are shown (it does nothing when neither changed). Caps draw through @margoengine/materials, edges through a
65
+ * Lines plugin you pass. Dispose it to free its meshes and lines.
66
+ */
67
+ export declare class IFCSectionView {
68
+ private readonly engine;
69
+ private readonly scene;
70
+ private readonly options;
71
+ /** The cap material (unlit look: roughness 1, double sided); set shared options on it. */
72
+ readonly material: Material;
73
+ /** The last update's cuts (sectionIFC's result). */
74
+ cuts: readonly IFCSectionCut[];
75
+ private batch?;
76
+ private lines;
77
+ private stamp;
78
+ private readonly capColor;
79
+ private readonly edgeColor;
80
+ private readonly edgeWidth;
81
+ private disposed;
82
+ constructor(engine: EngineKernel, scene: IFCScene, options?: IFCSectionViewOptions);
83
+ /** Caps and cut edges for `scene` on `engine`: the same as `new IFCSectionView(engine, scene, options)`. */
84
+ static attach(engine: EngineKernel, scene: IFCScene, options?: IFCSectionViewOptions): IFCSectionView;
85
+ /** The cap meshes (one batch, or none), for shadows, SSAO or picking filters. */
86
+ get meshes(): readonly MaterialMesh[];
87
+ /** The linear RGB a cap of `element` draws in: `capColor`, else the element's override, else its file colour. */
88
+ capColorOf(element: number): [number, number, number];
89
+ /** Recomputes caps and edges when the planes or the shown elements changed since the last call. Returns this. */
90
+ update(): this;
91
+ private drawCaps;
92
+ private clear;
93
+ dispose(): void;
94
+ [Symbol.dispose](): void;
95
+ }
@@ -0,0 +1,380 @@
1
+ // @margo/core-built 1.0.0
2
+ import {coreRequirement as __margoCoreRequirement,assertCore as __margoAssertCore} from '@margoengine/core/extension';
3
+
4
+ import { i as e, t } from "./open-D1NQyRTk.js";
5
+ import { Material as n } from "@margoengine/materials";
6
+ import { BatchedMesh as r } from "@margoengine/materials/batched";
7
+ import { triangulate as i } from "@margoengine/geometry/triangulate";
8
+ //#region src/section.ts
9
+ var a = (e, t) => e[0] * t[0] + e[1] * t[1] + e[2] * t[2];
10
+ function o(t) {
11
+ return Array.isArray(t) || e("range", "section planes must be an array of [a, b, c, d]"), t.map((t) => {
12
+ (!Array.isArray(t) || t.length !== 4 || !t.every(Number.isFinite)) && e("range", "a section plane must be four finite numbers [a, b, c, d]");
13
+ let n = Math.hypot(t[0], t[1], t[2]);
14
+ return n > 0 || e("range", "a section plane needs a non-zero normal [a, b, c]"), [
15
+ t[0] / n,
16
+ t[1] / n,
17
+ t[2] / n,
18
+ t[3] / n
19
+ ];
20
+ });
21
+ }
22
+ function s(e, t, n) {
23
+ let r = e;
24
+ for (let e = 0; e < t.length && r.length; e++) {
25
+ if (e === n) continue;
26
+ let i = t[e], o = [];
27
+ for (let e = 0; e < r.length; e++) {
28
+ let t = r[e], n = r[(e + 1) % r.length], s = a(i, t) + i[3], c = a(i, n) + i[3];
29
+ if (s >= 0 && o.push(t), s >= 0 != c >= 0) {
30
+ let e = s / (s - c);
31
+ o.push([
32
+ t[0] + (n[0] - t[0]) * e,
33
+ t[1] + (n[1] - t[1]) * e,
34
+ t[2] + (n[2] - t[2]) * e
35
+ ]);
36
+ }
37
+ }
38
+ r = o;
39
+ }
40
+ return r;
41
+ }
42
+ function c(e, t, n, r) {
43
+ let i = 0, o = 1;
44
+ for (let s = 0; s < n.length; s++) {
45
+ if (s === r) continue;
46
+ let c = n[s], l = a(c, e) + c[3], u = a(c, t) + c[3];
47
+ if (l < 0 && u < 0) return;
48
+ l < 0 ? i = Math.max(i, l / (l - u)) : u < 0 && (o = Math.min(o, l / (l - u)));
49
+ }
50
+ if (i >= o) return;
51
+ let s = (n) => [
52
+ e[0] + (t[0] - e[0]) * n,
53
+ e[1] + (t[1] - e[1]) * n,
54
+ e[2] + (t[2] - e[2]) * n
55
+ ];
56
+ return [s(i), s(o)];
57
+ }
58
+ function l(e, t) {
59
+ let n = (e) => `${e[0]},${e[1]},${e[2]}`, r = /* @__PURE__ */ new Map(), i = new Uint8Array(e.length);
60
+ e.forEach((e, t) => {
61
+ for (let i of e) {
62
+ let e = n(i), a = r.get(e);
63
+ a ? a.push(t) : r.set(e, [t]);
64
+ }
65
+ });
66
+ let a = (e) => r.get(n(e))?.find((e) => !i[e]), o = (t) => {
67
+ for (;;) {
68
+ let r = t[t.length - 1], o = a(r);
69
+ if (o === void 0) return;
70
+ i[o] = 1;
71
+ let s = e[o];
72
+ t.push(n(s[0]) === n(r) ? s[1] : s[0]);
73
+ }
74
+ }, s = [], c = [];
75
+ for (let t = 0; t < e.length; t++) {
76
+ if (i[t]) continue;
77
+ i[t] = 1;
78
+ let r = [e[t][0], e[t][1]];
79
+ o(r), n(r[0]) === n(r[r.length - 1]) ? (r.pop(), s.push(r)) : (r.reverse(), o(r), c.push(r));
80
+ }
81
+ let l = (e, n) => Math.hypot(e[0] - n[0], e[1] - n[1], e[2] - n[2]) <= t;
82
+ for (let e = !0; e && c.length;) {
83
+ e = !1;
84
+ for (let t = 0; t < c.length && !e; t++) {
85
+ let n = c[t];
86
+ if (n.length > 2 && l(n[0], n[n.length - 1])) {
87
+ n.pop(), s.push(n), c.splice(t, 1), e = !0;
88
+ break;
89
+ }
90
+ for (let r = 0; r < c.length && !e; r++) {
91
+ if (t === r) continue;
92
+ let i = c[r], a = n[n.length - 1];
93
+ if (l(a, i[0])) n.push(...i.slice(1));
94
+ else if (l(a, i[i.length - 1])) n.push(...i.slice(0, -1).reverse());
95
+ else continue;
96
+ c.splice(r, 1), e = !0;
97
+ }
98
+ }
99
+ }
100
+ return {
101
+ loops: [...s.map((e) => u(e, !0)), ...c.map((e) => u(e, !1))],
102
+ closed: s.length
103
+ };
104
+ }
105
+ function u(e, t) {
106
+ let n = [];
107
+ for (let r = 0; r < e.length; r++) {
108
+ if (!t && (r === 0 || r === e.length - 1) || e.length - (r - n.length) <= 3) {
109
+ n.push(e[r]);
110
+ continue;
111
+ }
112
+ let i = n.length ? n[n.length - 1] : e[e.length - 1], o = e[r], s = e[(r + 1) % e.length], c = [
113
+ o[0] - i[0],
114
+ o[1] - i[1],
115
+ o[2] - i[2]
116
+ ], l = [
117
+ s[0] - o[0],
118
+ s[1] - o[1],
119
+ s[2] - o[2]
120
+ ];
121
+ (Math.hypot(c[1] * l[2] - c[2] * l[1], c[2] * l[0] - c[0] * l[2], c[0] * l[1] - c[1] * l[0]) > 1e-12 * Math.hypot(...c) * Math.hypot(...l) || a(c, l) <= 0) && n.push(o);
122
+ }
123
+ return n;
124
+ }
125
+ function d(e, t, n) {
126
+ let r = !1;
127
+ for (let i = 0, a = e.length - 2; i < e.length; a = i, i += 2) {
128
+ let o = e[i + 1], s = e[a + 1];
129
+ o > n != s > n && t < (e[a] - e[i]) * (n - o) / (s - o) + e[i] && (r = !r);
130
+ }
131
+ return r;
132
+ }
133
+ var f = (e) => {
134
+ let t = 0;
135
+ for (let n = 0, r = e.length - 2; n < e.length; r = n, n += 2) t += e[r] * e[n + 1] - e[n] * e[r + 1];
136
+ return t / 2;
137
+ };
138
+ function p(e, t) {
139
+ let n = Math.abs(t[0]) < .9 ? [
140
+ 1,
141
+ 0,
142
+ 0
143
+ ] : [
144
+ 0,
145
+ 1,
146
+ 0
147
+ ], r = [
148
+ t[1] * n[2] - t[2] * n[1],
149
+ t[2] * n[0] - t[0] * n[2],
150
+ t[0] * n[1] - t[1] * n[0]
151
+ ], o = Math.hypot(r[0], r[1], r[2]);
152
+ for (let e = 0; e < 3; e++) r[e] /= o;
153
+ let s = [
154
+ t[1] * r[2] - t[2] * r[1],
155
+ t[2] * r[0] - t[0] * r[2],
156
+ t[0] * r[1] - t[1] * r[0]
157
+ ], c = e.map((e) => e.flatMap((e) => [a(r, e), a(s, e)])), l = c.map((e) => Math.abs(f(e))), u = c.map((e, t) => e.length >= 6 && l[t] > 0), p = c.map((e, t) => u[t] ? c.map((e, t) => t).filter((n) => n !== t && u[n] && l[n] > l[t] && d(c[n], e[0], e[1])) : []), m = [];
158
+ return c.forEach((t, n) => {
159
+ if (!u[n] || p[n].length % 2) return;
160
+ let r = c.map((e, t) => t).filter((e) => u[e] && p[e].length === p[n].length + 1 && p[e].includes(n)), a = [...t], o = [...e[n]], s = [];
161
+ for (let t of r) s.push(a.length / 2), a.push(...c[t]), o.push(...e[t]);
162
+ let l = i(a, s, 2);
163
+ for (let e = 0; e < l.length; e += 3) m.push([
164
+ o[l[e]],
165
+ o[l[e + 1]],
166
+ o[l[e + 2]]
167
+ ]);
168
+ }), m;
169
+ }
170
+ function m(n, r, i = {}) {
171
+ let a = o(r), u = i.tolerance ?? 1e-5;
172
+ (!(u >= 0) || !Number.isFinite(u)) && e("range", "tolerance must be a finite number of meters, 0 or more");
173
+ let d = /* @__PURE__ */ new Map();
174
+ for (let e of n) {
175
+ let t = d.get(e.element);
176
+ t ? t.push(e) : d.set(e.element, [e]);
177
+ }
178
+ let f = [];
179
+ for (let [e, n] of d) {
180
+ t(i.signal);
181
+ let r = n.map(({ geometry: { positions: e }, matrix: t }) => {
182
+ let n = new Float64Array(e.length);
183
+ for (let r = 0; r < e.length; r += 3) {
184
+ let i = e[r], a = e[r + 1], o = e[r + 2];
185
+ for (let e = 0; e < 3; e++) n[r + e] = t[e] * i + t[4 + e] * a + t[8 + e] * o + t[12 + e];
186
+ }
187
+ return n;
188
+ });
189
+ a.forEach((t, i) => {
190
+ let o = [];
191
+ if (n.forEach(({ geometry: { indices: e } }, n) => {
192
+ let i = r[n], a = new Float64Array(i.length / 3), s = Infinity, c = -Infinity;
193
+ for (let e = 0; e < a.length; e++) a[e] = t[0] * i[e * 3] + t[1] * i[e * 3 + 1] + t[2] * i[e * 3 + 2] + t[3], s = Math.min(s, a[e]), c = Math.max(c, a[e]);
194
+ if (!(s < 0 && c >= 0)) return;
195
+ let l = (e, t) => {
196
+ let n = a[e] / (a[e] - a[t]);
197
+ return [
198
+ i[e * 3] + (i[t * 3] - i[e * 3]) * n,
199
+ i[e * 3 + 1] + (i[t * 3 + 1] - i[e * 3 + 1]) * n,
200
+ i[e * 3 + 2] + (i[t * 3 + 2] - i[e * 3 + 2]) * n
201
+ ];
202
+ };
203
+ for (let t = 0; t < e.length; t += 3) {
204
+ let n = [
205
+ e[t],
206
+ e[t + 1],
207
+ e[t + 2]
208
+ ], r = n.filter((e) => a[e] < 0);
209
+ if (r.length === 0 || r.length === 3) continue;
210
+ let i = n.filter((e) => a[e] >= 0);
211
+ o.push(r.length === 1 ? [l(r[0], i[0]), l(r[0], i[1])] : [l(r[0], i[0]), l(r[1], i[0])]);
212
+ }
213
+ }), !o.length) return;
214
+ let { loops: d, closed: m } = l(o, u), h = [], g = [];
215
+ for (let e of p(d.slice(0, m), t)) {
216
+ let t = s(e, a, i), n = h.length / 3;
217
+ for (let e of t) h.push(e[0], e[1], e[2]);
218
+ for (let e = 1; e + 1 < t.length; e++) g.push(n, n + e, n + e + 1);
219
+ }
220
+ let _ = [];
221
+ for (let [e, t] of d.entries()) for (let n = 0; n < t.length - (e < m ? 0 : 1); n++) {
222
+ let e = c(t[n], t[(n + 1) % t.length], a, i);
223
+ e && _.push(...e[0], ...e[1]);
224
+ }
225
+ (h.length || _.length) && f.push({
226
+ element: e,
227
+ plane: i,
228
+ positions: new Float32Array(h),
229
+ indices: new Uint32Array(g),
230
+ edges: new Float32Array(_),
231
+ loops: d.map((e) => new Float32Array(e.flat())),
232
+ closed: m
233
+ });
234
+ });
235
+ }
236
+ return f;
237
+ }
238
+ var h = (e) => e <= .04045 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4;
239
+ function g(t, n, r) {
240
+ return t === void 0 ? r : ((!Array.isArray(t) || t.length < 3 || t.slice(0, 3).some((e) => !Number.isFinite(e) || e < 0 || e > 1)) && e("range", `${n} must be three sRGB components from 0 to 1`), [
241
+ t[0],
242
+ t[1],
243
+ t[2]
244
+ ]);
245
+ }
246
+ var _ = class t {
247
+ constructor(t, r, i = {}) {
248
+ this.engine = t, this.scene = r, this.options = i, this.cuts = [], this.lines = [], this.stamp = "", this.disposed = !1, this.capColor = i.capColor === void 0 || i.capColor === "element" ? "element" : g(i.capColor, "capColor", [
249
+ 0,
250
+ 0,
251
+ 0
252
+ ]).map(h), this.edgeColor = g(i.edgeColor, "edgeColor", [
253
+ 0,
254
+ 0,
255
+ 0
256
+ ]), this.edgeWidth = i.edgeWidth ?? 2, (!(this.edgeWidth > 0) || !Number.isFinite(this.edgeWidth)) && e("range", "edgeWidth must be a positive number of pixels"), i.edges && (typeof i.edges.Line != "function" || typeof i.edges.lines?.add != "function") && e("range", "edges takes { lines, Line } from @margoengine/lines"), this.material = new n({
257
+ roughness: 1,
258
+ metalness: 0,
259
+ doubleSided: !0
260
+ }), this.update();
261
+ }
262
+ static attach(e, n, r = {}) {__margoAssertCore(e,__margoCoreRequirement("1.0.0",import.meta.url));
263
+ return new t(e, n, r);
264
+ }
265
+ get meshes() {
266
+ return this.batch ? [this.batch.mesh] : [];
267
+ }
268
+ capColorOf(e) {
269
+ if (this.capColor !== "element") return [
270
+ this.capColor[0],
271
+ this.capColor[1],
272
+ this.capColor[2]
273
+ ];
274
+ let t = this.scene.stateOf(e)?.color;
275
+ if (t) return [
276
+ h(t[0]),
277
+ h(t[1]),
278
+ h(t[2])
279
+ ];
280
+ let n = this.scene.placementsOf(e)[0]?.color ?? [
281
+ .5,
282
+ .5,
283
+ .5
284
+ ];
285
+ return [
286
+ n[0],
287
+ n[1],
288
+ n[2]
289
+ ];
290
+ }
291
+ update() {
292
+ this.disposed && e("range", "the section view is disposed; create a new one");
293
+ let t = this.scene.clippingPlanes, n = this.scene.elements.filter((e) => {
294
+ let t = this.scene.stateOf(e);
295
+ return t && !t.hidden && !t.ghosted;
296
+ }), r = this.capColor === "element" ? n.map((e) => this.scene.stateOf(e)?.color?.join() ?? "") : [], i = JSON.stringify([
297
+ t,
298
+ n,
299
+ r
300
+ ]);
301
+ if (i === this.stamp || (this.stamp = i, this.clear(), !t.length)) return this;
302
+ let a = n.flatMap((e) => this.scene.placementsOf(e).map((t) => ({
303
+ element: e,
304
+ geometry: t.geometry,
305
+ matrix: t.matrix
306
+ })));
307
+ this.cuts = m(a, t, { tolerance: this.options.tolerance }), this.options.caps !== !1 && this.drawCaps();
308
+ let o = this.options.edges;
309
+ if (o) {
310
+ let e = this.cuts.flatMap((e) => Array.from(e.edges));
311
+ if (e.length) {
312
+ let t = new o.Line({
313
+ positions: e,
314
+ mode: "segments",
315
+ color: this.edgeColor.map(h),
316
+ width: this.edgeWidth
317
+ });
318
+ o.lines.add(t), this.lines.push(t);
319
+ }
320
+ }
321
+ return this;
322
+ }
323
+ drawCaps() {
324
+ let e = this.cuts.filter((e) => e.indices.length);
325
+ if (!e.length) return;
326
+ let t = e.reduce((e, t) => e + t.positions.length / 3, 0), n = e.reduce((e, t) => e + t.indices.length, 0), i = r.attach(this.engine, this.material, {
327
+ maxVertices: Math.max(3, t),
328
+ maxIndices: Math.max(3, n),
329
+ maxItems: e.length
330
+ });
331
+ this.batch = i;
332
+ let a = new Float32Array([
333
+ 1,
334
+ 0,
335
+ 0,
336
+ 0,
337
+ 0,
338
+ 1,
339
+ 0,
340
+ 0,
341
+ 0,
342
+ 0,
343
+ 1,
344
+ 0,
345
+ 0,
346
+ 0,
347
+ 0,
348
+ 1
349
+ ]);
350
+ for (let t of e) {
351
+ let e = this.scene.clippingPlanes[t.plane], n = new Float32Array(t.positions.length);
352
+ for (let t = 0; t < n.length; t += 3) n.set([
353
+ -e[0],
354
+ -e[1],
355
+ -e[2]
356
+ ], t);
357
+ i.add({
358
+ positions: t.positions,
359
+ normals: n,
360
+ indices: t.indices
361
+ }, {
362
+ matrix: a,
363
+ color: this.capColorOf(t.element)
364
+ });
365
+ }
366
+ }
367
+ clear() {
368
+ this.batch?.dispose(), this.batch = void 0;
369
+ for (let e of this.lines.splice(0)) this.options.edges?.lines.remove(e);
370
+ this.cuts = [];
371
+ }
372
+ dispose() {
373
+ this.disposed || (this.disposed = !0, this.clear(), this.material.dispose());
374
+ }
375
+ [Symbol.dispose]() {
376
+ this.dispose();
377
+ }
378
+ };
379
+ //#endregion
380
+ export { _ as IFCSectionView, m as sectionIFC };
package/dist/step.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare function checkStep(data: Uint8Array): string | null;
@@ -0,0 +1,7 @@
1
+ //#region src/tolerance.ts
2
+ function e(e, t) {
3
+ let n = Math.abs(t) * 1e-6 + 1e-6, r = 8 * 2 ** -52 * (Math.abs(t) + n);
4
+ return e >= t - n - r && e <= t + n + r;
5
+ }
6
+ //#endregion
7
+ export { e as t };
@@ -0,0 +1,2 @@
1
+ /** IDS 1.0's real comparison: `value` lies within target -/+ (|target| 1e-6 + 1e-6), edges included, for either sign. */
2
+ export declare function nearlyEqual(value: number, target: number): boolean;