mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
bim.convert_to_blender to avoid types without mesh properties
This commit is contained in:
@@ -92,8 +92,9 @@ class ConvertToBlender(bpy.types.Operator):
|
||||
for obj in bpy.data.objects:
|
||||
if obj.type in {"MESH", "EMPTY"}:
|
||||
tool.Ifc.unlink(obj=obj)
|
||||
if obj.data:
|
||||
obj.data.BIMMeshProperties.ifc_definition_id = 0
|
||||
data = obj.data
|
||||
if tool.Geometry.has_mesh_properties(data):
|
||||
data.BIMMeshProperties.ifc_definition_id = 0
|
||||
for material in bpy.data.materials:
|
||||
tool.Ifc.unlink(obj=material)
|
||||
context.scene.BIMProperties.ifc_file = ""
|
||||
|
||||
@@ -661,6 +661,25 @@ class Geometry(bonsai.core.tool.Geometry):
|
||||
return False
|
||||
return isinstance(data, supported_types)
|
||||
|
||||
@classmethod
|
||||
def has_mesh_properties(cls, data: Union[bpy.types.ID, None]) -> TypeIs[
|
||||
Union[
|
||||
bpy.types.Mesh,
|
||||
bpy.types.Curve,
|
||||
bpy.types.Camera,
|
||||
bpy.types.PointLight,
|
||||
]
|
||||
]:
|
||||
supported_types = (
|
||||
bpy.types.Mesh,
|
||||
bpy.types.Curve,
|
||||
bpy.types.Camera,
|
||||
bpy.types.PointLight,
|
||||
)
|
||||
if not data:
|
||||
return False
|
||||
return isinstance(data, supported_types)
|
||||
|
||||
@classmethod
|
||||
def is_edited(cls, obj: bpy.types.Object) -> bool:
|
||||
return not all([tool.Cad.is_x(o, 1.0) for o in obj.scale]) or obj in IfcStore.edited_objs
|
||||
|
||||
Reference in New Issue
Block a user