mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-12 14:33:28 +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)
|
return get_attribute_doc(schema, entity, attribute)
|
||||||
|
|
||||||
|
|
||||||
def get_property_set_description(pset):
|
def get_property_set_docs(pset):
|
||||||
schema = tool.Ifc.get_schema()
|
schema = tool.Ifc.get_schema()
|
||||||
if schema is not None:
|
if schema is not None:
|
||||||
return get_property_set_doc(schema, pset)
|
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):
|
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 = []
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ from . import ifc
|
|||||||
from bpy.types import Panel
|
from bpy.types import Panel
|
||||||
from bpy.props import StringProperty, IntProperty, BoolProperty
|
from bpy.props import StringProperty, IntProperty, BoolProperty
|
||||||
from blenderbim.bim.helper import IfcHeaderExtractor
|
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
|
import blenderbim.tool as tool
|
||||||
|
|
||||||
|
|
||||||
@@ -391,14 +391,11 @@ def draw_custom_context_menu(self, context):
|
|||||||
prop_value = getattr(prop, prop_name, None)
|
prop_value = getattr(prop, prop_name, None)
|
||||||
if prop_value is None:
|
if prop_value is None:
|
||||||
return
|
return
|
||||||
try:
|
url = get_ifc_entity_doc_url(prop_value)
|
||||||
url = get_ifc_entity_doc_url(prop_value)
|
if not bool(url):
|
||||||
except KeyError:
|
url = get_property_set_doc_url(prop_value)
|
||||||
# TODO : support attributes, pset, etc.
|
if url:
|
||||||
pass
|
layout = self.layout
|
||||||
else:
|
layout.separator()
|
||||||
if url:
|
url_op = layout.operator("bim.open_webbrowser", icon="URL", text="Online IFC Documentation")
|
||||||
layout = self.layout
|
url_op.url = url
|
||||||
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