mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-10 06:00:51 +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.GetCursorLocation,
|
||||||
operator.ImportPlot,
|
operator.ImportPlot,
|
||||||
operator.RemoveGeoreferencing,
|
operator.RemoveGeoreferencing,
|
||||||
|
operator.RemoveTrueNorth,
|
||||||
operator.SetBlenderGridNorth,
|
operator.SetBlenderGridNorth,
|
||||||
operator.SetBlenderTrueNorth,
|
operator.SetBlenderTrueNorth,
|
||||||
operator.SetIfcGridNorth,
|
operator.SetIfcGridNorth,
|
||||||
|
|||||||
@@ -249,3 +249,13 @@ class DisableEditingTrueNorth(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
core.disable_editing_true_north(tool.Georeference)
|
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_x: StringProperty(name="Blender Offset X", default="0")
|
||||||
blender_offset_y: StringProperty(name="Blender Offset Y", default="0")
|
blender_offset_y: StringProperty(name="Blender Offset Y", default="0")
|
||||||
blender_offset_z: StringProperty(name="Blender Offset Z", 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_abscissa: StringProperty(name="True North Abscissa")
|
||||||
true_north_ordinate: StringProperty(name="True North Ordinate")
|
true_north_ordinate: StringProperty(name="True North Ordinate")
|
||||||
wcs_x: StringProperty(name="WCS X", default="0")
|
wcs_x: StringProperty(name="WCS X", default="0")
|
||||||
|
|||||||
@@ -157,8 +157,6 @@ class BIM_PT_gis_true_north(Panel):
|
|||||||
self.draw_ui()
|
self.draw_ui()
|
||||||
|
|
||||||
def draw_editable_ui(self, context):
|
def draw_editable_ui(self, context):
|
||||||
row = self.layout.row()
|
|
||||||
row.prop(self.props, "has_true_north")
|
|
||||||
row = self.layout.row()
|
row = self.layout.row()
|
||||||
row.prop(self.props, "true_north_abscissa")
|
row.prop(self.props, "true_north_abscissa")
|
||||||
row = self.layout.row()
|
row = self.layout.row()
|
||||||
@@ -178,6 +176,7 @@ class BIM_PT_gis_true_north(Panel):
|
|||||||
row.label(text="Vector")
|
row.label(text="Vector")
|
||||||
row.label(text=str(GeoreferenceData.data["true_north"][0:2])[1:-1])
|
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.enable_editing_true_north", icon="GREASEPENCIL", text="")
|
||||||
|
row.operator("bim.remove_true_north", icon="X", text="")
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
row.label(text="Derived Angle")
|
row.label(text="Derived Angle")
|
||||||
row.label(text=GeoreferenceData.data["true_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.label(text="Unrecommended Transformation Found", icon="ERROR")
|
||||||
row.operator("bim.enable_editing_wcs", icon="GREASEPENCIL", text="")
|
row.operator("bim.enable_editing_wcs", icon="GREASEPENCIL", text="")
|
||||||
row = self.layout.row(align=True)
|
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.label(text=str(GeoreferenceData.data["world_coordinate_system"]["x"]))
|
||||||
row = self.layout.row(align=True)
|
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.label(text=str(GeoreferenceData.data["world_coordinate_system"]["y"]))
|
||||||
row = self.layout.row(align=True)
|
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.label(text=str(GeoreferenceData.data["world_coordinate_system"]["z"]))
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
row.label(text="Rotation")
|
row.label(text="Rotation")
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ def edit_georeferencing(ifc, georeference):
|
|||||||
"georeference.edit_georeferencing",
|
"georeference.edit_georeferencing",
|
||||||
projected_crs=georeference.get_projected_crs_attributes(),
|
projected_crs=georeference.get_projected_crs_attributes(),
|
||||||
coordinate_operation=georeference.get_coordinate_operation_attributes(),
|
coordinate_operation=georeference.get_coordinate_operation_attributes(),
|
||||||
true_north=georeference.get_true_north_attributes(),
|
|
||||||
)
|
)
|
||||||
georeference.disable_editing()
|
georeference.disable_editing()
|
||||||
|
|
||||||
@@ -113,3 +112,7 @@ def disable_editing_true_north(georeference):
|
|||||||
def edit_true_north(ifc, georeference):
|
def edit_true_north(ifc, georeference):
|
||||||
ifc.run("georeference.edit_true_north", true_north=georeference.get_true_north_attributes())
|
ifc.run("georeference.edit_true_north", true_north=georeference.get_true_north_attributes())
|
||||||
georeference.disable_editing_true_north()
|
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
|
return
|
||||||
|
|
||||||
props = bpy.context.scene.BIMGeoreferenceProperties
|
props = bpy.context.scene.BIMGeoreferenceProperties
|
||||||
props.has_true_north = False
|
|
||||||
for context in tool.Ifc.get().by_type("IfcGeometricRepresentationContext", include_subtypes=False):
|
for context in tool.Ifc.get().by_type("IfcGeometricRepresentationContext", include_subtypes=False):
|
||||||
if context.TrueNorth:
|
if context.TrueNorth:
|
||||||
true_north = context.TrueNorth.DirectionRatios
|
true_north = context.TrueNorth.DirectionRatios
|
||||||
props.true_north_abscissa = str(true_north[0])
|
props.true_north_abscissa = str(true_north[0])
|
||||||
props.true_north_ordinate = str(true_north[1])
|
props.true_north_ordinate = str(true_north[1])
|
||||||
props.has_true_north = True
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -156,12 +154,10 @@ class Georeference(blenderbim.core.tool.Georeference):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def get_true_north_attributes(cls):
|
def get_true_north_attributes(cls):
|
||||||
props = bpy.context.scene.BIMGeoreferenceProperties
|
props = bpy.context.scene.BIMGeoreferenceProperties
|
||||||
if props.has_true_north:
|
try:
|
||||||
try:
|
return [float(props.true_north_abscissa), float(props.true_north_ordinate)]
|
||||||
return [float(props.true_north_abscissa), float(props.true_north_ordinate)]
|
except ValueError:
|
||||||
except ValueError:
|
print("ERROR, True North Abscissa and Ordinate expect a number")
|
||||||
print("ERROR, True North Abscissa and Ordinate expect a number")
|
|
||||||
# self.report({"ERROR"}, "True North Abscissa and Ordinate expect a number")
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def enable_editing(cls):
|
def enable_editing(cls):
|
||||||
|
|||||||
Reference in New Issue
Block a user