mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Dissolve specifically IOS triangulated edges for meshes instead of generic Blender limited dissolve.
This commit is contained in:
@@ -1823,6 +1823,10 @@ class IfcImporter:
|
||||
loop_total = [3] * num_loops
|
||||
num_vertex_indices = len(geometry.faces)
|
||||
|
||||
# See bug 3546
|
||||
# ios_edges holds true edges that aren't triangulated.
|
||||
mesh["ios_edges"] = list(set(tuple(e) for e in grouped_edges))
|
||||
|
||||
mesh.vertices.add(num_vertices)
|
||||
mesh.vertices.foreach_set("co", verts)
|
||||
mesh.loops.add(num_vertex_indices)
|
||||
@@ -1909,7 +1913,7 @@ class IfcImportSettings:
|
||||
self.should_merge_materials_by_colour = False
|
||||
self.should_load_geometry = True
|
||||
self.should_use_native_meshes = False
|
||||
self.should_clean_mesh = True
|
||||
self.should_clean_mesh = False
|
||||
self.should_cache = True
|
||||
self.is_coordinating = True
|
||||
self.deflection_tolerance = 0.001
|
||||
|
||||
@@ -1360,6 +1360,7 @@ class OverrideModeSetEdit(bpy.types.Operator):
|
||||
should_sync_changes_first=False,
|
||||
apply_openings=False,
|
||||
)
|
||||
tool.Geometry.dissolve_triangulated_edges(obj)
|
||||
obj.data.BIMMeshProperties.mesh_checksum = tool.Geometry.get_mesh_checksum(obj.data)
|
||||
else:
|
||||
obj.select_set(False)
|
||||
|
||||
@@ -151,7 +151,7 @@ class BIMProjectProperties(PropertyGroup):
|
||||
should_stream: BoolProperty(name="Stream Data From IFC-SPF (Only for advanced users)", default=False)
|
||||
should_load_geometry: BoolProperty(name="Load Geometry", default=True)
|
||||
should_use_native_meshes: BoolProperty(name="Native Meshes", default=False)
|
||||
should_clean_mesh: BoolProperty(name="Clean Meshes", default=True)
|
||||
should_clean_mesh: BoolProperty(name="Clean Meshes", default=False)
|
||||
should_cache: BoolProperty(name="Cache", default=False)
|
||||
is_coordinating: BoolProperty(name="For Coordination Only", default=False)
|
||||
deflection_tolerance: FloatProperty(name="Deflection Tolerance", default=0.001)
|
||||
|
||||
@@ -247,7 +247,7 @@ class BIM_ADDON_preferences(bpy.types.AddonPreferences):
|
||||
row.operator("bim.select_data_dir", icon="FILE_FOLDER", text="")
|
||||
|
||||
row = self.layout.row(align=True)
|
||||
row.prop(context.scene.BIMProperties, "psets_dir")
|
||||
row.prop(context.scene.BIMProperties, "pset_dir")
|
||||
row = self.layout.row(align=True)
|
||||
row.prop(context.scene.DocProperties, "sheets_dir")
|
||||
row = self.layout.row(align=True)
|
||||
|
||||
@@ -118,6 +118,21 @@ class Geometry(blenderbim.core.tool.Geometry):
|
||||
except:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def dissolve_triangulated_edges(cls, obj):
|
||||
if obj.data and "ios_edges" in obj.data:
|
||||
bm = bmesh.new()
|
||||
bm.from_mesh(obj.data)
|
||||
edges_to_keep = set(map(frozenset, obj.data["ios_edges"]))
|
||||
edges_to_dissolve = []
|
||||
for edge in bm.edges:
|
||||
if frozenset([vert.index for vert in edge.verts]) not in edges_to_keep:
|
||||
edges_to_dissolve.append(edge)
|
||||
bmesh.ops.dissolve_edges(bm, edges=edges_to_dissolve)
|
||||
bm.to_mesh(obj.data)
|
||||
bm.free()
|
||||
del obj.data["ios_edges"]
|
||||
|
||||
@classmethod
|
||||
def does_representation_id_exist(cls, representation_id):
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user