mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
You can now access property sets online documentation through the right click context menu
This commit is contained in:
@@ -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 = []
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user