Search in sources :

Example 6 with IfcPropertySetDefinition

use of org.bimserver.models.ifc2x3tc1.IfcPropertySetDefinition in project BIMserver by opensourceBIM.

the class IfcUtils method listProperties.

/**
 * Lists all properties of a given IfcPopertySet that are of type IfcPropertySingleValue, all values are converted to the appropriate Java type
 *
 * @param ifcObject
 * @param propertySetName
 * @return
 */
public static Map<String, Object> listProperties(IfcObject ifcObject, String propertySetName) {
    Map<String, Object> result = new HashMap<>();
    for (IfcRelDefines ifcRelDefines : ifcObject.getIsDefinedBy()) {
        if (ifcRelDefines instanceof IfcRelDefinesByProperties) {
            IfcRelDefinesByProperties ifcRelDefinesByProperties = (IfcRelDefinesByProperties) ifcRelDefines;
            IfcPropertySetDefinition propertySetDefinition = ifcRelDefinesByProperties.getRelatingPropertyDefinition();
            if (propertySetDefinition instanceof IfcPropertySet) {
                IfcPropertySet ifcPropertySet = (IfcPropertySet) propertySetDefinition;
                if (ifcPropertySet.getName() != null && ifcPropertySet.getName().equalsIgnoreCase(propertySetName)) {
                    for (IfcProperty ifcProperty : ifcPropertySet.getHasProperties()) {
                        if (ifcProperty instanceof IfcPropertySingleValue) {
                            IfcPropertySingleValue propertyValue = (IfcPropertySingleValue) ifcProperty;
                            result.put(propertyValue.getName(), nominalValueToObject(propertyValue.getNominalValue()));
                        }
                    }
                }
            }
        }
    }
    return result;
}
Also used : IfcProperty(org.bimserver.models.ifc2x3tc1.IfcProperty) IfcPropertySingleValue(org.bimserver.models.ifc2x3tc1.IfcPropertySingleValue) HashMap(java.util.HashMap) EObject(org.eclipse.emf.ecore.EObject) IdEObject(org.bimserver.emf.IdEObject) IfcObject(org.bimserver.models.ifc2x3tc1.IfcObject) IfcRelDefinesByProperties(org.bimserver.models.ifc2x3tc1.IfcRelDefinesByProperties) IfcPropertySet(org.bimserver.models.ifc2x3tc1.IfcPropertySet) IfcPropertySetDefinition(org.bimserver.models.ifc2x3tc1.IfcPropertySetDefinition) IfcRelDefines(org.bimserver.models.ifc2x3tc1.IfcRelDefines)

Example 7 with IfcPropertySetDefinition

use of org.bimserver.models.ifc2x3tc1.IfcPropertySetDefinition in project BIMserver by opensourceBIM.

the class IfcUtils method getIfcQuantityVolume.

public static Double getIfcQuantityVolume(IfcProduct ifcProduct, String name) {
    for (IfcRelDefines ifcRelDefines : ifcProduct.getIsDefinedBy()) {
        if (ifcRelDefines instanceof IfcRelDefinesByProperties) {
            IfcRelDefinesByProperties ifcRelDefinesByProperties = (IfcRelDefinesByProperties) ifcRelDefines;
            IfcPropertySetDefinition propertySetDefinition = ifcRelDefinesByProperties.getRelatingPropertyDefinition();
            if (propertySetDefinition instanceof IfcElementQuantity) {
                if (propertySetDefinition.getName().equals("BaseQuantities")) {
                    IfcElementQuantity ifcElementQuantity = (IfcElementQuantity) propertySetDefinition;
                    for (IfcPhysicalQuantity ifcPhysicalQuantity : ifcElementQuantity.getQuantities()) {
                        if (ifcPhysicalQuantity instanceof IfcQuantityVolume) {
                            return ((IfcQuantityVolume) ifcPhysicalQuantity).getVolumeValue();
                        }
                    }
                }
            }
        }
    }
    return null;
}
Also used : IfcQuantityVolume(org.bimserver.models.ifc2x3tc1.IfcQuantityVolume) IfcElementQuantity(org.bimserver.models.ifc2x3tc1.IfcElementQuantity) IfcPhysicalQuantity(org.bimserver.models.ifc2x3tc1.IfcPhysicalQuantity) IfcRelDefinesByProperties(org.bimserver.models.ifc2x3tc1.IfcRelDefinesByProperties) IfcPropertySetDefinition(org.bimserver.models.ifc2x3tc1.IfcPropertySetDefinition) IfcRelDefines(org.bimserver.models.ifc2x3tc1.IfcRelDefines)

Example 8 with IfcPropertySetDefinition

use of org.bimserver.models.ifc2x3tc1.IfcPropertySetDefinition in project BIMserver by opensourceBIM.

the class IfcUtils method getBooleanProperty.

public static Tristate getBooleanProperty(IfcObject ifcObject, String propertyName) {
    for (IfcRelDefines ifcRelDefines : ifcObject.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()) {
                    if (ifcProperty instanceof IfcPropertySingleValue) {
                        IfcPropertySingleValue propertyValue = (IfcPropertySingleValue) ifcProperty;
                        if (ifcProperty.getName().equals(propertyName)) {
                            IfcBoolean label = (IfcBoolean) propertyValue.getNominalValue();
                            return label.getWrappedValue();
                        }
                    }
                }
            }
        }
    }
    return null;
}
Also used : IfcProperty(org.bimserver.models.ifc2x3tc1.IfcProperty) IfcPropertySingleValue(org.bimserver.models.ifc2x3tc1.IfcPropertySingleValue) IfcRelDefinesByProperties(org.bimserver.models.ifc2x3tc1.IfcRelDefinesByProperties) IfcPropertySet(org.bimserver.models.ifc2x3tc1.IfcPropertySet) IfcPropertySetDefinition(org.bimserver.models.ifc2x3tc1.IfcPropertySetDefinition) IfcRelDefines(org.bimserver.models.ifc2x3tc1.IfcRelDefines) IfcBoolean(org.bimserver.models.ifc2x3tc1.IfcBoolean)

Aggregations

IfcPropertySetDefinition (org.bimserver.models.ifc2x3tc1.IfcPropertySetDefinition)8 IfcRelDefines (org.bimserver.models.ifc2x3tc1.IfcRelDefines)8 IfcRelDefinesByProperties (org.bimserver.models.ifc2x3tc1.IfcRelDefinesByProperties)8 IfcProperty (org.bimserver.models.ifc2x3tc1.IfcProperty)6 IfcPropertySet (org.bimserver.models.ifc2x3tc1.IfcPropertySet)6 IfcPropertySingleValue (org.bimserver.models.ifc2x3tc1.IfcPropertySingleValue)5 IfcValue (org.bimserver.models.ifc2x3tc1.IfcValue)3 URL (java.net.URL)2 HashSet (java.util.HashSet)2 IfcModelInterface (org.bimserver.emf.IfcModelInterface)2 SDeserializerPluginConfiguration (org.bimserver.interfaces.objects.SDeserializerPluginConfiguration)2 SProject (org.bimserver.interfaces.objects.SProject)2 IfcBoolean (org.bimserver.models.ifc2x3tc1.IfcBoolean)2 IfcElementQuantity (org.bimserver.models.ifc2x3tc1.IfcElementQuantity)2 BimServerClientInterface (org.bimserver.plugins.services.BimServerClientInterface)2 UsernamePasswordAuthenticationInfo (org.bimserver.shared.UsernamePasswordAuthenticationInfo)2 Test (org.junit.Test)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 LinkedHashSet (java.util.LinkedHashSet)1