mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 02:07:36 +00:00
@@ -211,6 +211,12 @@ class AssignClass(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
)
|
)
|
||||||
continue
|
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(
|
element = core.assign_class(
|
||||||
tool.Ifc,
|
tool.Ifc,
|
||||||
tool.Collector,
|
tool.Collector,
|
||||||
@@ -218,11 +224,12 @@ class AssignClass(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
obj=obj,
|
obj=obj,
|
||||||
ifc_class=ifc_class,
|
ifc_class=ifc_class,
|
||||||
predefined_type=predefined_type,
|
predefined_type=predefined_type,
|
||||||
should_add_representation=False,
|
should_add_representation=should_add_representation,
|
||||||
context=ifc_context,
|
context=ifc_context,
|
||||||
ifc_representation_class=self.ifc_representation_class,
|
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)
|
representation = tool.Geometry.export_mesh_to_tessellation(obj, ifc_context)
|
||||||
ifcopenshell.api.geometry.assign_representation(tool.Ifc.get(), element, representation)
|
ifcopenshell.api.geometry.assign_representation(tool.Ifc.get(), element, representation)
|
||||||
bonsai.core.geometry.switch_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)]
|
data["ios_item_ids"] = [i["item"].id() for i in ifcopenshell.util.representation.resolve_items(representation)]
|
||||||
|
|
||||||
@classmethod
|
@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())
|
builder = ifcopenshell.util.shape_builder.ShapeBuilder(tool.Ifc.get())
|
||||||
unit_scale = ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get())
|
unit_scale = ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get())
|
||||||
items = []
|
items = []
|
||||||
|
|||||||
Reference in New Issue
Block a user