mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-24 07:46:54 +00:00
Allow export of IFC class into CSV
This commit is contained in:
+13
-11
@@ -143,7 +143,9 @@ class IfcSelectorParser():
|
|||||||
class IfcAttributeExtractor():
|
class IfcAttributeExtractor():
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_element_key(element, key):
|
def get_element_key(element, key):
|
||||||
if hasattr(element, key):
|
if key == 'IfcClass':
|
||||||
|
return element.is_a()
|
||||||
|
elif hasattr(element, key):
|
||||||
return getattr(element, key)
|
return getattr(element, key)
|
||||||
elif '.' not in key:
|
elif '.' not in key:
|
||||||
return None
|
return None
|
||||||
@@ -161,19 +163,19 @@ class IfcAttributeExtractor():
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def set_element_key(element, key, value):
|
def set_element_key(element, key, value):
|
||||||
if '.' not in key \
|
if hasattr(element, key):
|
||||||
and hasattr(element, key):
|
return setattr(element, key, value)
|
||||||
setattr(element, key, value)
|
if '.' not in key:
|
||||||
elif key[0:3] == 'Qto':
|
return
|
||||||
|
if key[0:3] == 'Qto':
|
||||||
qto, prop = key.split('.')
|
qto, prop = key.split('.')
|
||||||
qto = IfcAttributeExtractor.get_element_qto(element, qto_name)
|
qto = IfcAttributeExtractor.get_element_qto(element, qto_name)
|
||||||
if qto:
|
if qto:
|
||||||
IfcAttributeExtractor.set_qto_property(qto, prop, value)
|
return IfcAttributeExtractor.set_qto_property(qto, prop, value)
|
||||||
else:
|
pset_name, prop = key.split('.')
|
||||||
pset_name, prop = key.split('.')
|
pset = IfcAttributeExtractor.get_element_pset(element, pset_name)
|
||||||
pset = IfcAttributeExtractor.get_element_pset(element, pset_name)
|
if pset:
|
||||||
if pset:
|
return IfcAttributeExtractor.set_pset_property(pset, prop, value)
|
||||||
return IfcAttributeExtractor.set_pset_property(pset, prop, value)
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_element_qto(element, name):
|
def get_element_qto(element, name):
|
||||||
|
|||||||
Reference in New Issue
Block a user