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;
}
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
}
}
Aggregations