mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 14:41:25 +00:00
Allow export of any product class
This commit is contained in:
@@ -17,8 +17,10 @@ class IfcParser():
|
|||||||
for object in bpy.context.selected_objects:
|
for object in bpy.context.selected_objects:
|
||||||
product_data = {
|
product_data = {
|
||||||
'ifc': None,
|
'ifc': None,
|
||||||
|
'class': self.get_ifc_class(object.name),
|
||||||
'raw': object,
|
'raw': object,
|
||||||
'relating_structure': None
|
'relating_structure': None,
|
||||||
|
'attributes': { 'Name': self.get_ifc_name(object.name) }
|
||||||
}
|
}
|
||||||
for collection in object.users_collection:
|
for collection in object.users_collection:
|
||||||
if self.is_a_spatial_structure_element(self.get_ifc_class(collection.name)):
|
if self.is_a_spatial_structure_element(self.get_ifc_class(collection.name)):
|
||||||
@@ -169,9 +171,16 @@ class IfcExporter():
|
|||||||
self.file.createIfcCartesianPoint(
|
self.file.createIfcCartesianPoint(
|
||||||
(object.location.x, object.location.y, object.location.z))))
|
(object.location.x, object.location.y, object.location.z))))
|
||||||
representation = self.create_representation(object)
|
representation = self.create_representation(object)
|
||||||
product['ifc'] = self.file.createIfcBuildingElementProxy(
|
product['attributes'].update({
|
||||||
ifcopenshell.guid.new(),
|
'GlobalId': ifcopenshell.guid.new(), # TODO: unhardcode
|
||||||
self.owner_history, object.name, None, None, placement, representation, None, None)
|
'OwnerHistory': self.owner_history, # TODO: unhardcode
|
||||||
|
'ObjectPlacement': placement,
|
||||||
|
'Representation': representation
|
||||||
|
})
|
||||||
|
try:
|
||||||
|
product['ifc'] = self.file.create_entity(product['class'], **product['attributes'])
|
||||||
|
except RuntimeError as e:
|
||||||
|
print('The product "{}/{}" could not be created: {}'.format(product['class'], product['attributes']['Name'], e.args))
|
||||||
|
|
||||||
def create_representation(self, object):
|
def create_representation(self, object):
|
||||||
ifc_vertices = []
|
ifc_vertices = []
|
||||||
|
|||||||
Reference in New Issue
Block a user