diff --git a/src/blenderbim/blenderbim/bim/module/root/operator.py b/src/blenderbim/blenderbim/bim/module/root/operator.py index c7f9e09ff8..5ff17caf5a 100644 --- a/src/blenderbim/blenderbim/bim/module/root/operator.py +++ b/src/blenderbim/blenderbim/bim/module/root/operator.py @@ -129,6 +129,8 @@ class AssignClass(bpy.types.Operator): if product.is_a("IfcElementType"): self.place_in_types_collection(obj) + elif product.is_a("IfcOpeningElement"): + self.place_in_openings_collection(obj) elif ( product.is_a("IfcSpatialElement") or product.is_a("IfcSpatialStructureElement") @@ -152,6 +154,18 @@ class AssignClass(bpy.types.Operator): break break + def place_in_openings_collection(self, obj): + for project in [c for c in bpy.context.view_layer.layer_collection.children if "IfcProject" in c.name]: + if not [c for c in project.children if "IfcOpeningElements" in c.name]: + opening_elements = bpy.data.collections.new("IfcOpeningElements") + project.collection.children.link(opening_elements) + for collection in [c for c in project.children if "IfcOpeningElements" in c.name]: + for user_collection in obj.users_collection: + user_collection.objects.unlink(obj) + collection.collection.objects.link(obj) + break + break + def place_in_spatial_collection(self, obj): for collection in obj.users_collection: if collection.name == obj.name: diff --git a/src/ifcopenshell-python/ifcopenshell/validate.py b/src/ifcopenshell-python/ifcopenshell/validate.py index 22bd05ee93..1506138954 100644 --- a/src/ifcopenshell-python/ifcopenshell/validate.py +++ b/src/ifcopenshell-python/ifcopenshell/validate.py @@ -34,7 +34,7 @@ class json_logger: self.instance = instance def log(self, level, message, *args, **kwargs): - self.statements.append(log_entry_type(level, message % args, kwargs.get('instance'))._asdict()) + self.statements.append(log_entry_type(level, message % args, kwargs.get("instance"))._asdict()) def __getattr__(self, level): return functools.partial(self.log, level, instance=self.instance) @@ -75,7 +75,7 @@ def assert_valid(attr, val, schema): while isinstance(attr_type, type_wrappers): attr_type = attr_type.declared_type() - + invalid = False if isinstance(attr_type, simple_type): @@ -120,10 +120,10 @@ def validate(f, logger): numeric identifiers or invalidate entity names are not caught by this function. Some of these might have been logged and can be retrieved by calling `ifcopenshell.get_log()`. A verification of the type, entity and global WHERE rules is also not implemented. - + For every entity instance in the model, it is checked that the entity is not abstract that every attribute value is of the correct type and that the inverse attributes are of the correct cardinality. - + Express simple types are checked for their valuation type. For select types it is asserted that the value conforms to one of the leaves. For enumerations it is checked that the value is indeed on of the items. For aggregations it is checked that the elements and the cardinality conforms. Type declarations (IfcInteger which is an integer) are