Closed RolandoTonin closed 8 months ago
Assuming it's IFC2x3. There is no PredefinedType on a Proxy in that version of the schema. It was only introduced in IFC4 (by replacing CompositionType
See https://standards.buildingsmart.org/IFC/DEV/IFC4_2/FINAL/HTML/schema/ifcsharedbldgelements/lexical/ifcbuildingelementproxy.htm
Because you're using the IFC4 interfaces which map through to the IFC2x3 implementation (where appropriate) I suspect it's not mapping the IfcBuildingElementProxyTypeEnum
to the legacy IfcElementCompositionEnum
.
A few options:
ObjectType
contains all you need?CompositionType
(Won't help you here. See point 3)I'd go with 1)
Side note: your point about #6
in the 2nd parameter is a red herring. That's the OwnerHistory field, which updates after you edit the element.
thank Andy, I've checked above code on a IFC 4 file and it works fine. I didn't know tha predefinedtype was introduced only in IFC 4 and above.
thanks a lot, Rolando
Anyway I resolve with below code:
if(element is Xbim.Ifc2x3.Interfaces.IIfcBuildingElementProxy element2x3) { element2x3.CompositionType = Xbim.Ifc2x3.ProductExtension.IfcElementCompositionEnum.COMPLEX; } else { element.PredefinedType = IfcBuildingElementProxyTypeEnum.USERDEFINED; } an it work fine bothh IFC 4 and IFC 2x 3 file versions.
I use EssentialLibrary version 5.1.341 in my code I want to update some IfcBuildingElementProxy element properties in IFC file (3x2) such as PredefinedType enum value, name, objecttype and Tag. I use below code:
element is Xbim.Ifc4.Interfaces.IfcBuildingElementProxy. At the end of my code i save in a new file: model.SaveAs(destFileName, StorageType.Ifc);
I have no problem with Name, Tag, and objectType but predefinedType does not appear in new output file.
I debug above code in Visual Studio. Before update element.Name, element value is:
and PredefinedType should be #6. After update element.Name I get:
PredefinedType was disapeared and element.PredefinedType is null. After when I assigna USERDEFINED to element.predefinedtype the value change but above string was not updated and conseguently when I save the file.
What can I do? Best Regards, Rolando