mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 02:23:34 +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)
|
||||
if not tool.Ifc.is_moved(obj):
|
||||
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)
|
||||
return element
|
||||
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]:
|
||||
blender_matrix = np.array(obj.matrix_world)
|
||||
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)
|
||||
return element
|
||||
if element.is_a("IfcGridAxis"):
|
||||
|
||||
@@ -83,7 +83,7 @@ class Geometry(bonsai.core.tool.Geometry):
|
||||
@classmethod
|
||||
def clear_scale(cls, obj: bpy.types.Object) -> None:
|
||||
# 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:
|
||||
location, rotation, _ = obj.matrix_world.decompose()
|
||||
obj.matrix_world = Matrix.Translation(location) @ rotation.to_matrix().to_4x4()
|
||||
|
||||
Reference in New Issue
Block a user