Search in sources :

Example 6 with IfcPropertySet

use of org.bimserver.models.ifc2x3tc1.IfcPropertySet 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)

Example 7 with IfcPropertySet

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

the class TestCreateProperties method createProperty.

private void createProperty(IfcWindow window, IfcModelInterface model, String name, String description, Object value) throws IfcModelInterfaceException {
    IfcRelDefinesByProperties ifcRelDefinesByProperties = model.create(IfcRelDefinesByProperties.class);
    window.getIsDefinedBy().add(ifcRelDefinesByProperties);
    IfcPropertySet propertySet = model.create(IfcPropertySet.class);
    ifcRelDefinesByProperties.setRelatingPropertyDefinition(propertySet);
    IfcPropertySingleValue property = model.create(IfcPropertySingleValue.class);
    propertySet.getHasProperties().add(property);
    property.setName(name);
    property.setDescription(description);
    if (value instanceof Boolean) {
        IfcBoolean ifcValue = model.create(IfcBoolean.class);
        ifcValue.setWrappedValue(((Boolean) value) ? Tristate.TRUE : Tristate.FALSE);
        property.setNominalValue(ifcValue);
    } else {
    // Unimplemented
    }
}
Also used : IfcPropertySingleValue(org.bimserver.models.ifc2x3tc1.IfcPropertySingleValue) IfcRelDefinesByProperties(org.bimserver.models.ifc2x3tc1.IfcRelDefinesByProperties) IfcBoolean(org.bimserver.models.ifc2x3tc1.IfcBoolean) IfcPropertySet(org.bimserver.models.ifc2x3tc1.IfcPropertySet) IfcBoolean(org.bimserver.models.ifc2x3tc1.IfcBoolean)

Aggregations

IfcPropertySet (org.bimserver.models.ifc2x3tc1.IfcPropertySet)7 IfcRelDefinesByProperties (org.bimserver.models.ifc2x3tc1.IfcRelDefinesByProperties)7 IfcProperty (org.bimserver.models.ifc2x3tc1.IfcProperty)6 IfcPropertySetDefinition (org.bimserver.models.ifc2x3tc1.IfcPropertySetDefinition)6 IfcPropertySingleValue (org.bimserver.models.ifc2x3tc1.IfcPropertySingleValue)6 IfcRelDefines (org.bimserver.models.ifc2x3tc1.IfcRelDefines)6 IfcBoolean (org.bimserver.models.ifc2x3tc1.IfcBoolean)3 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 BimServerClientInterface (org.bimserver.plugins.services.BimServerClientInterface)2 UsernamePasswordAuthenticationInfo (org.bimserver.shared.UsernamePasswordAuthenticationInfo)2 Test (org.junit.Test)2 HashMap (java.util.HashMap)1 LinkedHashSet (java.util.LinkedHashSet)1 IdEObject (org.bimserver.emf.IdEObject)1 IfcAreaMeasure (org.bimserver.models.ifc2x3tc1.IfcAreaMeasure)1