diff --git a/src/blenderbim/blenderbim/bim/module/constraint/prop.py b/src/blenderbim/blenderbim/bim/module/constraint/prop.py
index 003164345e..7f9fe99a13 100644
--- a/src/blenderbim/blenderbim/bim/module/constraint/prop.py
+++ b/src/blenderbim/blenderbim/bim/module/constraint/prop.py
@@ -17,7 +17,9 @@
# along with BlenderBIM Add-on. If not, see .
import bpy
-from blenderbim.bim.prop import StrProperty, Attribute, get_ifc_entity_description
+from ifcopenshell.util.doc import get_entity_doc
+import blenderbim.tool as tool
+from blenderbim.bim.prop import Attribute
from bpy.types import PropertyGroup
from bpy.props import (
PointerProperty,
@@ -32,7 +34,8 @@ from bpy.props import (
def get_available_constraint_types(self, context):
- return [(c, c, get_ifc_entity_description(c)) for c in ["IfcObjective"]]
+ version = tool.Ifc.get_schema()
+ return [(c, c, get_entity_doc(version, c).get("description", "")) for c in ["IfcObjective"]]
class Constraint(PropertyGroup):
diff --git a/src/blenderbim/blenderbim/bim/module/material/data.py b/src/blenderbim/blenderbim/bim/module/material/data.py
index 37171d2867..43983aab8b 100644
--- a/src/blenderbim/blenderbim/bim/module/material/data.py
+++ b/src/blenderbim/blenderbim/bim/module/material/data.py
@@ -21,7 +21,6 @@ import bpy
import ifcopenshell
import ifcopenshell.util.schema
import blenderbim.tool as tool
-from blenderbim.bim.prop import get_ifc_entity_description
def refresh():
@@ -66,9 +65,12 @@ class MaterialsData:
"IfcMaterialProfileSet",
"IfcMaterialList",
]
- if tool.Ifc.get_schema() == "IFC2X3":
+ version = tool.Ifc.get_schema()
+ if version == "IFC2X3":
material_types = ["IfcMaterial", "IfcMaterialLayerSet", "IfcMaterialList"]
- return [(m, m, get_ifc_entity_description(m)) for m in material_types]
+ return [
+ (m, m, ifcopenshell.util.doc.get_entity_doc(version, m).get("description", "")) for m in material_types
+ ]
class ObjectMaterialData:
diff --git a/src/blenderbim/blenderbim/bim/module/material/prop.py b/src/blenderbim/blenderbim/bim/module/material/prop.py
index adad4522bc..017ef6ddfa 100644
--- a/src/blenderbim/blenderbim/bim/module/material/prop.py
+++ b/src/blenderbim/blenderbim/bim/module/material/prop.py
@@ -17,10 +17,12 @@
# along with BlenderBIM Add-on. If not, see .
import bpy
+from ifcopenshell.util.doc import get_entity_doc
from ifcopenshell.api.material.data import Data
+import blenderbim.tool as tool
from blenderbim.bim.module.material.data import MaterialsData, ObjectMaterialData
from blenderbim.bim.ifc import IfcStore
-from blenderbim.bim.prop import StrProperty, Attribute, get_ifc_entity_description
+from blenderbim.bim.prop import StrProperty, Attribute
from bpy.types import PropertyGroup
from bpy.props import (
PointerProperty,
@@ -50,9 +52,11 @@ def purge():
def get_profile_classes(self, context):
global profileclasses_enum
if len(profileclasses_enum) == 0 and IfcStore.get_schema():
+ version = tool.Ifc.get_schema()
profileclasses_enum.clear()
profileclasses_enum = [
- (t.name(), t.name(), get_ifc_entity_description(t.name())) for t in IfcStore.get_schema().declaration_by_name("IfcProfileDef").subtypes()
+ (t.name(), t.name(), get_entity_doc(version, t.name()).get("description", ""))
+ for t in IfcStore.get_schema().declaration_by_name("IfcProfileDef").subtypes()
]
return profileclasses_enum
@@ -60,15 +64,16 @@ def get_profile_classes(self, context):
def get_parameterized_profile_classes(self, context):
global parameterizedprofileclasses_enum
if len(parameterizedprofileclasses_enum) == 0 and IfcStore.get_schema():
+ version = tool.Ifc.get_schema()
parameterizedprofileclasses_enum.clear()
parameterizedprofileclasses_enum = [
- (t.name(), t.name(), get_ifc_entity_description(t.name()))
+ (t.name(), t.name(), get_entity_doc(version, t.name()).get("description", ""))
for t in IfcStore.get_schema().declaration_by_name("IfcParameterizedProfileDef").subtypes()
]
for ifc_class in parameterizedprofileclasses_enum:
parameterizedprofileclasses_enum.extend(
[
- (t.name(), t.name(), get_ifc_entity_description(t.name()))
+ (t.name(), t.name(), get_entity_doc(version, t.name()).get("description", ""))
for t in IfcStore.get_schema().declaration_by_name(ifc_class[0]).subtypes() or []
]
)
@@ -93,10 +98,11 @@ def get_object_material_types(self, context):
"IfcMaterialProfileSetUsage",
"IfcMaterialList",
]
- if IfcStore.get_file().schema == "IFC2X3":
+ version = tool.Ifc.get_schema()
+ if version == "IFC2X3":
material_types = ["IfcMaterial", "IfcMaterialLayerSet", "IfcMaterialLayerSetUsage", "IfcMaterialList"]
materialtypes_enum.clear()
- materialtypes_enum = [(m, m, get_ifc_entity_description(m)) for m in material_types]
+ materialtypes_enum = [(m, m, get_entity_doc(version, m).get("description", "")) for m in material_types]
return materialtypes_enum
diff --git a/src/blenderbim/blenderbim/bim/module/model/data.py b/src/blenderbim/blenderbim/bim/module/model/data.py
index 9aec066036..f980ef9c75 100644
--- a/src/blenderbim/blenderbim/bim/module/model/data.py
+++ b/src/blenderbim/blenderbim/bim/module/model/data.py
@@ -22,10 +22,11 @@ import json
import functools
import ifcopenshell
import ifcopenshell.util.element
+from ifcopenshell.util.doc import get_entity_doc
import blenderbim.tool as tool
from blenderbim.bim.ifc import IfcStore
from blenderbim.bim.module.model.root import ConstrTypeEntityNotFound
-from blenderbim.bim.prop import get_ifc_entity_description, get_predefined_type_description
+from blenderbim.bim.prop import get_predefined_type_description
def refresh():
@@ -64,7 +65,8 @@ class AuthoringData:
declarations = ifcopenshell.util.schema.get_subtypes(declaration)
names = [d.name() for d in declarations]
names.extend(("IfcDoorStyle", "IfcWindowStyle"))
- return [(c, c, get_ifc_entity_description(c)) for c in sorted(names)]
+ version = tool.Ifc.get_schema()
+ return [(c, c, get_entity_doc(version, c).get("description", "")) for c in sorted(names)]
@classmethod
def type_predefined_type(cls):
diff --git a/src/blenderbim/blenderbim/bim/module/owner/prop.py b/src/blenderbim/blenderbim/bim/module/owner/prop.py
index b2466041ba..1884a4f719 100644
--- a/src/blenderbim/blenderbim/bim/module/owner/prop.py
+++ b/src/blenderbim/blenderbim/bim/module/owner/prop.py
@@ -17,7 +17,9 @@
# along with BlenderBIM Add-on. If not, see .
import bpy
-from blenderbim.bim.prop import StrProperty, Attribute, get_ifc_entity_description
+from ifcopenshell.util.doc import get_entity_doc
+import blenderbim.tool as tool
+from blenderbim.bim.prop import StrProperty, Attribute
from blenderbim.bim.module.owner.data import OwnerData, ActorData, ObjectActorData
from bpy.types import PropertyGroup
from bpy.props import (
@@ -65,17 +67,19 @@ def update_actor_class(self, context):
def get_actor_class_enum(self, context):
+ version = tool.Ifc.get_schema()
return [
- ("IfcActor", "Actor", get_ifc_entity_description("IfcActor")),
- ("IfcOccupant", "Occupant", get_ifc_entity_description("IfcOccupant")),
+ ("IfcActor", "Actor", get_entity_doc(version, "IfcActor").get("description", "")),
+ ("IfcOccupant", "Occupant", get_entity_doc(version, "IfcOccupant").get("description", "")),
]
def get_actor_type_enum(self, context):
+ version = tool.Ifc.get_schema()
return [
- ("IfcPerson", "Person", get_ifc_entity_description("IfcPerson")),
- ("IfcOrganization", "Organisation", get_ifc_entity_description("IfcOrganization")),
- ("IfcPersonAndOrganization", "User", get_ifc_entity_description("IfcPersonAndOrganization")),
+ ("IfcPerson", "Person", get_entity_doc(version, "IfcPerson").get("description", "")),
+ ("IfcOrganization", "Organisation", get_entity_doc(version, "IfcOrganization").get("description", "")),
+ ("IfcPersonAndOrganization", "User", get_entity_doc(version, "IfcPersonAndOrganization").get("description", "")),
]
diff --git a/src/blenderbim/blenderbim/bim/module/pset/data.py b/src/blenderbim/blenderbim/bim/module/pset/data.py
index 74cb0b353e..aa4c81fe6a 100644
--- a/src/blenderbim/blenderbim/bim/module/pset/data.py
+++ b/src/blenderbim/blenderbim/bim/module/pset/data.py
@@ -175,6 +175,6 @@ class AddEditCustomPropertiesData:
schema = tool.Ifc.schema()
version = tool.Ifc.get_schema()
return [
- (t, t, ifcopenshell.util.doc.get_type_doc(version, t).get("description"))
+ (t, t, ifcopenshell.util.doc.get_type_doc(version, t).get("description", ""))
for t in sorted([d.name() for d in schema.declarations() if hasattr(d, "declared_type")])
]
diff --git a/src/blenderbim/blenderbim/bim/module/pset/prop.py b/src/blenderbim/blenderbim/bim/module/pset/prop.py
index 26441fc876..083ba585a9 100644
--- a/src/blenderbim/blenderbim/bim/module/pset/prop.py
+++ b/src/blenderbim/blenderbim/bim/module/pset/prop.py
@@ -146,7 +146,7 @@ def get_qto_names(self, context):
def get_template_type(self, context):
version = tool.Ifc.get_schema()
for t in ("IfcPropertySingleValue", "IfcPropertyEnumeratedValue"):
- yield (t, t, ifcopenshell.util.doc.get_entity_doc(version, t).get("description"))
+ yield (t, t, ifcopenshell.util.doc.get_entity_doc(version, t).get("description", ""))
def get_primary_measure_type(self, context):
diff --git a/src/blenderbim/blenderbim/bim/module/pset_template/data.py b/src/blenderbim/blenderbim/bim/module/pset_template/data.py
index 5481e50211..8af3a19bbb 100644
--- a/src/blenderbim/blenderbim/bim/module/pset_template/data.py
+++ b/src/blenderbim/blenderbim/bim/module/pset_template/data.py
@@ -21,7 +21,6 @@ import bpy
import ifcopenshell
import blenderbim.tool as tool
from blenderbim.bim.ifc import IfcStore
-from blenderbim.bim.prop import get_ifc_entity_description
def refresh():
@@ -46,7 +45,7 @@ class PsetTemplatesData:
schema = tool.Ifc.schema()
version = tool.Ifc.get_schema()
return [
- (t, t, ifcopenshell.util.doc.get_type_doc(version, t).get("description"))
+ (t, t, ifcopenshell.util.doc.get_type_doc(version, t).get("description", ""))
for t in sorted([d.name() for d in schema.declarations() if hasattr(d, "declared_type")])
]
diff --git a/src/blenderbim/blenderbim/bim/module/root/data.py b/src/blenderbim/blenderbim/bim/module/root/data.py
index c91da4dfa6..cedd5b8ef7 100644
--- a/src/blenderbim/blenderbim/bim/module/root/data.py
+++ b/src/blenderbim/blenderbim/bim/module/root/data.py
@@ -19,9 +19,10 @@
from collections import defaultdict
import bpy
import ifcopenshell.util.element
+from ifcopenshell.util.doc import get_entity_doc
import blenderbim.tool as tool
from blenderbim.bim.ifc import IfcStore
-from blenderbim.bim.prop import get_ifc_entity_description, get_predefined_type_description
+from blenderbim.bim.prop import get_predefined_type_description
def refresh():
@@ -57,7 +58,8 @@ class IfcClassData:
"IfcAnnotation",
"IfcRelSpaceBoundary",
]
- if tool.Ifc.get_schema() == "IFC2X3":
+ version = tool.Ifc.get_schema()
+ if version == "IFC2X3":
products = [
"IfcElement",
"IfcElementType",
@@ -67,7 +69,7 @@ class IfcClassData:
"IfcAnnotation",
"IfcRelSpaceBoundary",
]
- return [(e, e, get_ifc_entity_description(e)) for e in products]
+ return [(e, e, get_entity_doc(version, e).get("description", "")) for e in products]
@classmethod
def ifc_classes(cls):
@@ -77,7 +79,8 @@ class IfcClassData:
names = [d.name() for d in declarations]
if ifc_product == "IfcElementType":
names.extend(("IfcDoorStyle", "IfcWindowStyle"))
- return [(c, c, get_ifc_entity_description(c)) for c in sorted(names)]
+ version = tool.Ifc.get_schema()
+ return [(c, c, get_entity_doc(version, c).get("description", "")) for c in sorted(names)]
@classmethod
def ifc_predefined_types(cls):
diff --git a/src/blenderbim/blenderbim/bim/module/structural/prop.py b/src/blenderbim/blenderbim/bim/module/structural/prop.py
index 3397157687..ac1a6a0f6d 100644
--- a/src/blenderbim/blenderbim/bim/module/structural/prop.py
+++ b/src/blenderbim/blenderbim/bim/module/structural/prop.py
@@ -16,11 +16,13 @@
# You should have received a copy of the GNU General Public License
# along with BlenderBIM Add-on. If not, see .
-import bpy
-from blenderbim.bim.ifc import IfcStore
from math import radians
-from blenderbim.bim.prop import StrProperty, Attribute, get_ifc_entity_description
+import bpy
from ifcopenshell.api.structural.data import Data
+from ifcopenshell.util.doc import get_entity_doc
+import blenderbim.tool as tool
+from blenderbim.bim.ifc import IfcStore
+from blenderbim.bim.prop import StrProperty, Attribute
from bpy.types import PropertyGroup
from bpy.props import (
PointerProperty,
@@ -89,8 +91,12 @@ def get_structural_load_types(self, context):
file = IfcStore.get_file()
if len(structuralloadtypes_enum) < 1 and file:
declaration = IfcStore.get_schema().declaration_by_name("IfcStructuralLoadStatic")
+ version = tool.Ifc.get_schema()
structuralloadtypes_enum.extend(
- [(d.name(), d.name(), get_ifc_entity_description(d.name())) for d in declaration.subtypes()]
+ [
+ (d.name(), d.name(), get_entity_doc(version, d.name()).get("description", ""))
+ for d in declaration.subtypes()
+ ]
)
return structuralloadtypes_enum
@@ -99,8 +105,10 @@ def get_boundary_condition_types(self, context):
file = IfcStore.get_file()
if file:
declaration = IfcStore.get_schema().declaration_by_name("IfcBoundaryCondition")
+ version = tool.Ifc.get_schema()
boundaryconditiontypes_enum = [
- (d.name(), d.name(), get_ifc_entity_description(d.name())) for d in declaration.subtypes()
+ (d.name(), d.name(), get_entity_doc(version, d.name()).get("description", ""))
+ for d in declaration.subtypes()
]
return boundaryconditiontypes_enum
return []
diff --git a/src/blenderbim/blenderbim/bim/module/style/data.py b/src/blenderbim/blenderbim/bim/module/style/data.py
index df9da618a1..7801122228 100644
--- a/src/blenderbim/blenderbim/bim/module/style/data.py
+++ b/src/blenderbim/blenderbim/bim/module/style/data.py
@@ -17,9 +17,9 @@
# along with BlenderBIM Add-on. If not, see .
import bpy
-import blenderbim.tool as tool
import ifcopenshell
-from blenderbim.bim.prop import get_ifc_entity_description
+from ifcopenshell.util.doc import get_entity_doc
+import blenderbim.tool as tool
def refresh():
@@ -39,7 +39,10 @@ class StylesData:
def style_types(cls):
declaration = tool.Ifc.schema().declaration_by_name("IfcPresentationStyle")
declarations = ifcopenshell.util.schema.get_subtypes(declaration)
- return [(c, c, get_ifc_entity_description(c)) for c in sorted([d.name() for d in declarations])]
+ version = tool.Ifc.get_schema()
+ return [
+ (c, c, get_entity_doc(version, c).get("description", "")) for c in sorted([d.name() for d in declarations])
+ ]
@classmethod
def total_styles(cls):
diff --git a/src/blenderbim/blenderbim/bim/module/system/data.py b/src/blenderbim/blenderbim/bim/module/system/data.py
index 244972f75d..22060e9c42 100644
--- a/src/blenderbim/blenderbim/bim/module/system/data.py
+++ b/src/blenderbim/blenderbim/bim/module/system/data.py
@@ -19,8 +19,8 @@
import bpy
import ifcopenshell
import ifcopenshell.util.schema
+from ifcopenshell.util.doc import get_entity_doc
import blenderbim.tool as tool
-from blenderbim.bim.prop import get_ifc_entity_description
def refresh():
@@ -45,9 +45,10 @@ class SystemData:
def system_class(cls):
declaration = tool.Ifc.schema().declaration_by_name("IfcSystem")
declarations = ifcopenshell.util.schema.get_subtypes(declaration)
+ version = tool.Ifc.get_schema()
# We're only interested in systems for services. Not sure why IFC groups these together.
return [
- (c, c, get_ifc_entity_description(c))
+ (c, c, get_entity_doc(version, c).get("description", ""))
for c in sorted([d.name() for d in declarations])
if c not in ("IfcZone", "IfcStructuralAnalysisModel")
]
diff --git a/src/blenderbim/blenderbim/bim/module/type/data.py b/src/blenderbim/blenderbim/bim/module/type/data.py
index 0a5470479f..1d23c3363f 100644
--- a/src/blenderbim/blenderbim/bim/module/type/data.py
+++ b/src/blenderbim/blenderbim/bim/module/type/data.py
@@ -19,8 +19,8 @@
import bpy
import ifcopenshell.util.type
import ifcopenshell.util.element
+from ifcopenshell.util.doc import get_entity_doc
import blenderbim.tool as tool
-from blenderbim.bim.prop import get_ifc_entity_description
def refresh():
@@ -54,8 +54,9 @@ class TypeData:
element = tool.Ifc.get_entity(obj)
if not element:
return []
- types = ifcopenshell.util.type.get_applicable_types(element.is_a(), schema=tool.Ifc.get_schema())
- results.extend((t, t, get_ifc_entity_description(t)) for t in types)
+ version = tool.Ifc.get_schema()
+ types = ifcopenshell.util.type.get_applicable_types(element.is_a(), schema=version)
+ results.extend((t, t, get_entity_doc(version, t).get("description", "")) for t in types)
return results
@classmethod
@@ -87,7 +88,4 @@ class TypeData:
element = tool.Ifc.get_entity(bpy.context.active_object)
element_type = ifcopenshell.util.element.get_type(element)
if element_type:
- return {
- "id": element_type.id(),
- "name":f"{element_type.is_a()}/{element_type.Name or 'Unnamed'}"
- }
+ return {"id": element_type.id(), "name": f"{element_type.is_a()}/{element_type.Name or 'Unnamed'}"}
diff --git a/src/blenderbim/blenderbim/bim/module/unit/data.py b/src/blenderbim/blenderbim/bim/module/unit/data.py
index 7b75b59eac..95383dbdf9 100644
--- a/src/blenderbim/blenderbim/bim/module/unit/data.py
+++ b/src/blenderbim/blenderbim/bim/module/unit/data.py
@@ -20,8 +20,8 @@ import ifcopenshell
import ifcopenshell.util.unit
import ifcopenshell.util.schema
import ifcopenshell.util.attribute
+from ifcopenshell.util.doc import get_entity_doc
import blenderbim.tool as tool
-from blenderbim.bim.prop import get_ifc_entity_description
def refresh():
@@ -45,8 +45,20 @@ class UnitsData:
@classmethod
def unit_classes(cls):
declarations = ifcopenshell.util.schema.get_subtypes(tool.Ifc.schema().declaration_by_name("IfcNamedUnit"))
- results = [(c, c, get_ifc_entity_description(c)) for c in sorted([d.name() for d in declarations])]
- results.extend([("IfcDerivedUnit", "IfcDerivedUnit", ""), ("IfcMonetaryUnit", "IfcMonetaryUnit", "")])
+ version = tool.Ifc.get_schema()
+ results = [
+ (c, c, get_entity_doc(version, c).get("description", "")) for c in sorted([d.name() for d in declarations])
+ ]
+ results.extend(
+ [
+ ("IfcDerivedUnit", "IfcDerivedUnit", get_entity_doc(version, "IfcDerivedUnit").get("description", "")),
+ (
+ "IfcMonetaryUnit",
+ "IfcMonetaryUnit",
+ get_entity_doc(version, "IfcMonetaryUnit").get("description", ""),
+ ),
+ ]
+ )
return results
@classmethod
diff --git a/src/blenderbim/blenderbim/bim/operator.py b/src/blenderbim/blenderbim/bim/operator.py
index 2989d9797b..416cce6bfb 100644
--- a/src/blenderbim/blenderbim/bim/operator.py
+++ b/src/blenderbim/blenderbim/bim/operator.py
@@ -29,7 +29,7 @@ import blenderbim.tool as tool
from . import schema
from blenderbim.bim import import_ifc
from blenderbim.bim.ifc import IfcStore
-from blenderbim.bim.prop import StrProperty, get_ifc_entity_doc_url
+from blenderbim.bim.prop import StrProperty
from blenderbim.bim.ui import IFCFileSelector
from blenderbim.bim.helper import get_enum_items
from mathutils import Vector, Matrix, Euler
@@ -706,7 +706,9 @@ class BIM_OT_show_description(bpy.types.Operator):
wrapper = textwrap.TextWrapper(width=80)
for line in wrapper.wrap(self.description):
layout.label(text=line)
- url = get_ifc_entity_doc_url(self.ifc_class)
+ version = tool.Ifc.get_schema()
+ doc = ifcopenshell.util.doc.get_entity_doc(version, self.ifc_class)
+ url = doc.get("spec_url")
if url:
url_op = layout.operator("bim.open_webbrowser", icon="URL", text="Online IFC Documentation")
url_op.url = url
diff --git a/src/blenderbim/blenderbim/bim/prop.py b/src/blenderbim/blenderbim/bim/prop.py
index f419c92b5c..b52fe6746f 100644
--- a/src/blenderbim/blenderbim/bim/prop.py
+++ b/src/blenderbim/blenderbim/bim/prop.py
@@ -106,22 +106,6 @@ def cache_string(s):
cache_string.data = {}
-def get_ifc_entity_docs(ifc_entity):
- schema = tool.Ifc.get_schema()
- if schema is not None:
- return get_entity_doc(schema, ifc_entity)
-
-
-def get_ifc_entity_description(ifc_entity):
- docs = get_ifc_entity_docs(ifc_entity)
- return docs.get("description", "") if docs is not None else ""
-
-
-def get_ifc_entity_doc_url(ifc_entity):
- docs = get_ifc_entity_docs(ifc_entity)
- return docs.get("spec_url", "") if docs is not None else ""
-
-
def get_predefined_type_description(entity, predefined_type):
schema = tool.Ifc.get_schema()
if schema is not None:
diff --git a/src/blenderbim/blenderbim/bim/ui.py b/src/blenderbim/blenderbim/bim/ui.py
index 00789c0c9b..51d9aab752 100644
--- a/src/blenderbim/blenderbim/bim/ui.py
+++ b/src/blenderbim/blenderbim/bim/ui.py
@@ -401,21 +401,21 @@ def draw_custom_context_menu(self, context):
prop_value = getattr(prop, prop_name, None)
if prop_value is None:
return
- schema = tool.Ifc.get_schema()
+ version = tool.Ifc.get_schema()
docs = {}
try:
- docs = get_entity_doc(schema, prop_value)
+ docs = get_entity_doc(version, prop_value)
if docs is None:
raise RuntimeError
except RuntimeError:
try:
- docs = get_type_doc(schema, prop_value)
+ docs = get_type_doc(version, prop_value)
if docs is None:
raise RuntimeError
except RuntimeError:
try:
- docs = get_property_set_doc(schema, prop_value)
+ docs = get_property_set_doc(version, prop_value)
if docs is None:
raise RuntimeError
except RuntimeError: