C
by Coen on 17 Feb 2023, edited 28 Feb 2023
#
+1 votes
Is there a way with the ifcopenshell.api
to get all occurences of all Pset_*Commons?
For example, I want to get the Pset_WallCommon, Pset_WindowCommon, Pset_CoveringCommon, etc
Or is there a way to retrieve these from an .ifc file using ifcopenshell with python?
C
by Coen on 17 Feb 2023
#
I did it like this, but I don't have the feeling this is fool proof:
if ifc_product:
if ifc_product.IsDefinedBy:
for ifc_reldefinesbyproperties in ifc_product.IsDefinedBy:
if ifc_reldefinesbyproperties.is_a() == 'IfcRelDefinesByProperties':
if ifc_reldefinesbyproperties.RelatingPropertyDefinition.is_a() == 'IfcPropertySet':
if (ifc_reldefinesbyproperties.RelatingPropertyDefinition.Name).startswith('Pset_') and (ifc_reldefinesbyproperties.RelatingPropertyDefinition.Name).endswith('Common'):
for ifc_property in ifc_reldefinesbyproperties.RelatingPropertyDefinition.HasProperties:
if ifc_property.Name == property_name:
if ifc_property.NominalValue:
property_set_common_list.append(ifc_property.NominalValue[0])
I know with ifcopenshell it's way easier to use this:
netside_area = ifcopenshell.util.element.get_pset(ifc_product, "Pset_WallCommon","IsExternal")
I could also construct a list with IFC products and string contentacate them with Pset_
and Common
?
C
by Coen on 17 Feb 2023
#
+2 votes
Came up with this eventually, just posting it here in case someone has a better idea:
for product in products:
if product:
ifc_pset_common = 'Pset_' + (str(product.is_a()).replace('Ifc','')) + 'Common'
ifcopenshell.util.element.get_pset(ifc_product=product,ifc_pset_common,'IsExternal')
C
by ChubbyQuark on 18 Feb 2023, edited 18 Feb 2023
#
+1 votes
Had a similar conversation over at github. Good to know. Could this be used as part of the section tool for model wide selections by Status (phase)?
https://github.com/IfcOpenShell/IfcOpenShell/issues/2741#issuecomment-1426955540
C
by Coen on 23 Feb 2023
#
@Coen said:
Came up with this eventually, just posting it here in case someone has a better idea:
for product in products:
if product:
ifc_pset_common = 'Pset_' + (str(product.is_a()).replace('Ifc','')) + 'Common'
ifcopenshell.util.element.get_pset(ifc_product=product,ifc_pset_common,'IsExternal')
Coming back from this, this is actually a really stupid method, it creates psets which don't exist
for example:
0 20FpTZCqJy2vhVJYtjuIce IfcSite Site ... None Pset_SiteCommon None
1 00tMo7QcxqWdIGvc4sMN2A IfcBuilding Building ... None Pset_BuildingCommon None
2 1Q6PG1Po9C5hoyWBnJmRby IfcBuildingStorey -1 fundering ... None Pset_BuildingStoreyCommon None
3 1nOs6Hg0v9fR$sLR1LjIyX IfcWallStandardCase opgaand werk ... 03 Metselwerk - kalkzandsteen C Pset_WallStandardCaseCommon None
4 3vSAOyJwTEhQMEIJ6D9qRY IfcBeam liftputwand ... 02 Beton gewapend - ihw Pset_BeamCommon True
... ... ... ... ... ... ... ...
3817 3Olk_mPe65E0KtHIPy$_$1 IfcVirtualElement None ... None Pset_VirtualElementCommon None
3818 1KjO$vvpVoZVVv2TkgMMiV IfcVirtualElement None ... None Pset_VirtualElementCommon None
3819 0AqwAKlfR7PF2iHZiwYgaj IfcVirtualElement None ... None Pset_VirtualElementCommon None
3820 0YshRU0dY_pqHrelMDKS95 IfcVirtualElement None ... None Pset_VirtualElementCommon None
3821 1SVMTA56aioBMVjIKpDrkY IfcVirtualElement None ... None Pset_VirtualElementCommon None
C
by chachi_ws on 28 Feb 2023
#
Can't you use a regular expression, because the propertyset name always starts with 'Pset_' and ends with 'Common'?