You can now access property sets online documentation through the right click context menu

This commit is contained in:
Gorgious56
2022-10-28 09:07:33 +02:00
parent 7164103a80
commit f38e8f26f5
2 changed files with 20 additions and 13 deletions
+11 -1
View File
@@ -134,12 +134,22 @@ def get_attribute_description(entity, attribute):
return get_attribute_doc(schema, entity, attribute)
def get_property_set_description(pset):
def get_property_set_docs(pset):
schema = tool.Ifc.get_schema()
if schema is not None:
return get_property_set_doc(schema, pset)
def get_property_set_properties(pset):
docs = get_property_set_docs(pset)
return docs.get("properties", {}) if docs is not None else {}
def get_property_set_doc_url(pset):
docs = get_property_set_docs(pset)
return docs.get("spec_url", "") if docs is not None else ""
def get_attribute_enum_values(prop, context):
# Support weird buildingSMART dictionary mappings which behave like enums
items = []
+9 -12
View File
@@ -23,7 +23,7 @@ from . import ifc
from bpy.types import Panel
from bpy.props import StringProperty, IntProperty, BoolProperty
from blenderbim.bim.helper import IfcHeaderExtractor
from blenderbim.bim.prop import get_ifc_entity_doc_url
from blenderbim.bim.prop import get_ifc_entity_doc_url, get_property_set_doc_url
import blenderbim.tool as tool
@@ -391,14 +391,11 @@ def draw_custom_context_menu(self, context):
prop_value = getattr(prop, prop_name, None)
if prop_value is None:
return
try:
url = get_ifc_entity_doc_url(prop_value)
except KeyError:
# TODO : support attributes, pset, etc.
pass
else:
if url:
layout = self.layout
layout.separator()
url_op = layout.operator("bim.open_webbrowser", icon="URL", text="Online IFC Documentation")
url_op.url = url
url = get_ifc_entity_doc_url(prop_value)
if not bool(url):
url = get_property_set_doc_url(prop_value)
if url:
layout = self.layout
layout.separator()
url_op = layout.operator("bim.open_webbrowser", icon="URL", text="Online IFC Documentation")
url_op.url = url