mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
Add IFC export to Navisworks workaround to enforce triangulation
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import bpy
|
||||
import csv
|
||||
import bmesh
|
||||
import json
|
||||
import time
|
||||
import datetime
|
||||
@@ -2951,6 +2952,14 @@ class IfcExporter:
|
||||
mesh = representation["raw"]
|
||||
if not representation["is_parametric"]:
|
||||
mesh = representation["raw_object"].evaluated_get(bpy.context.evaluated_depsgraph_get()).to_mesh()
|
||||
if self.ifc_export_settings.should_force_triangulation:
|
||||
mesh = representation["raw_object"].evaluated_get(bpy.context.evaluated_depsgraph_get()).to_mesh()
|
||||
bm = bmesh.new()
|
||||
bm.from_mesh(mesh)
|
||||
bmesh.ops.triangulate(bm, faces=bm.faces)
|
||||
bm.to_mesh(mesh)
|
||||
bm.free()
|
||||
del bm
|
||||
if self.schema_version == "IFC2X3" or self.ifc_export_settings.should_force_faceted_brep:
|
||||
return self.create_faceted_brep(representation, mesh)
|
||||
return self.create_polygonal_face_set(representation, mesh)
|
||||
@@ -3342,6 +3351,7 @@ class IfcExportSettings:
|
||||
settings.should_use_presentation_style_assignment = scene_bim.export_should_use_presentation_style_assignment
|
||||
settings.should_guess_quantities = scene_bim.export_should_guess_quantities
|
||||
settings.should_force_faceted_brep = scene_bim.export_should_force_faceted_brep
|
||||
settings.should_force_triangulation = scene_bim.export_should_force_triangulation
|
||||
settings.should_roundtrip_native = scene_bim.import_export_should_roundtrip_native
|
||||
settings.context_tree = []
|
||||
for ifc_context in ["model", "plan"]:
|
||||
|
||||
@@ -1381,6 +1381,7 @@ class BIMProperties(PropertyGroup):
|
||||
name="Export with Presentation Style Assignment", default=False
|
||||
)
|
||||
export_should_force_faceted_brep: BoolProperty(name="Export with Faceted Breps", default=False)
|
||||
export_should_force_triangulation: BoolProperty(name="Export with Triangulation", default=False)
|
||||
import_should_ignore_site_coordinates: BoolProperty(name="Import Ignoring Site Coordinates", default=False)
|
||||
import_should_ignore_building_coordinates: BoolProperty(name="Import Ignoring Building Coordinates", default=False)
|
||||
import_should_reset_absolute_coordinates: BoolProperty(name="Import Resetting Absolute Coordinates", default=False)
|
||||
|
||||
@@ -1845,6 +1845,11 @@ class BIM_PT_mvd(Panel):
|
||||
row = layout.row()
|
||||
row.prop(bim_properties, "export_should_force_faceted_brep")
|
||||
|
||||
layout.label(text="Navisworks Workarounds:")
|
||||
|
||||
row = layout.row()
|
||||
row.prop(bim_properties, "export_should_force_triangulation")
|
||||
|
||||
layout.label(text="Tekla Workarounds:")
|
||||
|
||||
row = layout.row()
|
||||
|
||||
Reference in New Issue
Block a user