opensourceBIM / BIMserver

The open source BIMserver platform
GNU Affero General Public License v3.0
1.56k stars 611 forks source link

Issue Modifying "NominalValue" Attribute for "IfcPropertySingleValue" Using "setStringAttribute" #1321

Closed saintcodec closed 3 months ago

saintcodec commented 4 months ago

I am encountering an issue when attempting to modify the NominalValue attribute of an IfcPropertySingleValue object using the setStringAttribute method within a transaction. Despite NominalValue visibly existing in the data retrieved by getDataObjectByOid, attempts to modify this attribute return an error stating that the attribute does not exist.

What i did:

  1. Retrieve an object using getDataObjectByOid, which shows NominalValue in the list of attributes.

    {
    "response": {
    "result": {
      "__type": "SDataObject",
      "guid": "",
      "name": "",
      "oid": 525627,
      "rid": 0,
      "type": "IfcPropertySingleValue",
      "uuid": null,
      "values": [
        {
          "__type": "SListDataValue",
          "fieldName": "HasExternalReferences",
          "oid": -1,
          "rid": 0,
          "uuid": null,
          "values": []
        },
        {
          "__type": "SSimpleDataValue",
          "fieldName": "Name",
          "oid": -1,
          "rid": 0,
          "stringValue": "PowerFactor",
          "uuid": null
        },
        {
          "__type": "SSimpleDataValue",
          "fieldName": "Description",
          "oid": -1,
          "rid": 0,
          "stringValue": null,
          "uuid": null
        },
        {
          "__type": "SListDataValue",
          "fieldName": "PartOfPset",
          "oid": -1,
          "rid": 0,
          "uuid": null,
          "values": [
            {
              "__type": "SReferenceDataValue",
              "fieldName": null,
              "guid": null,
              "oid": 525224,
              "rid": 0,
              "typeName": "IfcPropertySet",
              "uuid": null
            }
          ]
        },
        {
          "__type": "SListDataValue",
          "fieldName": "PropertyForDependance",
          "oid": -1,
          "rid": 0,
          "uuid": null,
          "values": []
        },
        {
          "__type": "SListDataValue",
          "fieldName": "PropertyDependsOn",
          "oid": -1,
          "rid": 0,
          "uuid": null,
          "values": []
        },
        {
          "__type": "SListDataValue",
          "fieldName": "PartOfComplex",
          "oid": -1,
          "rid": 0,
          "uuid": null,
          "values": []
        },
        {
          "__type": "SListDataValue",
          "fieldName": "HasConstraints",
          "oid": -1,
          "rid": 0,
          "uuid": null,
          "values": []
        },
        {
          "__type": "SListDataValue",
          "fieldName": "HasApprovals",
          "oid": -1,
          "rid": 0,
          "uuid": null,
          "values": []
        },
        {
          "__type": "SSimpleDataValue",
          "fieldName": "NominalValue",
          "oid": -1,
          "rid": 0,
          "stringValue": "1.0",
          "uuid": null
        }
      ]
    }
    }
    }
  2. Start a transaction using startTransaction.

  3. Attempt to modify the NominalValue attribute using:

{
  "token": "<access_token>",
  "request": {
    "interface": "LowLevelInterface",
    "method": "setStringAttribute",
    "parameters": {
      "tid": "<transaction_id>",
      "oid": 525627,
      "attributeName": "NominalValue",
      "value": "22"
    }
  }
}
  1. Commit the transaction.

Server response:

{
  "response": {
    "exception": {
      "__type": "UserException",
      "message": "No attribute with the name \"NominalValue\" found in class \"IfcPropertySingleValue\""
    }
  }
}

BIMserver version: 1.5.184

Could someone please assist in clarifying why this issue might be occurring, and if there's a specific approach or method required for modifying attributes such as NominalValue for IfcPropertySingleValue objects in BIMserver?

hlg commented 3 months ago

A similar question has been asked before - it is a duplicate of #621.

From the attributeName "PowerFactor" and the original value "1.0", I assume this property is part of a Pset_ElectricalDeviceCommon property set. Thus you want to use the method setWrappedDoubleAttribute with type IfcNormalisedRatioMeasure.