From bdfdf77ffcfce934834a0f3a30d9c566dbd0e676 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Mon, 19 Aug 2019 21:02:53 +1000 Subject: [PATCH] Add contexts file for IFC2X3 --- src/Mod/Arch/ArchIFCSchema.py | 11 ---- src/Mod/Arch/CMakeLists.txt | 1 + src/Mod/Arch/Presets/ifc_contexts_IFC2X3.json | 66 +++++++++++++++++++ 3 files changed, 67 insertions(+), 11 deletions(-) create mode 100644 src/Mod/Arch/Presets/ifc_contexts_IFC2X3.json diff --git a/src/Mod/Arch/ArchIFCSchema.py b/src/Mod/Arch/ArchIFCSchema.py index b6486544df..33d971d8ab 100644 --- a/src/Mod/Arch/ArchIFCSchema.py +++ b/src/Mod/Arch/ArchIFCSchema.py @@ -3,20 +3,9 @@ import FreeCAD, os, json ifcVersions = ["IFC4", "IFC2X3"] IfcVersion = ifcVersions[FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch").GetInt("IfcVersion",0)] -# BEGIN FIXME -# the file ifc_contexts_IFC2x3.json is missing at all in sources -# All Arch module is broken if pref is set to IFC2x3 -# we will use the IFC4 one instead, to get back the Arch module -# Still lots of stuff does not work, but at least the Arch loads -''' with open(os.path.join(FreeCAD.getResourceDir(), "Mod", "Arch", "Presets", "ifc_contexts_" + IfcVersion + ".json")) as f: IfcContexts = json.load(f) -''' -with open(os.path.join(FreeCAD.getResourceDir(), "Mod", "Arch", "Presets", -"ifc_contexts_" + "IFC4" + ".json")) as f: - IfcContexts = json.load(f) -# END FIXME with open(os.path.join(FreeCAD.getResourceDir(), "Mod", "Arch", "Presets", "ifc_products_" + IfcVersion + ".json")) as f: diff --git a/src/Mod/Arch/CMakeLists.txt b/src/Mod/Arch/CMakeLists.txt index e317fb00ec..093ba9e7f7 100644 --- a/src/Mod/Arch/CMakeLists.txt +++ b/src/Mod/Arch/CMakeLists.txt @@ -66,6 +66,7 @@ SET(Arch_presets Presets/ifc_products_IFC4.json Presets/ifc_types_IFC2X3.json Presets/ifc_types_IFC4.json + Presets/ifc_contexts_IFC2X3.json Presets/ifc_contexts_IFC4.json ) diff --git a/src/Mod/Arch/Presets/ifc_contexts_IFC2X3.json b/src/Mod/Arch/Presets/ifc_contexts_IFC2X3.json new file mode 100644 index 0000000000..748d1784ca --- /dev/null +++ b/src/Mod/Arch/Presets/ifc_contexts_IFC2X3.json @@ -0,0 +1,66 @@ +{ + "IfcProject": { + "is_abstract": false, + "parent": "IfcObject", + "attributes": [ + { + "name": "GlobalId", + "type": "IfcGloballyUniqueId", + "is_enum": false, + "enum_values": [] + }, + { + "name": "Name", + "type": "IfcLabel", + "is_enum": false, + "enum_values": [] + }, + { + "name": "Description", + "type": "IfcText", + "is_enum": false, + "enum_values": [] + }, + { + "name": "ObjectType", + "type": "IfcLabel", + "is_enum": false, + "enum_values": [] + }, + { + "name": "LongName", + "type": "IfcLabel", + "is_enum": false, + "enum_values": [] + }, + { + "name": "Phase", + "type": "IfcLabel", + "is_enum": false, + "enum_values": [] + } + ], + "complex_attributes": [ + { + "name": "OwnerHistory", + "type": "IfcOwnerHistory" + }, + { + "name": "IsDecomposedBy", + "type": "IfcRelAggregates" + }, + { + "name": "RepresentationContexts", + "type": "IfcRepresentationContext" + }, + { + "name": "UnitsInContext", + "type": "IfcUnitAssignment" + }, + { + "name": "IsDefinedBy", + "type": "IfcRelDefinesByProperties" + } + ] + } +}