mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-25 09:32:37 +00:00
Allow custom Qto quantities to be exported
This commit is contained in:
@@ -1386,6 +1386,7 @@ class IfcExporter():
|
|||||||
def create_qto_properties(self, qto):
|
def create_qto_properties(self, qto):
|
||||||
if qto['attributes']['Name'] in schema.ifc.qtos:
|
if qto['attributes']['Name'] in schema.ifc.qtos:
|
||||||
return self.create_templated_qto_properties(qto)
|
return self.create_templated_qto_properties(qto)
|
||||||
|
return self.create_custom_qto_properties(qto)
|
||||||
|
|
||||||
def create_pset_properties(self, pset):
|
def create_pset_properties(self, pset):
|
||||||
if pset['attributes']['Name'] in schema.ifc.psets:
|
if pset['attributes']['Name'] in schema.ifc.psets:
|
||||||
@@ -1402,6 +1403,22 @@ class IfcExporter():
|
|||||||
}))
|
}))
|
||||||
return properties
|
return properties
|
||||||
|
|
||||||
|
def create_custom_qto_properties(self, qto):
|
||||||
|
properties = []
|
||||||
|
for key, value in qto['raw'].items():
|
||||||
|
if 'Area' in key:
|
||||||
|
quantity_type = 'Area'
|
||||||
|
elif 'Volume' in key:
|
||||||
|
quantity_type = 'Volume'
|
||||||
|
else:
|
||||||
|
quantity_type = 'Length'
|
||||||
|
properties.append(
|
||||||
|
self.file.create_entity(f'IfcQuantity{quantity_type}', **{
|
||||||
|
'Name': key,
|
||||||
|
f'{quantity_type}Value': float(value)
|
||||||
|
}))
|
||||||
|
return properties
|
||||||
|
|
||||||
def create_templated_pset_properties(self, pset):
|
def create_templated_pset_properties(self, pset):
|
||||||
properties = []
|
properties = []
|
||||||
templates = schema.ifc.psets[pset['attributes']['Name']]['HasPropertyTemplates']
|
templates = schema.ifc.psets[pset['attributes']['Name']]['HasPropertyTemplates']
|
||||||
|
|||||||
Reference in New Issue
Block a user