Compare commits

...

1 Commits

Author SHA1 Message Date
Andrej730 6913864850 Remove triangulation on switch_representation
Now all walls, beams etc should become be displayed with quads.
2023-08-09 16:37:48 +05:00
2 changed files with 15 additions and 0 deletions
@@ -115,6 +115,7 @@ def switch_representation(
geometry.change_object_data(obj, data, is_global=is_global)
geometry.record_object_materials(obj)
geometry.remove_triangulation(obj)
if should_reload and existing_data:
geometry.delete_data(existing_data)
@@ -31,6 +31,7 @@ import blenderbim.bim.import_ifc
from math import radians
from mathutils import Vector
from blenderbim.bim.ifc import IfcStore
from math import radians
class Geometry(blenderbim.core.tool.Geometry):
@@ -545,6 +546,19 @@ class Geometry(blenderbim.core.tool.Geometry):
def rename_object(cls, obj, name):
obj.name = name
@classmethod
def remove_triangulation(cls, obj):
"""
Convert triangles to quads without bpy.ops.
Note that it uses bmesh based on object mesh.
"""
mesh = obj.data
bm = tool.Blender.get_bmesh_for_mesh(mesh)
# angle values come from defaults for `bpy.ops.mesh.tris_convert_to_quads()``
bmesh.ops.join_triangles(bm, faces=bm.faces[:], angle_face_threshold=radians(40), angle_shape_threshold=radians(40))
bm.normal_update()
tool.Blender.apply_bmesh(mesh, bm, obj)
@classmethod
def replace_object_with_empty(cls, obj):
element = tool.Ifc.get_entity(obj)