mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-28 19:27:10 +00:00
Allow people to export context / project metadata
This commit is contained in:
@@ -572,6 +572,9 @@ class IfcParser():
|
|||||||
{'rel_aggregates_relating_object': obj}
|
{'rel_aggregates_relating_object': obj}
|
||||||
)
|
)
|
||||||
self.selected_products.append({'raw': obj, 'metadata': metadata})
|
self.selected_products.append({'raw': obj, 'metadata': metadata})
|
||||||
|
elif self.is_a_project(self.get_ifc_class(obj.name)) \
|
||||||
|
or self.is_a_library(self.get_ifc_class(obj.name)):
|
||||||
|
pass
|
||||||
elif not self.is_a_library(self.get_ifc_class(obj.users_collection[0].name)):
|
elif not self.is_a_library(self.get_ifc_class(obj.users_collection[0].name)):
|
||||||
self.selected_products.append({'raw': obj, 'metadata': metadata})
|
self.selected_products.append({'raw': obj, 'metadata': metadata})
|
||||||
|
|
||||||
@@ -695,11 +698,12 @@ class IfcParser():
|
|||||||
def get_project(self):
|
def get_project(self):
|
||||||
for collection in bpy.data.collections:
|
for collection in bpy.data.collections:
|
||||||
if self.is_a_project(self.get_ifc_class(collection.name)):
|
if self.is_a_project(self.get_ifc_class(collection.name)):
|
||||||
|
obj = bpy.data.objects.get(collection.name)
|
||||||
return {
|
return {
|
||||||
'ifc': None,
|
'ifc': None,
|
||||||
'raw': collection,
|
'raw': collection,
|
||||||
'class': self.get_ifc_class(collection.name),
|
'class': self.get_ifc_class(collection.name),
|
||||||
'attributes': self.get_object_attributes(collection)
|
'attributes': self.get_object_attributes(obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_libraries(self):
|
def get_libraries(self):
|
||||||
|
|||||||
@@ -598,6 +598,7 @@ class QuickProjectSetup(bpy.types.Operator):
|
|||||||
building = bpy.data.collections.new('IfcBuilding/My Building')
|
building = bpy.data.collections.new('IfcBuilding/My Building')
|
||||||
building_storey = bpy.data.collections.new('IfcBuildingStorey/Ground Floor')
|
building_storey = bpy.data.collections.new('IfcBuildingStorey/Ground Floor')
|
||||||
|
|
||||||
|
project_obj = bpy.data.objects.new('IfcProject/My Project', None)
|
||||||
site_obj = bpy.data.objects.new('IfcSite/My Site', None)
|
site_obj = bpy.data.objects.new('IfcSite/My Site', None)
|
||||||
building_obj = bpy.data.objects.new('IfcBuilding/My Building', None)
|
building_obj = bpy.data.objects.new('IfcBuilding/My Building', None)
|
||||||
building_storey_obj = bpy.data.objects.new('IfcBuildingStorey/Ground Floor', None)
|
building_storey_obj = bpy.data.objects.new('IfcBuildingStorey/Ground Floor', None)
|
||||||
@@ -607,6 +608,7 @@ class QuickProjectSetup(bpy.types.Operator):
|
|||||||
site.children.link(building)
|
site.children.link(building)
|
||||||
building.children.link(building_storey)
|
building.children.link(building_storey)
|
||||||
|
|
||||||
|
project.objects.link(project_obj)
|
||||||
site.objects.link(site_obj)
|
site.objects.link(site_obj)
|
||||||
building.objects.link(building_obj)
|
building.objects.link(building_obj)
|
||||||
building_storey.objects.link(building_storey_obj)
|
building_storey.objects.link(building_storey_obj)
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ def getIfcProducts(self, context):
|
|||||||
global products_enum
|
global products_enum
|
||||||
if len(products_enum) < 1:
|
if len(products_enum) < 1:
|
||||||
products_enum.extend([(e, e, '') for e in
|
products_enum.extend([(e, e, '') for e in
|
||||||
['IfcElement', 'IfcElementType', 'IfcSpatialElement', 'IfcStructural']])
|
['IfcElement', 'IfcElementType', 'IfcSpatialElement', 'IfcStructural', 'IfcContext']])
|
||||||
return products_enum
|
return products_enum
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ class IfcSchema():
|
|||||||
self.schema_dir = os.path.join(cwd, 'schema') # TODO: make configurable
|
self.schema_dir = os.path.join(cwd, 'schema') # TODO: make configurable
|
||||||
# TODO: Make it less troublesome
|
# TODO: Make it less troublesome
|
||||||
self.products = [
|
self.products = [
|
||||||
|
'IfcContext',
|
||||||
'IfcElement',
|
'IfcElement',
|
||||||
'IfcSpatialElement',
|
'IfcSpatialElement',
|
||||||
'IfcStructural',
|
'IfcStructural',
|
||||||
|
|||||||
@@ -0,0 +1,114 @@
|
|||||||
|
{
|
||||||
|
"IfcProject": {
|
||||||
|
"is_abstract": false,
|
||||||
|
"parent": "IfcContext",
|
||||||
|
"attributes": [
|
||||||
|
{
|
||||||
|
"name": "GlobalId",
|
||||||
|
"type": "IfcGloballyUniqueId",
|
||||||
|
"is_enum": false,
|
||||||
|
"enum_values": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Name",
|
||||||
|
"type": "IfcLabel",
|
||||||
|
"is_enum": false,
|
||||||
|
"enum_values": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Description",
|
||||||
|
"type": "IfcText",
|
||||||
|
"is_enum": false,
|
||||||
|
"enum_values": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ObjectType",
|
||||||
|
"type": "IfcLabel",
|
||||||
|
"is_enum": false,
|
||||||
|
"enum_values": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "LongName",
|
||||||
|
"type": "IfcLabel",
|
||||||
|
"is_enum": false,
|
||||||
|
"enum_values": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Phase",
|
||||||
|
"type": "IfcLabel",
|
||||||
|
"is_enum": false,
|
||||||
|
"enum_values": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"complex_attributes": [
|
||||||
|
{
|
||||||
|
"name": "OwnerHistory",
|
||||||
|
"type": "IfcOwnerHistory",
|
||||||
|
"is_select": false,
|
||||||
|
"select_types": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "UnitsInContext",
|
||||||
|
"type": "IfcUnitAssignment",
|
||||||
|
"is_select": false,
|
||||||
|
"select_types": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"IfcProjectLibrary": {
|
||||||
|
"is_abstract": false,
|
||||||
|
"parent": "IfcContext",
|
||||||
|
"attributes": [
|
||||||
|
{
|
||||||
|
"name": "GlobalId",
|
||||||
|
"type": "IfcGloballyUniqueId",
|
||||||
|
"is_enum": false,
|
||||||
|
"enum_values": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Name",
|
||||||
|
"type": "IfcLabel",
|
||||||
|
"is_enum": false,
|
||||||
|
"enum_values": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Description",
|
||||||
|
"type": "IfcText",
|
||||||
|
"is_enum": false,
|
||||||
|
"enum_values": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ObjectType",
|
||||||
|
"type": "IfcLabel",
|
||||||
|
"is_enum": false,
|
||||||
|
"enum_values": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "LongName",
|
||||||
|
"type": "IfcLabel",
|
||||||
|
"is_enum": false,
|
||||||
|
"enum_values": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Phase",
|
||||||
|
"type": "IfcLabel",
|
||||||
|
"is_enum": false,
|
||||||
|
"enum_values": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"complex_attributes": [
|
||||||
|
{
|
||||||
|
"name": "OwnerHistory",
|
||||||
|
"type": "IfcOwnerHistory",
|
||||||
|
"is_select": false,
|
||||||
|
"select_types": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "UnitsInContext",
|
||||||
|
"type": "IfcUnitAssignment",
|
||||||
|
"is_select": false,
|
||||||
|
"select_types": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user