mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-25 01:50:02 +00:00
Store generated GlobalId values for parametric geometry
This commit is contained in:
@@ -58,6 +58,7 @@ classes = (
|
|||||||
ui.Pset,
|
ui.Pset,
|
||||||
ui.Document,
|
ui.Document,
|
||||||
ui.Classification,
|
ui.Classification,
|
||||||
|
ui.GlobalId,
|
||||||
ui.BIMObjectProperties,
|
ui.BIMObjectProperties,
|
||||||
ui.BIMMaterialProperties,
|
ui.BIMMaterialProperties,
|
||||||
ui.BIMMeshProperties,
|
ui.BIMMeshProperties,
|
||||||
|
|||||||
@@ -212,16 +212,26 @@ class IfcParser():
|
|||||||
def resolve_array_modifier(self, product):
|
def resolve_array_modifier(self, product):
|
||||||
object = product['raw']
|
object = product['raw']
|
||||||
instance_objects = [(object, object.location)]
|
instance_objects = [(object, object.location)]
|
||||||
|
global_id_index = 0
|
||||||
for instance in self.get_instances(object):
|
for instance in self.get_instances(object):
|
||||||
created_instances = []
|
created_instances = []
|
||||||
for n in range(instance.count-1):
|
for n in range(instance.count-1):
|
||||||
for o in instance_objects:
|
for o in instance_objects:
|
||||||
location = o[1] + ((n+1) * instance.offset)
|
location = o[1] + ((n+1) * instance.offset)
|
||||||
self.add_product(self.get_product({ 'raw': o[0], 'metadata': product['metadata'] },
|
self.add_product(self.get_product({ 'raw': o[0], 'metadata': product['metadata'] },
|
||||||
{'location': location}, {'GlobalId': ifcopenshell.guid.new()}))
|
{'location': location}, {'GlobalId': self.get_parametric_global_id(object, global_id_index)}))
|
||||||
created_instances.append((o[0], location))
|
created_instances.append((o[0], location))
|
||||||
instance_objects.extend(created_instances)
|
instance_objects.extend(created_instances)
|
||||||
|
|
||||||
|
def get_parametric_global_id(self, object, index):
|
||||||
|
global_ids = object.BIMObjectProperties.global_ids
|
||||||
|
total_global_ids = len(global_ids)
|
||||||
|
if index < total_global_ids:
|
||||||
|
return global_ids[index].name
|
||||||
|
global_id = object.BIMObjectProperties.global_ids.add()
|
||||||
|
global_id.name = ifcopenshell.guid.new()
|
||||||
|
return global_id.name
|
||||||
|
|
||||||
def add_product(self, product):
|
def add_product(self, product):
|
||||||
self.products.append(product)
|
self.products.append(product)
|
||||||
self.product_name_index_map[product['raw'].name] = self.product_index
|
self.product_name_index_map[product['raw'].name] = self.product_index
|
||||||
|
|||||||
@@ -112,6 +112,9 @@ class Classification(bpy.types.PropertyGroup):
|
|||||||
name: bpy.props.StringProperty(name="Name")
|
name: bpy.props.StringProperty(name="Name")
|
||||||
identification: bpy.props.StringProperty(name="Identification")
|
identification: bpy.props.StringProperty(name="Identification")
|
||||||
|
|
||||||
|
class GlobalId(bpy.types.PropertyGroup):
|
||||||
|
name: bpy.props.StringProperty(name="Name")
|
||||||
|
|
||||||
class BIMObjectProperties(bpy.types.PropertyGroup):
|
class BIMObjectProperties(bpy.types.PropertyGroup):
|
||||||
def getApplicableAttributes(self, context):
|
def getApplicableAttributes(self, context):
|
||||||
if '/' in bpy.context.active_object.name \
|
if '/' in bpy.context.active_object.name \
|
||||||
@@ -129,6 +132,7 @@ class BIMObjectProperties(bpy.types.PropertyGroup):
|
|||||||
results.append((uri, uri, ''))
|
results.append((uri, uri, ''))
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
global_ids: bpy.props.CollectionProperty(name="GlobalIds", type=GlobalId)
|
||||||
attributes: bpy.props.CollectionProperty(name="Attributes", type=Attribute)
|
attributes: bpy.props.CollectionProperty(name="Attributes", type=Attribute)
|
||||||
psets: bpy.props.CollectionProperty(name="Psets", type=Pset)
|
psets: bpy.props.CollectionProperty(name="Psets", type=Pset)
|
||||||
applicable_attributes: bpy.props.EnumProperty(items=getApplicableAttributes, name="Attribute Names")
|
applicable_attributes: bpy.props.EnumProperty(items=getApplicableAttributes, name="Attribute Names")
|
||||||
|
|||||||
Reference in New Issue
Block a user