mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-12 06:32:09 +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:
|
for obj in bpy.data.objects:
|
||||||
if obj.type in {"MESH", "EMPTY"}:
|
if obj.type in {"MESH", "EMPTY"}:
|
||||||
tool.Ifc.unlink(obj=obj)
|
tool.Ifc.unlink(obj=obj)
|
||||||
if obj.data:
|
data = obj.data
|
||||||
obj.data.BIMMeshProperties.ifc_definition_id = 0
|
if tool.Geometry.has_mesh_properties(data):
|
||||||
|
data.BIMMeshProperties.ifc_definition_id = 0
|
||||||
for material in bpy.data.materials:
|
for material in bpy.data.materials:
|
||||||
tool.Ifc.unlink(obj=material)
|
tool.Ifc.unlink(obj=material)
|
||||||
context.scene.BIMProperties.ifc_file = ""
|
context.scene.BIMProperties.ifc_file = ""
|
||||||
|
|||||||
@@ -661,6 +661,25 @@ class Geometry(bonsai.core.tool.Geometry):
|
|||||||
return False
|
return False
|
||||||
return isinstance(data, supported_types)
|
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
|
@classmethod
|
||||||
def is_edited(cls, obj: bpy.types.Object) -> bool:
|
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
|
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