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 85ede1c72b
commit 240d0a9eb6
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