Allow type definitions which have no representation, to be used as simply ways to inherit properties

This commit is contained in:
Dion Moult
2019-09-05 21:38:52 +10:00
parent 9c11e6bd09
commit 5ce8917c82
+15 -14
View File
@@ -304,14 +304,14 @@ class IfcParser():
return [] return []
return [{ return [{
'ifc': None, 'ifc': None,
'raw': object, 'raw': selected['object'],
'location': object.location, 'location': selected['object'].location,
'up_axis': object.matrix_world.to_quaternion() @ Vector((0, 0, 1)), 'up_axis': selected['object'].matrix_world.to_quaternion() @ Vector((0, 0, 1)),
'forward_axis': object.matrix_world.to_quaternion() @ Vector((1, 0, 0)), 'forward_axis': selected['object'].matrix_world.to_quaternion() @ Vector((1, 0, 0)),
'class': self.get_ifc_class(object.name), 'class': self.get_ifc_class(selected['object'].name),
'representation': self.get_representation_reference_from_object(object), 'representation': self.get_representation_reference_from_object(selected['object']),
'attributes': self.get_object_attributes(object) 'attributes': self.get_object_attributes(selected['object'])
} for object in self.selected_types ] } for selected in self.selected_types ]
def get_representation_reference_from_object(self, object): def get_representation_reference_from_object(self, object):
if not self.ifc_export_settings.has_representations \ if not self.ifc_export_settings.has_representations \
@@ -466,13 +466,14 @@ class IfcExporter():
def create_type_products(self): def create_type_products(self):
for product in self.ifc_parser.type_products: for product in self.ifc_parser.type_products:
representation = self.ifc_parser.representations[product['representation']]['ifc']
placement = self.create_ifc_axis_2_placement_3d(product['location'], product['up_axis'], product['forward_axis']) placement = self.create_ifc_axis_2_placement_3d(product['location'], product['up_axis'], product['forward_axis'])
representation_map = self.file.createIfcRepresentationMap(placement, representation) product['attributes'].update({ 'GlobalId': ifcopenshell.guid.new() })
product['attributes'].update({
'GlobalId': ifcopenshell.guid.new(), if product['representation']:
'RepresentationMaps': [representation_map] representation = self.ifc_parser.representations[product['representation']]['ifc']
}) representation_map = self.file.createIfcRepresentationMap(placement, representation)
product['attributes']['RepresentationMaps'] = [representation_map]
try: try:
product['ifc'] = self.file.create_entity(product['class'], **product['attributes']) product['ifc'] = self.file.create_entity(product['class'], **product['attributes'])
except RuntimeError as e: except RuntimeError as e: