public static int getNrOfPropertySets(IfcProduct ifcProduct) { int nrPropertySets = 0; for (IfcRelDefines ifcRelDefines : ifcProduct.getIsDefinedBy()) { if (ifcRelDefines instanceof IfcRelDefinesByProperties) { IfcRelDefinesByProperties ifcRelDefinesByProperties = (IfcRelDefinesByProperties) ifcRelDefines; IfcPropertySetDefinition propertySetDefinition = ifcRelDefinesByProperties.getRelatingPropertyDefinition(); if (propertySetDefinition instanceof IfcPropertySet) { nrPropertySets++; } } } return nrPropertySets; }
public static List<String> listElementQuantities(IfcProduct ifcProduct) { List<String> list = new ArrayList<>(); for (IfcRelDefines ifcRelDefines : ifcProduct.getIsDefinedBy()) { if (ifcRelDefines instanceof IfcRelDefinesByProperties) { IfcRelDefinesByProperties ifcRelDefinesByProperties = (IfcRelDefinesByProperties) ifcRelDefines; IfcPropertySetDefinition propertySetDefinition = ifcRelDefinesByProperties.getRelatingPropertyDefinition(); if (propertySetDefinition instanceof IfcElementQuantity) { IfcElementQuantity ifcElementQuantity = (IfcElementQuantity) propertySetDefinition; list.add(ifcElementQuantity.getName()); } } } return list; }
public static int getNrOfProperties(IfcProduct ifcProduct) { int nrProperties = 0; for (IfcRelDefines ifcRelDefines : ifcProduct.getIsDefinedBy()) { if (ifcRelDefines instanceof IfcRelDefinesByProperties) { IfcRelDefinesByProperties ifcRelDefinesByProperties = (IfcRelDefinesByProperties) ifcRelDefines; IfcPropertySetDefinition propertySetDefinition = ifcRelDefinesByProperties.getRelatingPropertyDefinition(); if (propertySetDefinition instanceof IfcPropertySet) { IfcPropertySet ifcPropertySet = (IfcPropertySet) propertySetDefinition; nrProperties += ifcPropertySet.getHasProperties().size(); } } } return nrProperties; }
public static int getNrOfRelations(IfcProduct product) { return product.getDecomposes().size() + product.getHasAssignments().size() + product.getHasAssociations().size() + product.getIsDecomposedBy().size() + product.getReferencedBy().size() + product.getIsDefinedBy().size(); }
public static Set<String> listPropertyNames(IfcProduct ifcProduct) { Set<String> list = new HashSet<>(); for (IfcRelDefines ifcRelDefines : ifcProduct.getIsDefinedBy()) { if (ifcRelDefines instanceof IfcRelDefinesByProperties) { IfcRelDefinesByProperties ifcRelDefinesByProperties = (IfcRelDefinesByProperties) ifcRelDefines; IfcPropertySetDefinition propertySetDefinition = ifcRelDefinesByProperties.getRelatingPropertyDefinition(); if (propertySetDefinition instanceof IfcPropertySet) { IfcPropertySet ifcPropertySet = (IfcPropertySet) propertySetDefinition; for (IfcProperty ifcProperty : ifcPropertySet.getHasProperties()) { list.add(ifcProperty.getName()); } } } } return list; }
public static Double getIfcQuantityArea(IfcProduct ifcProduct) { Double area = null; for (IfcRelDefines ifcRelDefines : ifcProduct.getIsDefinedBy()) { if (ifcRelDefines instanceof IfcRelDefinesByProperties) { IfcRelDefinesByProperties ifcRelDefinesByProperties = (IfcRelDefinesByProperties) ifcRelDefines; IfcPropertySetDefinition propertySetDefinition = ifcRelDefinesByProperties.getRelatingPropertyDefinition(); if (propertySetDefinition instanceof IfcElementQuantity) { IfcElementQuantity ifcElementQuantity = (IfcElementQuantity) propertySetDefinition; for (IfcPhysicalQuantity ifcPhysicalQuantity : ifcElementQuantity.getQuantities()) { if (ifcPhysicalQuantity instanceof IfcQuantityArea) { if (area == null) { area = 0d; } area += ((IfcQuantityArea) ifcPhysicalQuantity).getAreaValue(); } } } } } return area; }
public static Double getIfcQuantityVolume(IfcProduct ifcProduct) { Double volume = null; for (IfcRelDefines ifcRelDefines : ifcProduct.getIsDefinedBy()) { if (ifcRelDefines instanceof IfcRelDefinesByProperties) { IfcRelDefinesByProperties ifcRelDefinesByProperties = (IfcRelDefinesByProperties) ifcRelDefines; IfcPropertySetDefinition propertySetDefinition = ifcRelDefinesByProperties.getRelatingPropertyDefinition(); if (propertySetDefinition instanceof IfcElementQuantity) { IfcElementQuantity ifcElementQuantity = (IfcElementQuantity) propertySetDefinition; for (IfcPhysicalQuantity ifcPhysicalQuantity : ifcElementQuantity.getQuantities()) { if (ifcPhysicalQuantity instanceof IfcQuantityVolume) { if (volume == null) { volume = 0d; } volume += ((IfcQuantityVolume) ifcPhysicalQuantity).getVolumeValue(); } } } } } return volume; }
public static int getNrOfPSets(IfcProduct ifcProduct, boolean onlyOfficial) { int nrPSets = 0; for (IfcRelDefines ifcRelDefines : ifcProduct.getIsDefinedBy()) { if (ifcRelDefines instanceof IfcRelDefinesByProperties) { IfcRelDefinesByProperties ifcRelDefinesByProperties = (IfcRelDefinesByProperties) ifcRelDefines; IfcPropertySetDefinition propertySetDefinition = ifcRelDefinesByProperties.getRelatingPropertyDefinition(); if (propertySetDefinition instanceof IfcPropertySet) { if (onlyOfficial) { try { Ifc2x3tc1OfficialPsets.valueOf(propertySetDefinition.getName()); nrPSets++; } catch (Exception e) { } } else { if (propertySetDefinition.getName().startsWith("Pset_")) { nrPSets++; } } } } } return nrPSets; }