Assign product types using a property, not by parenting for scalability.

This commit is contained in:
Dion Moult
2020-01-23 15:23:19 +11:00
parent 9e67b05df9
commit 98e082ccac
3 changed files with 11 additions and 3 deletions
@@ -379,9 +379,10 @@ class IfcParser():
product['attributes'].update(attribute_override)
product.update(metadata_override)
if obj.parent \
and self.is_a_type(self.get_ifc_class(obj.parent.name)):
reference = self.get_type_product_reference(obj.parent.name)
type_product = obj.BIMObjectProperties.type_product
if type_product \
and self.is_a_type(self.get_ifc_class(type_product.name)):
reference = self.get_type_product_reference(type_product.name)
self.rel_defines_by_type.setdefault(reference, []).append(self.product_index)
if product['has_boundary_condition']:
@@ -924,6 +925,7 @@ class IfcParser():
results.append(type_product)
library['rel_declares_type_products'].append(index)
# TODO: this should use properties
for key in obj.keys():
if key[0:3] == 'Doc':
self.rel_associates_document_type.setdefault(
@@ -949,6 +951,8 @@ class IfcParser():
elif self.is_structural(obj) and obj.type == 'EMPTY':
names.append('Model/Reference/GRAPH_VIEW/{}'.format(obj.name))
return names
if not obj.data:
return names
name = self.get_ifc_representation_name(obj.data.name)
for context in self.ifc_export_settings.context_tree:
for subcontext in context['subcontexts']:
+1
View File
@@ -420,6 +420,7 @@ class BoundaryCondition(PropertyGroup):
class BIMObjectProperties(PropertyGroup):
global_ids: CollectionProperty(name="GlobalIds", type=GlobalId)
attributes: CollectionProperty(name="Attributes", type=Attribute)
type_product: PointerProperty(name='Type Product', type=bpy.types.Object)
psets: CollectionProperty(name="Psets", type=Pset)
applicable_attributes: EnumProperty(items=getApplicableAttributes, name="Attribute Names")
documents: CollectionProperty(name="Documents", type=Document)
+3
View File
@@ -37,6 +37,9 @@ class BIM_PT_object(Panel):
row = layout.row()
row.prop(props, 'attributes')
row = layout.row()
row.prop(props, 'type_product')
layout.label(text="Property Sets:")
row = layout.row()
row.prop(context.scene.BIMProperties, "pset_name")