mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-10 06:00:51 +00:00
If there is a Blender offset, show the non-offset placement in the placement panel
This commit is contained in:
@@ -308,6 +308,9 @@ class PlacementData:
|
|||||||
def load(cls):
|
def load(cls):
|
||||||
cls.data = {
|
cls.data = {
|
||||||
"has_placement": cls.has_placement(),
|
"has_placement": cls.has_placement(),
|
||||||
|
"original_x": cls.original_x(),
|
||||||
|
"original_y": cls.original_y(),
|
||||||
|
"original_z": cls.original_z(),
|
||||||
}
|
}
|
||||||
cls.is_loaded = True
|
cls.is_loaded = True
|
||||||
|
|
||||||
@@ -317,3 +320,42 @@ class PlacementData:
|
|||||||
if element and hasattr(element, "ObjectPlacement"):
|
if element and hasattr(element, "ObjectPlacement"):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def original_x(cls):
|
||||||
|
props = bpy.context.scene.BIMGeoreferenceProperties
|
||||||
|
obj = bpy.context.active_object
|
||||||
|
if not obj or not props.has_blender_offset:
|
||||||
|
return
|
||||||
|
return str(round(cls.original_xyz(obj.location)[0], 3))
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def original_y(cls):
|
||||||
|
props = bpy.context.scene.BIMGeoreferenceProperties
|
||||||
|
obj = bpy.context.active_object
|
||||||
|
if not obj or not props.has_blender_offset:
|
||||||
|
return
|
||||||
|
return str(round(cls.original_xyz(obj.location)[1], 3))
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def original_z(cls):
|
||||||
|
props = bpy.context.scene.BIMGeoreferenceProperties
|
||||||
|
obj = bpy.context.active_object
|
||||||
|
if not obj or not props.has_blender_offset:
|
||||||
|
return
|
||||||
|
return str(round(cls.original_xyz(obj.location)[2], 3))
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def original_xyz(cls, location):
|
||||||
|
props = bpy.context.scene.BIMGeoreferenceProperties
|
||||||
|
return ifcopenshell.util.geolocation.xyz2enh(
|
||||||
|
location[0],
|
||||||
|
location[1],
|
||||||
|
location[2],
|
||||||
|
float(props.blender_eastings),
|
||||||
|
float(props.blender_northings),
|
||||||
|
float(props.blender_orthogonal_height),
|
||||||
|
float(props.blender_x_axis_abscissa),
|
||||||
|
float(props.blender_x_axis_ordinate),
|
||||||
|
1.0,
|
||||||
|
)
|
||||||
|
|||||||
@@ -356,20 +356,25 @@ class BIM_PT_placement(Panel):
|
|||||||
if not PlacementData.is_loaded:
|
if not PlacementData.is_loaded:
|
||||||
PlacementData.load()
|
PlacementData.load()
|
||||||
|
|
||||||
if PlacementData.data["has_placement"]:
|
if not 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 = self.layout.row()
|
||||||
row.label(text="No Object Placement Found")
|
row.label(text="No Object Placement Found")
|
||||||
|
return
|
||||||
|
|
||||||
|
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")
|
||||||
|
|
||||||
if context.active_object.BIMObjectProperties.blender_offset_type != "NONE":
|
if context.active_object.BIMObjectProperties.blender_offset_type != "NONE":
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
row.label(text="Blender Offset", icon="TRACKING_REFINE_FORWARDS")
|
row.label(text="Blender Offset", icon="TRACKING_REFINE_FORWARDS")
|
||||||
row.label(text=context.active_object.BIMObjectProperties.blender_offset_type)
|
row.label(text=context.active_object.BIMObjectProperties.blender_offset_type)
|
||||||
|
|
||||||
|
row = self.layout.row(align=True)
|
||||||
|
row.label(text=PlacementData.data["original_x"], icon="EMPTY_AXIS")
|
||||||
|
row.label(text=PlacementData.data["original_y"])
|
||||||
|
row.label(text=PlacementData.data["original_z"])
|
||||||
|
|
||||||
class BIM_PT_derived_coordinates(Panel):
|
class BIM_PT_derived_coordinates(Panel):
|
||||||
bl_label = "Derived Coordinates"
|
bl_label = "Derived Coordinates"
|
||||||
|
|||||||
Reference in New Issue
Block a user