mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-25 09:32:37 +00:00
Add support for projection elements
This commit is contained in:
@@ -114,6 +114,7 @@ class IfcParser():
|
|||||||
self.rel_aggregates = {}
|
self.rel_aggregates = {}
|
||||||
self.rel_voids_elements = {}
|
self.rel_voids_elements = {}
|
||||||
self.rel_fills_elements = {}
|
self.rel_fills_elements = {}
|
||||||
|
self.rel_projects_elements = {}
|
||||||
self.rel_connects_structural_member = {}
|
self.rel_connects_structural_member = {}
|
||||||
self.rel_assigns_to_group = {}
|
self.rel_assigns_to_group = {}
|
||||||
self.representations = {}
|
self.representations = {}
|
||||||
@@ -318,18 +319,20 @@ class IfcParser():
|
|||||||
|
|
||||||
def resolve_voids_and_fills(self, i, obj):
|
def resolve_voids_and_fills(self, i, obj):
|
||||||
for m in obj.modifiers:
|
for m in obj.modifiers:
|
||||||
if m.type == 'BOOLEAN' and m.object is not None:
|
if m.type != 'BOOLEAN' or m.object is None:
|
||||||
void = self.get_product_index_from_raw_name(m.object.name)
|
continue
|
||||||
if void is not None:
|
void_or_projection = self.get_product_index_from_raw_name(m.object.name)
|
||||||
if i not in self.rel_voids_elements:
|
if void_or_projection is None:
|
||||||
self.rel_voids_elements[i] = []
|
continue
|
||||||
self.rel_voids_elements[i].append(void)
|
if m.operation == 'DIFFERENCE':
|
||||||
if m.object.parent:
|
self.rel_voids_elements.setdefault(i, []).append(void_or_projection)
|
||||||
fill = self.get_product_index_from_raw_name(m.object.parent.name)
|
if not m.object.parent:
|
||||||
if fill is not None:
|
continue
|
||||||
if void not in self.rel_fills_elements:
|
fill = self.get_product_index_from_raw_name(m.object.parent.name)
|
||||||
self.rel_fills_elements[void] = []
|
if fill:
|
||||||
self.rel_fills_elements[void].append(fill)
|
self.rel_fills_elements.setdefault(void_or_projection, []).append(fill)
|
||||||
|
elif m.operation == 'UNION':
|
||||||
|
self.rel_projects_elements.setdefault(i, []).append(void_or_projection)
|
||||||
|
|
||||||
def get_axis(self, matrix, axis):
|
def get_axis(self, matrix, axis):
|
||||||
return matrix.col[axis].to_3d().normalized()
|
return matrix.col[axis].to_3d().normalized()
|
||||||
@@ -1081,6 +1084,7 @@ class IfcExporter():
|
|||||||
self.relate_objects_to_psets()
|
self.relate_objects_to_psets()
|
||||||
self.relate_objects_to_opening_elements()
|
self.relate_objects_to_opening_elements()
|
||||||
self.relate_opening_elements_to_fillings()
|
self.relate_opening_elements_to_fillings()
|
||||||
|
self.relate_objects_to_projection_elements()
|
||||||
self.relate_objects_to_materials()
|
self.relate_objects_to_materials()
|
||||||
for set_type in ['constituent', 'layer', 'profile']:
|
for set_type in ['constituent', 'layer', 'profile']:
|
||||||
self.relate_objects_to_material_sets(set_type)
|
self.relate_objects_to_material_sets(set_type)
|
||||||
@@ -2196,6 +2200,15 @@ class IfcExporter():
|
|||||||
self.ifc_parser.products[related_building_element]['ifc']
|
self.ifc_parser.products[related_building_element]['ifc']
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def relate_objects_to_projection_elements(self):
|
||||||
|
for relating_building_element, related_projection_elements in self.ifc_parser.rel_projects_elements.items():
|
||||||
|
for related_projection_element in related_projection_elements:
|
||||||
|
self.file.createIfcRelProjectsElement(
|
||||||
|
ifcopenshell.guid.new(), self.owner_history, None, None,
|
||||||
|
self.ifc_parser.products[relating_building_element]['ifc'],
|
||||||
|
self.ifc_parser.products[related_projection_element]['ifc']
|
||||||
|
)
|
||||||
|
|
||||||
def relate_elements_to_spatial_structures(self):
|
def relate_elements_to_spatial_structures(self):
|
||||||
for relating_structure, related_elements in self.ifc_parser.rel_contained_in_spatial_structure.items():
|
for relating_structure, related_elements in self.ifc_parser.rel_contained_in_spatial_structure.items():
|
||||||
self.file.createIfcRelContainedInSpatialStructure(
|
self.file.createIfcRelContainedInSpatialStructure(
|
||||||
|
|||||||
Reference in New Issue
Block a user