Directly use attribute doc functions instead of wrapper

This commit is contained in:
Gorgious
2022-10-31 18:01:59 +01:00
parent ee59d366dc
commit eff3318399
2 changed files with 5 additions and 12 deletions
+5 -2
View File
@@ -23,10 +23,12 @@ import math
import zipfile import zipfile
import ifcopenshell import ifcopenshell
import ifcopenshell.util.attribute import ifcopenshell.util.attribute
from ifcopenshell.util.doc import get_attribute_doc
from mathutils import geometry from mathutils import geometry
from mathutils import Vector from mathutils import Vector
import blenderbim.tool as tool
from blenderbim.bim.ifc import IfcStore from blenderbim.bim.ifc import IfcStore
from blenderbim.bim.prop import get_attribute_description, get_predefined_type_description from blenderbim.bim.prop import get_predefined_type_description
def draw_attributes(props, layout, copy_operator=None): def draw_attributes(props, layout, copy_operator=None):
@@ -123,7 +125,8 @@ def add_attribute_enum_items_descriptions(attribute_blender, enum_items):
def add_attribute_description(attribute_blender): def add_attribute_description(attribute_blender):
if not attribute_blender.name: if not attribute_blender.name:
return return
description = get_attribute_description(attribute_blender.ifc_class, attribute_blender.name) version = tool.Ifc.get_schema()
description = get_attribute_doc(version, attribute_blender.ifc_class, attribute_blender.name)
if description: if description:
attribute_blender.description = description attribute_blender.description = description
-10
View File
@@ -115,16 +115,6 @@ def get_predefined_type_description(entity, predefined_type):
return "" return ""
def get_attribute_description(entity, attribute):
schema = tool.Ifc.get_schema()
if schema is not None:
try:
doc = get_attribute_doc(schema, entity, attribute)
except KeyError: # This entity doesn't have any attribute or doesn't implement this attribute
pass
return doc
def get_attribute_enum_values(prop, context): def get_attribute_enum_values(prop, context):
# Support weird buildingSMART dictionary mappings which behave like enums # Support weird buildingSMART dictionary mappings which behave like enums
items = [] items = []