mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 18:16:40 +00:00
@@ -211,6 +211,12 @@ class AssignClass(bpy.types.Operator, tool.Ifc.Operator):
|
||||
)
|
||||
continue
|
||||
|
||||
should_add_representation = self.should_add_representation
|
||||
export_mesh_to_tesselation = False
|
||||
if self.should_add_representation and isinstance(obj.data, bpy.types.Mesh) and obj.data.polygons:
|
||||
should_add_representation = False
|
||||
export_mesh_to_tesselation = True
|
||||
|
||||
element = core.assign_class(
|
||||
tool.Ifc,
|
||||
tool.Collector,
|
||||
@@ -218,11 +224,12 @@ class AssignClass(bpy.types.Operator, tool.Ifc.Operator):
|
||||
obj=obj,
|
||||
ifc_class=ifc_class,
|
||||
predefined_type=predefined_type,
|
||||
should_add_representation=False,
|
||||
should_add_representation=should_add_representation,
|
||||
context=ifc_context,
|
||||
ifc_representation_class=self.ifc_representation_class,
|
||||
)
|
||||
if self.should_add_representation and obj.data and len(obj.data.vertices):
|
||||
|
||||
if export_mesh_to_tesselation:
|
||||
representation = tool.Geometry.export_mesh_to_tessellation(obj, ifc_context)
|
||||
ifcopenshell.api.geometry.assign_representation(tool.Ifc.get(), element, representation)
|
||||
bonsai.core.geometry.switch_representation(
|
||||
|
||||
@@ -1719,7 +1719,9 @@ class Geometry(bonsai.core.tool.Geometry):
|
||||
data["ios_item_ids"] = [i["item"].id() for i in ifcopenshell.util.representation.resolve_items(representation)]
|
||||
|
||||
@classmethod
|
||||
def export_mesh_to_tessellation(cls, obj: bpy.types.Object, ifc_context) -> ifcopenshell.entity_instance:
|
||||
def export_mesh_to_tessellation(
|
||||
cls, obj: bpy.types.Object, ifc_context: ifcopenshell.entity_instance
|
||||
) -> ifcopenshell.entity_instance:
|
||||
builder = ifcopenshell.util.shape_builder.ShapeBuilder(tool.Ifc.get())
|
||||
unit_scale = ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get())
|
||||
items = []
|
||||
|
||||
Reference in New Issue
Block a user