mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 10:11:46 +00:00
Add Bonsai decorators toggle to Blender Viewport Overlays.
https://imgur.com/auQcp2Y
This commit is contained in:
@@ -191,6 +191,7 @@ classes = [
|
|||||||
# TODO: move this somewhere else and clean it up
|
# TODO: move this somewhere else and clean it up
|
||||||
ui.BIM_PT_section_plane,
|
ui.BIM_PT_section_plane,
|
||||||
ui.BIM_PT_section_with_cappings,
|
ui.BIM_PT_section_with_cappings,
|
||||||
|
ui.BIM_PT_decorators_overlay,
|
||||||
]
|
]
|
||||||
|
|
||||||
for mod in modules.values():
|
for mod in modules.values():
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ from bonsai.bim.prop import ObjProperty
|
|||||||
from bonsai.bim.module.model.data import AuthoringData
|
from bonsai.bim.module.model.data import AuthoringData
|
||||||
from bpy.types import PropertyGroup, NodeTree
|
from bpy.types import PropertyGroup, NodeTree
|
||||||
from math import pi, radians
|
from math import pi, radians
|
||||||
|
from bonsai.bim.module.model.decorator import WallAxisDecorator, SlabDirectionDecorator
|
||||||
|
|
||||||
|
|
||||||
def get_ifc_class(self, context):
|
def get_ifc_class(self, context):
|
||||||
@@ -82,6 +83,20 @@ def is_object_array_applicable(self, obj):
|
|||||||
return ifcopenshell.util.element.get_pset(element, "BBIM_Array")
|
return ifcopenshell.util.element.get_pset(element, "BBIM_Array")
|
||||||
|
|
||||||
|
|
||||||
|
def update_wall_axis_decorator(self, context):
|
||||||
|
if self.show_wall_axis:
|
||||||
|
WallAxisDecorator.install(bpy.context)
|
||||||
|
else:
|
||||||
|
WallAxisDecorator.uninstall()
|
||||||
|
|
||||||
|
|
||||||
|
def update_slab_direction_decorator(self, context):
|
||||||
|
if self.show_slab_direction:
|
||||||
|
SlabDirectionDecorator.install(bpy.context)
|
||||||
|
else:
|
||||||
|
SlabDirectionDecorator.uninstall()
|
||||||
|
|
||||||
|
|
||||||
class BIMModelProperties(PropertyGroup):
|
class BIMModelProperties(PropertyGroup):
|
||||||
ifc_class: bpy.props.EnumProperty(items=get_ifc_class, name="Construction Class", update=update_ifc_class)
|
ifc_class: bpy.props.EnumProperty(items=get_ifc_class, name="Construction Class", update=update_ifc_class)
|
||||||
relating_type_id: bpy.props.EnumProperty(
|
relating_type_id: bpy.props.EnumProperty(
|
||||||
@@ -162,6 +177,16 @@ class BIMModelProperties(PropertyGroup):
|
|||||||
description="It's a convention that affects the offset to reference line",
|
description="It's a convention that affects the offset to reference line",
|
||||||
)
|
)
|
||||||
offset: bpy.props.FloatProperty(name="Offset", default=0.0, description="Material usage offset from reference line")
|
offset: bpy.props.FloatProperty(name="Offset", default=0.0, description="Material usage offset from reference line")
|
||||||
|
show_wall_axis: bpy.props.BoolProperty(
|
||||||
|
name="Show Wall Axis",
|
||||||
|
default=False,
|
||||||
|
update=update_wall_axis_decorator,
|
||||||
|
)
|
||||||
|
show_slab_direction: bpy.props.BoolProperty(
|
||||||
|
name="Show Slab Direction",
|
||||||
|
default=False,
|
||||||
|
update=update_slab_direction_decorator,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class BIMArrayProperties(PropertyGroup):
|
class BIMArrayProperties(PropertyGroup):
|
||||||
|
|||||||
@@ -1190,3 +1190,37 @@ def draw_custom_context_menu(self: bpy.types.Menu, context: bpy.types.Context) -
|
|||||||
layout.separator()
|
layout.separator()
|
||||||
url_op = layout.operator("bim.open_uri", icon="URL", text="Online IFC Documentation")
|
url_op = layout.operator("bim.open_uri", icon="URL", text="Online IFC Documentation")
|
||||||
url_op.uri = url
|
url_op.uri = url
|
||||||
|
|
||||||
|
class BIM_PT_decorators_overlay(Panel):
|
||||||
|
bl_space_type = 'VIEW_3D'
|
||||||
|
bl_region_type = 'HEADER'
|
||||||
|
bl_parent_id = 'VIEW3D_PT_overlay'
|
||||||
|
bl_label = "Bonsai Decorators"
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def poll(cls, context):
|
||||||
|
return context.mode == 'OBJECT'
|
||||||
|
|
||||||
|
def draw(self, context):
|
||||||
|
layout = self.layout
|
||||||
|
|
||||||
|
view = context.space_data
|
||||||
|
overlay = view.overlay
|
||||||
|
|
||||||
|
geo_props = bpy.context.scene.BIMGeoreferenceProperties
|
||||||
|
agg_props = bpy.context.scene.BIMAggregateProperties
|
||||||
|
model_props = bpy.context.scene.BIMModelProperties
|
||||||
|
display_all = overlay.show_overlays
|
||||||
|
|
||||||
|
col = layout.column()
|
||||||
|
col.active = display_all
|
||||||
|
|
||||||
|
row = col.row(align=True)
|
||||||
|
row.prop(geo_props, "should_visualise", text="Georeference")
|
||||||
|
row.prop(geo_props, "visualization_scale", text="Size", slider=True)
|
||||||
|
row = col.row(align=True)
|
||||||
|
row.prop(agg_props, "aggregate_decorator", text="Aggregate")
|
||||||
|
row = col.row(align=True)
|
||||||
|
row.prop(model_props, "show_wall_axis", text="Wall Axis")
|
||||||
|
row = col.row(align=True)
|
||||||
|
row.prop(model_props, "show_slab_direction", text="Slab Direction")
|
||||||
|
|||||||
Reference in New Issue
Block a user