Open wojtpl opened 4 months ago
It is what it says - invalid assignment. Style should not be assigned to an instance of the building element, but to its geometrical representation items. You need to drill down to element.Representation.Representations.Items
to find the items you want to style:
Backing up a bit
It's probably worth checking what you're hoping to do here in terms of a use case. This code is amending the styling of a representation of an item in a model. If you save and re-open the IFC file it will should have changed to orange. But it won't change instantly. If you just wanted to highlight the element in real-time this would probably be the wrong approach.
i.e. 2 use cases:
1) the client wants to permanently change all the walls to be orange in the handover model - satisfied by this approach 2) Highlight in orange all elements that meet some external criteria - not satisfied by this approach There are better ways but we would need to know your use case & UI tech choices.
The idea is that I have a drawing program, which can generate IFC but I guess no color representation. I want to write c# standalone app to create copy (modyfied) IFC with IFCBuildingElementProxy named i.e. "Beam, Column, Plate" and then assign color to geometry name to make my IFC easier to read. I am static engineer, not professional programmer. But i guess I have to get deeper in IFC structure. If you know any sources where I can improve my skill please send a link and wish me luck :)
So, you want to create a kind-off analytical view of the IFC? When you say it can generate IFC, is that your code, already written using the Toolkit?
I want to set color to my existing ifc file by element name. I stucked on " Cannot implicitly convert type 'Xbim.Ifc2x3.ProductExtension.IfcBuildingElementProxy' to 'Xbim.Ifc2x3.GeometryResource.IfcRepresentationItem' " Please give me a clue or an example how should I fix it.
#