diff --git a/src/blenderbim/blenderbim/core/georeference.py b/src/blenderbim/blenderbim/core/georeference.py index 2d990c8d37..9453845067 100644 --- a/src/blenderbim/blenderbim/core/georeference.py +++ b/src/blenderbim/blenderbim/core/georeference.py @@ -46,19 +46,11 @@ def edit_georeferencing(ifc, georeference): def get_cursor_location(georeference): - georeference.set_coordinates("local", georeference.get_cursor_location()) - - -def convert_local_to_global(georeference): - coordinates = georeference.xyz2enh(georeference.get_coordinates("local")) - georeference.set_coordinates("map", coordinates) - georeference.set_cursor_location() - - -def convert_global_to_local(georeference): - coordinates = georeference.enh2xyz(georeference.get_coordinates("map")) - georeference.set_coordinates("local", coordinates) - georeference.set_cursor_location() + location = georeference.get_cursor_location() + if georeference.has_blender_offset: + georeference.set_coordinates("blender", location) + else: + georeference.set_coordinates("local", location) def convert_angle_to_coord(georeference, type): diff --git a/src/blenderbim/blenderbim/tool/georeference.py b/src/blenderbim/blenderbim/tool/georeference.py index 85d9ca5570..3c9bb0eea1 100644 --- a/src/blenderbim/blenderbim/tool/georeference.py +++ b/src/blenderbim/blenderbim/tool/georeference.py @@ -222,17 +222,13 @@ class Georeference(blenderbim.core.tool.Georeference): @classmethod def set_coordinates(cls, io, coordinates): - if io == "local": - bpy.context.scene.BIMGeoreferenceProperties.local_coordinates = ",".join([str(o) for o in coordinates]) - elif io == "map": - bpy.context.scene.BIMGeoreferenceProperties.map_coordinates = ",".join([str(o) for o in coordinates]) + props = bpy.context.scene.BIMGeoreferenceProperties + setattr(props, f"{io}_coordinates", ",".join([str(o) for o in coordinates])) @classmethod def get_coordinates(cls, io): - if io == "local": - return [float(co) for co in bpy.context.scene.BIMGeoreferenceProperties.local_coordinates.split(",")] - elif io == "map": - return [float(co) for co in bpy.context.scene.BIMGeoreferenceProperties.map_coordinates.split(",")] + props = bpy.context.scene.BIMGeoreferenceProperties + return [float(co) for co in getattr(props, f"{io}_coordinates").split(",")] @classmethod def get_cursor_location(cls): @@ -383,3 +379,7 @@ class Georeference(blenderbim.core.tool.Georeference): ) angle = tool.Cad.normalise_angle(angle) gprops.model_project_north = str(angle) + + @classmethod + def has_blender_offset(cls) -> bool: + return bpy.context.scene.BIMGeoreferenceProperties.has_blender_offset