mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
Fix bugs where adding types without a material was broken. See #1513.
This commit is contained in:
@@ -6,6 +6,7 @@ import ifcopenshell.util.representation
|
||||
from . import wall, slab
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
from ifcopenshell.api.pset.data import Data as PsetData
|
||||
from mathutils import Vector
|
||||
|
||||
|
||||
class AddTypeInstance(bpy.types.Operator):
|
||||
|
||||
@@ -150,7 +150,7 @@ class DumbSlabPlaner:
|
||||
def regenerate_from_type(self, usecase_path, ifc_file, settings):
|
||||
self.unit_scale = ifcopenshell.util.unit.calculate_unit_scale(ifc_file)
|
||||
new_material = ifcopenshell.util.element.get_material(settings["relating_type"])
|
||||
if not new_material.is_a("IfcMaterialLayerSet"):
|
||||
if not new_material or not new_material.is_a("IfcMaterialLayerSet"):
|
||||
return
|
||||
new_thickness = sum([l.LayerThickness for l in new_material.MaterialLayers])
|
||||
self.change_thickness(settings["related_object"], new_thickness)
|
||||
|
||||
@@ -819,7 +819,7 @@ class DumbWallPlaner:
|
||||
def regenerate_from_type(self, usecase_path, ifc_file, settings):
|
||||
self.unit_scale = ifcopenshell.util.unit.calculate_unit_scale(ifc_file)
|
||||
new_material = ifcopenshell.util.element.get_material(settings["relating_type"])
|
||||
if not new_material.is_a("IfcMaterialLayerSet"):
|
||||
if not new_material or not new_material.is_a("IfcMaterialLayerSet"):
|
||||
return
|
||||
new_thickness = sum([l.LayerThickness for l in new_material.MaterialLayers])
|
||||
self.change_thickness(settings["related_object"], new_thickness)
|
||||
|
||||
@@ -84,6 +84,8 @@ class Usecase:
|
||||
|
||||
def map_material_usages(self):
|
||||
type_material = ifcopenshell.util.element.get_material(self.settings["relating_type"])
|
||||
if not type_material:
|
||||
return
|
||||
if type_material.is_a("IfcMaterialLayerSet"):
|
||||
ifcopenshell.api.run(
|
||||
"material.assign_material",
|
||||
|
||||
Reference in New Issue
Block a user