mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-27 10:51:13 +00:00
Use common method for checking if object is scaled
This commit is contained in:
@@ -144,7 +144,7 @@ class IfcExporter:
|
|||||||
element = self.file.by_id(obj.BIMObjectProperties.ifc_definition_id)
|
element = self.file.by_id(obj.BIMObjectProperties.ifc_definition_id)
|
||||||
if not tool.Ifc.is_moved(obj):
|
if not tool.Ifc.is_moved(obj):
|
||||||
return
|
return
|
||||||
if (obj.scale - Vector((1.0, 1.0, 1.0))).length > 1e-4:
|
if tool.Geometry.is_scaled(obj):
|
||||||
bpy.ops.bim.update_representation(obj=obj.name)
|
bpy.ops.bim.update_representation(obj=obj.name)
|
||||||
return element
|
return element
|
||||||
if element.is_a("IfcGridAxis"):
|
if element.is_a("IfcGridAxis"):
|
||||||
|
|||||||
@@ -1548,7 +1548,7 @@ class Drawing(bonsai.core.tool.Drawing):
|
|||||||
def sync_object_placement(cls, obj: bpy.types.Object) -> Union[ifcopenshell.entity_instance, None]:
|
def sync_object_placement(cls, obj: bpy.types.Object) -> Union[ifcopenshell.entity_instance, None]:
|
||||||
blender_matrix = np.array(obj.matrix_world)
|
blender_matrix = np.array(obj.matrix_world)
|
||||||
element = tool.Ifc.get_entity(obj)
|
element = tool.Ifc.get_entity(obj)
|
||||||
if (obj.scale - mathutils.Vector((1.0, 1.0, 1.0))).length > 1e-4:
|
if tool.Geometry.is_scaled(obj):
|
||||||
bpy.ops.bim.update_representation(obj=obj.name)
|
bpy.ops.bim.update_representation(obj=obj.name)
|
||||||
return element
|
return element
|
||||||
if element.is_a("IfcGridAxis"):
|
if element.is_a("IfcGridAxis"):
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ class Geometry(bonsai.core.tool.Geometry):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def clear_scale(cls, obj: bpy.types.Object) -> None:
|
def clear_scale(cls, obj: bpy.types.Object) -> None:
|
||||||
# Note that clearing scale has no impact on cameras.
|
# Note that clearing scale has no impact on cameras.
|
||||||
if (obj.scale - Vector((1.0, 1.0, 1.0))).length > 1e-4:
|
if cls.is_scaled(obj):
|
||||||
if not obj.data:
|
if not obj.data:
|
||||||
location, rotation, _ = obj.matrix_world.decompose()
|
location, rotation, _ = obj.matrix_world.decompose()
|
||||||
obj.matrix_world = Matrix.Translation(location) @ rotation.to_matrix().to_4x4()
|
obj.matrix_world = Matrix.Translation(location) @ rotation.to_matrix().to_4x4()
|
||||||
|
|||||||
Reference in New Issue
Block a user