diff --git a/src/blenderbim/blenderbim/bim/module/georeference/__init__.py b/src/blenderbim/blenderbim/bim/module/georeference/__init__.py index f18cbf6817..96c46c9074 100644 --- a/src/blenderbim/blenderbim/bim/module/georeference/__init__.py +++ b/src/blenderbim/blenderbim/bim/module/georeference/__init__.py @@ -36,6 +36,7 @@ classes = ( operator.GetCursorLocation, operator.ImportPlot, operator.RemoveGeoreferencing, + operator.RemoveTrueNorth, operator.SetBlenderGridNorth, operator.SetBlenderTrueNorth, operator.SetIfcGridNorth, diff --git a/src/blenderbim/blenderbim/bim/module/georeference/operator.py b/src/blenderbim/blenderbim/bim/module/georeference/operator.py index 88936ea2e6..808090c5c6 100644 --- a/src/blenderbim/blenderbim/bim/module/georeference/operator.py +++ b/src/blenderbim/blenderbim/bim/module/georeference/operator.py @@ -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) diff --git a/src/blenderbim/blenderbim/bim/module/georeference/prop.py b/src/blenderbim/blenderbim/bim/module/georeference/prop.py index 25e1a2cdd6..0082981c3a 100644 --- a/src/blenderbim/blenderbim/bim/module/georeference/prop.py +++ b/src/blenderbim/blenderbim/bim/module/georeference/prop.py @@ -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") diff --git a/src/blenderbim/blenderbim/bim/module/georeference/ui.py b/src/blenderbim/blenderbim/bim/module/georeference/ui.py index 50a4383961..9e38f6298e 100644 --- a/src/blenderbim/blenderbim/bim/module/georeference/ui.py +++ b/src/blenderbim/blenderbim/bim/module/georeference/ui.py @@ -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") diff --git a/src/blenderbim/blenderbim/core/georeference.py b/src/blenderbim/blenderbim/core/georeference.py index ca687c88ab..54f5c0f7b1 100644 --- a/src/blenderbim/blenderbim/core/georeference.py +++ b/src/blenderbim/blenderbim/core/georeference.py @@ -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) diff --git a/src/blenderbim/blenderbim/tool/georeference.py b/src/blenderbim/blenderbim/tool/georeference.py index b9d2c4f124..dd9c21fffa 100644 --- a/src/blenderbim/blenderbim/tool/georeference.py +++ b/src/blenderbim/blenderbim/tool/georeference.py @@ -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):