Load JSON based on ifcopenshell schema version

This allows us to support more than one ifc version. The 2X3 jsons cannot be autogenerated and have been manually written based on the hardcoded values in the old codebase.
This commit is contained in:
Dion Moult
2019-01-27 18:30:20 +11:00
parent 69f7789dca
commit 33078844e6
5 changed files with 199 additions and 3 deletions

View File

@@ -25,7 +25,7 @@ __title__="FreeCAD Arch Component"
__author__ = "Yorik van Havre"
__url__ = "http://www.freecadweb.org"
import FreeCAD,Draft,ArchCommands,math,sys,json,os
import FreeCAD,Draft,ArchCommands,math,sys,json,os,ifcopenshell
from FreeCAD import Vector
if FreeCAD.GuiUp:
import FreeCADGui
@@ -47,10 +47,12 @@ else:
# This module provides the base Arch component class, that
# is shared by all of the Arch BIM objects
with open(os.path.join(FreeCAD.getResourceDir(),"Mod","Arch","Presets","ifc_products.json")) as f:
with open(os.path.join(FreeCAD.getResourceDir(), "Mod", "Arch", "Presets",
"ifc_products_" + ifcopenshell.schema_identifier + ".json")) as f:
ifcProducts = json.load(f)
with open(os.path.join(FreeCAD.getResourceDir(),"Mod","Arch","Presets","ifc_types.json")) as f:
with open(os.path.join(FreeCAD.getResourceDir(), "Mod", "Arch", "Presets",
"ifc_types_" + ifcopenshell.schema_identifier + ".json")) as f:
ifcTypes = json.load(f)
# Possible roles for FreeCAD BIM objects

View File

@@ -0,0 +1,163 @@
{
"IfcActuator": { "attributes": [] },
"IfcAirTerminal": { "attributes": [] },
"IfcAirTerminalBox": { "attributes": [] },
"IfcAirToAirHeatRecovery": { "attributes": [] },
"IfcAlarm": { "attributes": [] },
"IfcAnnotation": { "attributes": [] },
"IfcAudioVisualAppliance": { "attributes": [] },
"IfcBeam": { "attributes": [] },
"IfcBeamStandardCase": { "attributes": [] },
"IfcBoiler": { "attributes": [] },
"IfcBuilding": { "attributes": [] },
"IfcBuildingElement": { "attributes": [] },
"IfcBuildingElementPart": { "attributes": [] },
"IfcBuildingElementProxy": { "attributes": [] },
"IfcBuildingStorey": { "attributes": [] },
"IfcBurner": { "attributes": [] },
"IfcCableCarrierFitting": { "attributes": [] },
"IfcCableCarrierSegment": { "attributes": [] },
"IfcCableFitting": { "attributes": [] },
"IfcCableSegment": { "attributes": [] },
"IfcChiller": { "attributes": [] },
"IfcChimney": { "attributes": [] },
"IfcCivilElement": { "attributes": [] },
"IfcCoil": { "attributes": [] },
"IfcColumn": { "attributes": [] },
"IfcColumnStandardCase": { "attributes": [] },
"IfcCommunicationsAppliance": { "attributes": [] },
"IfcCompressor": { "attributes": [] },
"IfcCondenser": { "attributes": [] },
"IfcController": { "attributes": [] },
"IfcCooledBeam": { "attributes": [] },
"IfcCoolingTower": { "attributes": [] },
"IfcCovering": { "attributes": [] },
"IfcCurtainWall": { "attributes": [] },
"IfcDamper": { "attributes": [] },
"IfcDiscreteAccessory": { "attributes": [] },
"IfcDistributionChamberElement": { "attributes": [] },
"IfcDistributionControlElement": { "attributes": [] },
"IfcDistributionElement": { "attributes": [] },
"IfcDistributionFlowElement": { "attributes": [] },
"IfcDistributionPort": { "attributes": [] },
"IfcDoor": { "attributes": [] },
"IfcDoorStandardCase": { "attributes": [] },
"IfcDuctFitting": { "attributes": [] },
"IfcDuctSegment": { "attributes": [] },
"IfcDuctSilencer": { "attributes": [] },
"IfcElectricAppliance": { "attributes": [] },
"IfcElectricDistributionBoard": { "attributes": [] },
"IfcElectricFlowStorageDevice": { "attributes": [] },
"IfcElectricGenerator": { "attributes": [] },
"IfcElectricMotor": { "attributes": [] },
"IfcElectricTimeControl": { "attributes": [] },
"IfcElementAssembly": { "attributes": [] },
"IfcElementComponent": { "attributes": [] },
"IfcEnergyConversionDevice": { "attributes": [] },
"IfcEngine": { "attributes": [] },
"IfcEvaporativeCooler": { "attributes": [] },
"IfcEvaporator": { "attributes": [] },
"IfcExternalSpatialElement": { "attributes": [] },
"IfcExternalSpatialStructureElement": { "attributes": [] },
"IfcFan": { "attributes": [] },
"IfcFastener": { "attributes": [] },
"IfcFeatureElement": { "attributes": [] },
"IfcFeatureElementAddition": { "attributes": [] },
"IfcFeatureElementSubtraction": { "attributes": [] },
"IfcFilter": { "attributes": [] },
"IfcFireSuppressionTerminal": { "attributes": [] },
"IfcFlowController": { "attributes": [] },
"IfcFlowFitting": { "attributes": [] },
"IfcFlowInstrument": { "attributes": [] },
"IfcFlowMeter": { "attributes": [] },
"IfcFlowMovingDevice": { "attributes": [] },
"IfcFlowSegment": { "attributes": [] },
"IfcFlowStorageDevice": { "attributes": [] },
"IfcFlowTerminal": { "attributes": [] },
"IfcFlowTreatmentDevice": { "attributes": [] },
"IfcFooting": { "attributes": [] },
"IfcFurnishingElement": { "attributes": [] },
"IfcFurniture": { "attributes": [] },
"IfcGeographicElement": { "attributes": [] },
"IfcGrid": { "attributes": [] },
"IfcHeatExchanger": { "attributes": [] },
"IfcHumidifier": { "attributes": [] },
"IfcInterceptor": { "attributes": [] },
"IfcJunctionBox": { "attributes": [] },
"IfcLamp": { "attributes": [] },
"IfcLightFixture": { "attributes": [] },
"IfcMechanicalFastener": { "attributes": [] },
"IfcMedicalDevice": { "attributes": [] },
"IfcMember": { "attributes": [] },
"IfcMemberStandardCase": { "attributes": [] },
"IfcMotorConnection": { "attributes": [] },
"IfcOpeningElement": { "attributes": [] },
"IfcOpeningStandardCase": { "attributes": [] },
"IfcOutlet": { "attributes": [] },
"IfcPile": { "attributes": [] },
"IfcPipeFitting": { "attributes": [] },
"IfcPipeSegment": { "attributes": [] },
"IfcPlate": { "attributes": [] },
"IfcPlateStandardCase": { "attributes": [] },
"IfcProjectionElement": { "attributes": [] },
"IfcProtectiveDevice": { "attributes": [] },
"IfcProtectiveDeviceTrippingUnit": { "attributes": [] },
"IfcProxy": { "attributes": [] },
"IfcPump": { "attributes": [] },
"IfcRailing": { "attributes": [] },
"IfcRamp": { "attributes": [] },
"IfcRampFlight": { "attributes": [] },
"IfcReinforcingBar": { "attributes": [] },
"IfcReinforcingMesh": { "attributes": [] },
"IfcRoof": { "attributes": [] },
"IfcSanitaryTerminal": { "attributes": [] },
"IfcSensor": { "attributes": [] },
"IfcShadingDevice": { "attributes": [] },
"IfcSite": { "attributes": [] },
"IfcSlab": { "attributes": [] },
"IfcSlabElementedCase": { "attributes": [] },
"IfcSlabStandardCase": { "attributes": [] },
"IfcSolarDevice": { "attributes": [] },
"IfcSpace": { "attributes": [] },
"IfcSpaceHeater": { "attributes": [] },
"IfcSpatialZone": { "attributes": [] },
"IfcStackTerminal": { "attributes": [] },
"IfcStair": { "attributes": [] },
"IfcStairFlight": { "attributes": [] },
"IfcStructuralCurveAction": { "attributes": [] },
"IfcStructuralCurveConnection": { "attributes": [] },
"IfcStructuralCurveMember": { "attributes": [] },
"IfcStructuralCurveMemberVarying": { "attributes": [] },
"IfcStructuralCurveReaction": { "attributes": [] },
"IfcStructuralLinearAction": { "attributes": [] },
"IfcStructuralPlanarAction": { "attributes": [] },
"IfcStructuralPointAction": { "attributes": [] },
"IfcStructuralPointConnection": { "attributes": [] },
"IfcStructuralPointReaction": { "attributes": [] },
"IfcStructuralSurfaceAction": { "attributes": [] },
"IfcStructuralSurfaceConnection": { "attributes": [] },
"IfcStructuralSurfaceMember": { "attributes": [] },
"IfcStructuralSurfaceMemberVarying": { "attributes": [] },
"IfcStructuralSurfaceReaction": { "attributes": [] },
"IfcSurfaceFeature": { "attributes": [] },
"IfcSwitchingDevice": { "attributes": [] },
"IfcSystemFurnitureElement": { "attributes": [] },
"IfcTank": { "attributes": [] },
"IfcTendon": { "attributes": [] },
"IfcTendonAnchor": { "attributes": [] },
"IfcTransformer": { "attributes": [] },
"IfcTransportElement": { "attributes": [] },
"IfcTubeBundle": { "attributes": [] },
"IfcUnitaryControlElement": { "attributes": [] },
"IfcUnitaryEquipment": { "attributes": [] },
"IfcValve": { "attributes": [] },
"IfcVibrationIsolator": { "attributes": [] },
"IfcVirtualElement": { "attributes": [] },
"IfcVoidingFeature": { "attributes": [] },
"IfcWall": { "attributes": [] },
"IfcWallElementedCase": { "attributes": [] },
"IfcWallStandardCase": { "attributes": [] },
"IfcWasteTerminal": { "attributes": [] },
"IfcWindow": { "attributes": [] },
"IfcWindowStandardCase": { "attributes": [] }
}

View File

@@ -0,0 +1,31 @@
{
"IfcInteger": {},
"IfcReal": {},
"IfcBoolean": {},
"IfcIdentifier": {},
"IfcText": {},
"IfcLabel": {},
"IfcLogical": {},
"IfcVolumeMeasure": {},
"IfcTimeMeasure": {},
"IfcThermodynamicTemperatureMeasure": {},
"IfcSolidAngleMeasure": {},
"IfcPositiveRatioMeasure": {},
"IfcRatioMeasure": {},
"IfcPositivePlaneAngleMeasure": {},
"IfcPlaneAngleMeasure": {},
"IfcParameterValue": {},
"IfcNumericMeasure": {},
"IfcMassMeasure": {},
"IfcPositiveLengthMeasure": {},
"IfcLengthMeasure": {},
"IfcElectricCurrentMeasure": {},
"IfcDescriptiveMeasure": {},
"IfcCountMeasure": {},
"IfcContextDependentMeasure": {},
"IfcAreaMeasure": {},
"IfcAmountOfSubstanceMeasure": {},
"IfcLuminousIntensityMeasure": {},
"IfcNormalisedRatioMeasure": {},
"IfcComplexNumber": {}
}