mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
There is now an explicit "remove true north" button to make it consistent with other buttons like remove georeferencing
This commit is contained in:
@@ -36,6 +36,7 @@ classes = (
|
||||
operator.GetCursorLocation,
|
||||
operator.ImportPlot,
|
||||
operator.RemoveGeoreferencing,
|
||||
operator.RemoveTrueNorth,
|
||||
operator.SetBlenderGridNorth,
|
||||
operator.SetBlenderTrueNorth,
|
||||
operator.SetIfcGridNorth,
|
||||
|
||||
@@ -249,3 +249,13 @@ class DisableEditingTrueNorth(bpy.types.Operator, tool.Ifc.Operator):
|
||||
|
||||
def _execute(self, context):
|
||||
core.disable_editing_true_north(tool.Georeference)
|
||||
|
||||
|
||||
class RemoveTrueNorth(bpy.types.Operator, tool.Ifc.Operator):
|
||||
bl_idname = "bim.remove_true_north"
|
||||
bl_label = "Remove True North"
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
bl_description = "Remove true north"
|
||||
|
||||
def _execute(self, context):
|
||||
core.remove_true_north(tool.Ifc)
|
||||
|
||||
@@ -82,7 +82,6 @@ class BIMGeoreferenceProperties(PropertyGroup):
|
||||
blender_offset_x: StringProperty(name="Blender Offset X", default="0")
|
||||
blender_offset_y: StringProperty(name="Blender Offset Y", default="0")
|
||||
blender_offset_z: StringProperty(name="Blender Offset Z", default="0")
|
||||
has_true_north: BoolProperty(name="Has True North", default=True)
|
||||
true_north_abscissa: StringProperty(name="True North Abscissa")
|
||||
true_north_ordinate: StringProperty(name="True North Ordinate")
|
||||
wcs_x: StringProperty(name="WCS X", default="0")
|
||||
|
||||
@@ -157,8 +157,6 @@ class BIM_PT_gis_true_north(Panel):
|
||||
self.draw_ui()
|
||||
|
||||
def draw_editable_ui(self, context):
|
||||
row = self.layout.row()
|
||||
row.prop(self.props, "has_true_north")
|
||||
row = self.layout.row()
|
||||
row.prop(self.props, "true_north_abscissa")
|
||||
row = self.layout.row()
|
||||
@@ -178,6 +176,7 @@ class BIM_PT_gis_true_north(Panel):
|
||||
row.label(text="Vector")
|
||||
row.label(text=str(GeoreferenceData.data["true_north"][0:2])[1:-1])
|
||||
row.operator("bim.enable_editing_true_north", icon="GREASEPENCIL", text="")
|
||||
row.operator("bim.remove_true_north", icon="X", text="")
|
||||
row = self.layout.row(align=True)
|
||||
row.label(text="Derived Angle")
|
||||
row.label(text=GeoreferenceData.data["true_derived_angle"])
|
||||
@@ -213,13 +212,13 @@ class BIM_PT_gis_wcs(Panel):
|
||||
row.label(text="Unrecommended Transformation Found", icon="ERROR")
|
||||
row.operator("bim.enable_editing_wcs", icon="GREASEPENCIL", text="")
|
||||
row = self.layout.row(align=True)
|
||||
row.label(text="X")
|
||||
row.label(text=f"X ({GeoreferenceData.data['local_unit_symbol']})")
|
||||
row.label(text=str(GeoreferenceData.data["world_coordinate_system"]["x"]))
|
||||
row = self.layout.row(align=True)
|
||||
row.label(text="Y")
|
||||
row.label(text=f"Y ({GeoreferenceData.data['local_unit_symbol']})")
|
||||
row.label(text=str(GeoreferenceData.data["world_coordinate_system"]["y"]))
|
||||
row = self.layout.row(align=True)
|
||||
row.label(text="Z")
|
||||
row.label(text=f"Z ({GeoreferenceData.data['local_unit_symbol']})")
|
||||
row.label(text=str(GeoreferenceData.data["world_coordinate_system"]["z"]))
|
||||
row = self.layout.row(align=True)
|
||||
row.label(text="Rotation")
|
||||
|
||||
@@ -40,7 +40,6 @@ def edit_georeferencing(ifc, georeference):
|
||||
"georeference.edit_georeferencing",
|
||||
projected_crs=georeference.get_projected_crs_attributes(),
|
||||
coordinate_operation=georeference.get_coordinate_operation_attributes(),
|
||||
true_north=georeference.get_true_north_attributes(),
|
||||
)
|
||||
georeference.disable_editing()
|
||||
|
||||
@@ -113,3 +112,7 @@ def disable_editing_true_north(georeference):
|
||||
def edit_true_north(ifc, georeference):
|
||||
ifc.run("georeference.edit_true_north", true_north=georeference.get_true_north_attributes())
|
||||
georeference.disable_editing_true_north()
|
||||
|
||||
|
||||
def remove_true_north(ifc):
|
||||
ifc.run("georeference.edit_true_north", true_north=None)
|
||||
|
||||
@@ -114,13 +114,11 @@ class Georeference(blenderbim.core.tool.Georeference):
|
||||
return
|
||||
|
||||
props = bpy.context.scene.BIMGeoreferenceProperties
|
||||
props.has_true_north = False
|
||||
for context in tool.Ifc.get().by_type("IfcGeometricRepresentationContext", include_subtypes=False):
|
||||
if context.TrueNorth:
|
||||
true_north = context.TrueNorth.DirectionRatios
|
||||
props.true_north_abscissa = str(true_north[0])
|
||||
props.true_north_ordinate = str(true_north[1])
|
||||
props.has_true_north = True
|
||||
return
|
||||
|
||||
@classmethod
|
||||
@@ -156,12 +154,10 @@ class Georeference(blenderbim.core.tool.Georeference):
|
||||
@classmethod
|
||||
def get_true_north_attributes(cls):
|
||||
props = bpy.context.scene.BIMGeoreferenceProperties
|
||||
if props.has_true_north:
|
||||
try:
|
||||
return [float(props.true_north_abscissa), float(props.true_north_ordinate)]
|
||||
except ValueError:
|
||||
print("ERROR, True North Abscissa and Ordinate expect a number")
|
||||
# self.report({"ERROR"}, "True North Abscissa and Ordinate expect a number")
|
||||
try:
|
||||
return [float(props.true_north_abscissa), float(props.true_north_ordinate)]
|
||||
except ValueError:
|
||||
print("ERROR, True North Abscissa and Ordinate expect a number")
|
||||
|
||||
@classmethod
|
||||
def enable_editing(cls):
|
||||
|
||||
Reference in New Issue
Block a user