addPSet method
- IInstance instance,
- IInstance pset
Adds an IfcRelDefinesByProperties association to an instance.
This method associates the specified property set relationship relDef
with the given instance, establishing a property definition association.
Returns true if the property set association was successfully created,
or false if:
- Either instance handle is invalid
- The association already exists
- The operation fails for any other reason
Changes are persisted to the database.
Example usage:
final psetRel = instanceFromJson({
'@type': 'IfcRelDefinesByProperties',
// Select attribute, so in JSON, it is an object with
// selected type as its attribute.
'RelatingPropertyDefinition': {
'IfcPropertySet': {
'Name': 'Pset_WallCommon',
'HasProperties': [
{
'@type': 'IfcPropertySingleValue',
'Name': 'Reference',
'NominalValue': {
// IfcValue selected type
'IfcSimpleValue': {
// IfcSimpleValue selected type and value
'IfcIdentifier': 'outer_wall.0'
}
}
},
{
'@type': 'IfcPropertySingleValue',
'Name': 'LoadBearing',
'NominalValue': {
// IfcValue selected type
'IfcSimpleValue': {
// IfcSimpleValue selected type and value
'IfcBoolean': true
}
}
},
// ... additional properties
]
}
}
});
final success = addPSet(wallInstance, psetRel);
if (success) {
print('Property set association added successfully');
} else {
print('Failed to add property set association');
}
Implementation
@override
bool addPSet(IInstance instance, IInstance pset) {
if (pset is! PIInstance || instance is! PIInstance) {
return false;
}
return addPSetFFI(projectPtr, ptr, instance.ptr, pset.ptr);
}