mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
New placement panel to consolidate placement data in geometry tab
This commit is contained in:
@@ -49,10 +49,11 @@ classes = (
|
|||||||
operator.UpdateRepresentation,
|
operator.UpdateRepresentation,
|
||||||
prop.BIMObjectGeometryProperties,
|
prop.BIMObjectGeometryProperties,
|
||||||
prop.BIMGeometryProperties,
|
prop.BIMGeometryProperties,
|
||||||
ui.BIM_PT_derived_placements,
|
ui.BIM_PT_placement,
|
||||||
ui.BIM_PT_representations,
|
ui.BIM_PT_representations,
|
||||||
ui.BIM_PT_connections,
|
ui.BIM_PT_connections,
|
||||||
ui.BIM_PT_mesh,
|
ui.BIM_PT_mesh,
|
||||||
|
ui.BIM_PT_derived_coordinates,
|
||||||
ui.BIM_PT_workarounds,
|
ui.BIM_PT_workarounds,
|
||||||
ui.BIM_MT_object_set_origin,
|
ui.BIM_MT_object_set_origin,
|
||||||
ui.BIM_MT_separate,
|
ui.BIM_MT_separate,
|
||||||
@@ -72,7 +73,6 @@ def register():
|
|||||||
|
|
||||||
bpy.types.Object.BIMGeometryProperties = bpy.props.PointerProperty(type=prop.BIMObjectGeometryProperties)
|
bpy.types.Object.BIMGeometryProperties = bpy.props.PointerProperty(type=prop.BIMObjectGeometryProperties)
|
||||||
bpy.types.Scene.BIMGeometryProperties = bpy.props.PointerProperty(type=prop.BIMGeometryProperties)
|
bpy.types.Scene.BIMGeometryProperties = bpy.props.PointerProperty(type=prop.BIMGeometryProperties)
|
||||||
bpy.types.OBJECT_PT_transform.append(ui.BIM_PT_transform)
|
|
||||||
bpy.types.VIEW3D_MT_object.append(ui.object_menu)
|
bpy.types.VIEW3D_MT_object.append(ui.object_menu)
|
||||||
bpy.types.OUTLINER_MT_object.append(ui.outliner_menu)
|
bpy.types.OUTLINER_MT_object.append(ui.outliner_menu)
|
||||||
bpy.types.VIEW3D_MT_object_context_menu.append(ui.object_menu)
|
bpy.types.VIEW3D_MT_object_context_menu.append(ui.object_menu)
|
||||||
@@ -117,7 +117,6 @@ def register():
|
|||||||
|
|
||||||
def unregister():
|
def unregister():
|
||||||
bpy.types.VIEW3D_MT_object.remove(ui.object_menu)
|
bpy.types.VIEW3D_MT_object.remove(ui.object_menu)
|
||||||
bpy.types.OBJECT_PT_transform.remove(ui.BIM_PT_transform)
|
|
||||||
bpy.types.OUTLINER_MT_object.remove(ui.outliner_menu)
|
bpy.types.OUTLINER_MT_object.remove(ui.outliner_menu)
|
||||||
bpy.types.VIEW3D_MT_object_context_menu.remove(ui.outliner_menu)
|
bpy.types.VIEW3D_MT_object_context_menu.remove(ui.outliner_menu)
|
||||||
bpy.types.VIEW3D_MT_edit_mesh.remove(ui.edit_mesh_menu)
|
bpy.types.VIEW3D_MT_edit_mesh.remove(ui.edit_mesh_menu)
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ from mathutils import Vector
|
|||||||
|
|
||||||
|
|
||||||
def refresh():
|
def refresh():
|
||||||
DerivedPlacementsData.is_loaded = False
|
PlacementData.is_loaded = False
|
||||||
|
DerivedCoordinatesData.is_loaded = False
|
||||||
RepresentationsData.is_loaded = False
|
RepresentationsData.is_loaded = False
|
||||||
ConnectionsData.is_loaded = False
|
ConnectionsData.is_loaded = False
|
||||||
|
|
||||||
@@ -184,7 +185,7 @@ class ConnectionsData:
|
|||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
||||||
class DerivedPlacementsData:
|
class DerivedCoordinatesData:
|
||||||
data = {}
|
data = {}
|
||||||
is_loaded = False
|
is_loaded = False
|
||||||
|
|
||||||
@@ -263,6 +264,25 @@ class DerivedPlacementsData:
|
|||||||
for i, storey in enumerate(storeys):
|
for i, storey in enumerate(storeys):
|
||||||
if storey[0] != element:
|
if storey[0] != element:
|
||||||
continue
|
continue
|
||||||
if i >= len(storeys):
|
if i >= len(storeys) - 1:
|
||||||
return "N/A"
|
return "N/A"
|
||||||
return "{0:.3f}".format(round(storeys[i + 1][1] - storey[1], 3))
|
return "{0:.3f}".format(round(storeys[i + 1][1] - storey[1], 3))
|
||||||
|
|
||||||
|
|
||||||
|
class PlacementData:
|
||||||
|
data = {}
|
||||||
|
is_loaded = False
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def load(cls):
|
||||||
|
cls.data = {
|
||||||
|
"has_placement": cls.has_placement(),
|
||||||
|
}
|
||||||
|
cls.is_loaded = True
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def has_placement(cls):
|
||||||
|
element = tool.Ifc.get_entity(bpy.context.active_object)
|
||||||
|
if element and hasattr(element, "ObjectPlacement"):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|||||||
@@ -21,7 +21,12 @@ import blenderbim.tool as tool
|
|||||||
from bpy.types import Panel, Menu
|
from bpy.types import Panel, Menu
|
||||||
from blenderbim.bim.ifc import IfcStore
|
from blenderbim.bim.ifc import IfcStore
|
||||||
from blenderbim.bim.helper import prop_with_search
|
from blenderbim.bim.helper import prop_with_search
|
||||||
from blenderbim.bim.module.geometry.data import RepresentationsData, ConnectionsData, DerivedPlacementsData
|
from blenderbim.bim.module.geometry.data import (
|
||||||
|
RepresentationsData,
|
||||||
|
ConnectionsData,
|
||||||
|
PlacementData,
|
||||||
|
DerivedCoordinatesData,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def object_menu(self, context):
|
def object_menu(self, context):
|
||||||
@@ -251,49 +256,89 @@ class BIM_PT_mesh(Panel):
|
|||||||
op.ifc_representation_class = "IfcExtrudedAreaSolid/IfcArbitraryProfileDefWithVoids"
|
op.ifc_representation_class = "IfcExtrudedAreaSolid/IfcArbitraryProfileDefWithVoids"
|
||||||
|
|
||||||
|
|
||||||
def BIM_PT_transform(self, context):
|
|
||||||
if context.active_object and context.active_object.BIMObjectProperties.ifc_definition_id:
|
|
||||||
row = self.layout.row(align=True)
|
|
||||||
row.label(text="Blender Offset")
|
|
||||||
row.label(text=context.active_object.BIMObjectProperties.blender_offset_type)
|
|
||||||
|
|
||||||
row = self.layout.row()
|
class BIM_PT_placement(Panel):
|
||||||
row.operator("bim.edit_object_placement")
|
bl_label = "Placement"
|
||||||
|
bl_idname = "BIM_PT_placement"
|
||||||
|
|
||||||
class BIM_PT_derived_placements(Panel):
|
|
||||||
bl_label = "Derived Placements"
|
|
||||||
bl_idname = "BIM_PT_derived_placements"
|
|
||||||
bl_options = {"DEFAULT_CLOSED"}
|
|
||||||
bl_space_type = "PROPERTIES"
|
bl_space_type = "PROPERTIES"
|
||||||
bl_region_type = "WINDOW"
|
bl_region_type = "WINDOW"
|
||||||
bl_context = "object"
|
bl_context = "scene"
|
||||||
bl_order = 1
|
bl_order = 1
|
||||||
bl_parent_id = "OBJECT_PT_transform"
|
bl_parent_id = "BIM_PT_tab_placement"
|
||||||
|
bl_options = {"HIDE_HEADER"}
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def poll(cls, context):
|
||||||
|
return context.active_object and context.active_object.BIMObjectProperties.ifc_definition_id
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
if not DerivedPlacementsData.is_loaded:
|
if not PlacementData.is_loaded:
|
||||||
DerivedPlacementsData.load()
|
PlacementData.load()
|
||||||
|
|
||||||
|
if PlacementData.data["has_placement"]:
|
||||||
|
row = self.layout.row()
|
||||||
|
row.prop(context.active_object, "location", text="Location")
|
||||||
|
row = self.layout.row()
|
||||||
|
row.prop(context.active_object, "rotation_euler", text="Rotation")
|
||||||
|
else:
|
||||||
|
row = self.layout.row()
|
||||||
|
row.label(text="No Object Placement Found")
|
||||||
|
|
||||||
|
if context.active_object.BIMObjectProperties.blender_offset_type != "NONE":
|
||||||
|
row = self.layout.row(align=True)
|
||||||
|
row.label(text="Blender Offset", icon="TRACKING_REFINE_FORWARDS")
|
||||||
|
row.label(text=context.active_object.BIMObjectProperties.blender_offset_type)
|
||||||
|
|
||||||
|
|
||||||
|
class BIM_PT_derived_coordinates(Panel):
|
||||||
|
bl_label = "Derived Coordinates"
|
||||||
|
bl_idname = "BIM_PT_derived_coordinates"
|
||||||
|
bl_space_type = "PROPERTIES"
|
||||||
|
bl_region_type = "WINDOW"
|
||||||
|
bl_context = "scene"
|
||||||
|
bl_order = 3
|
||||||
|
bl_parent_id = "BIM_PT_tab_placement"
|
||||||
|
bl_options = {"DEFAULT_CLOSED"}
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def poll(cls, context):
|
||||||
|
return context.active_object is not None
|
||||||
|
|
||||||
|
def draw(self, context):
|
||||||
|
if not DerivedCoordinatesData.is_loaded:
|
||||||
|
DerivedCoordinatesData.load()
|
||||||
|
|
||||||
|
row = self.layout.row()
|
||||||
|
row.operator("bim.edit_object_placement", icon="EXPORT")
|
||||||
|
|
||||||
|
row = self.layout.row()
|
||||||
|
row.label(text="XYZ Dimensions")
|
||||||
|
|
||||||
|
row = self.layout.row(align=True)
|
||||||
|
row.enabled=False
|
||||||
|
row.prop(context.active_object, "dimensions", text="X", index=0, slider=True)
|
||||||
|
row.prop(context.active_object, "dimensions", text="Y", index=1, slider=True)
|
||||||
|
row.prop(context.active_object, "dimensions", text="Z", index=2, slider=True)
|
||||||
|
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
row.label(text="Min Global Z")
|
row.label(text="Min Global Z")
|
||||||
row.label(text=DerivedPlacementsData.data["min_global_z"])
|
row.label(text=DerivedCoordinatesData.data["min_global_z"])
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
row.label(text="Max Global Z")
|
row.label(text="Max Global Z")
|
||||||
row.label(text=DerivedPlacementsData.data["max_global_z"])
|
row.label(text=DerivedCoordinatesData.data["max_global_z"])
|
||||||
|
|
||||||
if DerivedPlacementsData.data["has_collection"]:
|
if DerivedCoordinatesData.data["has_collection"]:
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
row.label(text="Min Decomposed Z")
|
row.label(text="Min Decomposed Z")
|
||||||
row.label(text=DerivedPlacementsData.data["min_decomposed_z"])
|
row.label(text=DerivedCoordinatesData.data["min_decomposed_z"])
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
row.label(text="Max Decomposed Z")
|
row.label(text="Max Decomposed Z")
|
||||||
row.label(text=DerivedPlacementsData.data["max_decomposed_z"])
|
row.label(text=DerivedCoordinatesData.data["max_decomposed_z"])
|
||||||
|
|
||||||
if DerivedPlacementsData.data["is_storey"]:
|
if DerivedCoordinatesData.data["is_storey"]:
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
row.label(text="Storey Height")
|
row.label(text="Storey Height")
|
||||||
row.label(text=DerivedPlacementsData.data["storey_height"])
|
row.label(text=DerivedCoordinatesData.data["storey_height"])
|
||||||
|
|
||||||
|
|
||||||
class BIM_PT_workarounds(Panel):
|
class BIM_PT_workarounds(Panel):
|
||||||
|
|||||||
@@ -552,6 +552,21 @@ class BIM_PT_tab_object_metadata(Panel):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class BIM_PT_tab_placement(Panel):
|
||||||
|
bl_label = "Placement"
|
||||||
|
bl_space_type = "PROPERTIES"
|
||||||
|
bl_region_type = "WINDOW"
|
||||||
|
bl_context = "scene"
|
||||||
|
bl_order = 1
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def poll(cls, context):
|
||||||
|
return tool.Blender.is_tab(context, "GEOMETRY") and tool.Ifc.get()
|
||||||
|
|
||||||
|
def draw(self, context):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class BIM_PT_tab_representations(Panel):
|
class BIM_PT_tab_representations(Panel):
|
||||||
bl_label = "Representations"
|
bl_label = "Representations"
|
||||||
bl_space_type = "PROPERTIES"
|
bl_space_type = "PROPERTIES"
|
||||||
|
|||||||
Reference in New Issue
Block a user