Dear Experts,
I am a beginner and doubt on updating of Nominal Value with Name “SKIFCEPMSTATUS”
#187= IFCPROPERTYSINGLEVALUE(‘SKIFCEPMSTATUS’,$,IFCLABEL(‘erected’),$);
//create instance for new ifc file
IfcStore MyIFCData = IfcStore.Open(inputfile);
// get one single element by its unique identifier
IfcObject SingleIfcObject = MyIFCData.Instances.FirstOrDefault(d => d.GlobalId == MyIfcGloballyUniqueId);
if (SingleIfcObject != null)
{
//Get Property set of SingleIfcObject
List<IIfcPropertySingleValue> MyIfcPropertySet = SingleIfcObject.IsDefinedByProperties.Where(r => r.RelatingPropertyDefinition is IIfcPropertySet).SelectMany(r => ((IIfcPropertySet)r.RelatingPropertyDefinition).HasProperties).OfType<IIfcPropertySingleValue>().ToList();
if (MyIfcPropertySet != null)
{
//Get the Name from the MyIfcPropertySet
IIfcPropertySingleValue assemblyPosProperty = MyIfcPropertySet.FirstOrDefault(p => p.Name == ifcepmstatusfieldname);
if (assemblyPosProperty != null)
{
//Check Nominal Value exists and not null
if (assemblyPosProperty.NominalValue != null)
{
string existnomval = assemblyPosProperty.NominalValue.ToString();
//Check whether nominal name is shared or not
//if shared need to create new IFCPROPERTYSINGLEVALUE for ifcepmstatusfieldname with value EPMStatus
//if not shared then need to update existing IFCPROPERTYSINGLEVALUE
using (var txn = MyIFCData.BeginTransaction("Update NominalValues"))
{
assemblyPosProperty.NominalValue = new IfcLabel(EPMStatus);
updct++;
txn.Commit();
flag = true;
MyRow.Cells["ifcepmstatus"].Value = EPMStatus;
rmk = "Status Updated";
}
}
}
else
{
errct++;
rmk = ifcepmstatusfieldname + " not found";
}
}
else
{
errct++;
rmk = "pSet not found";
}
}
else
{
errct++;
rmk = “ID not found in IFC”;
}
// Save the modified model
if (flag == true)
{
MyIFCData.SaveAs(outputFile, StorageType.Ifc);
Console.WriteLine(“IFC file saved successfully.”);
}
else
Console.WriteLine(“No Changes.”);
MyIFCData.Close();
MyRow.Cells[“ifcrmk”].Value = rmk;
I could not get whether shared or not and nominal values update other element also.
Regards, Vijay. +00 91 9444543712