Closed seghier closed 9 months ago
Is the answer so difficult from xbim team?
Fistly elements in IFC don't have "a color". They have representations, and those representations may have representationsItems that are styled with one or more colors. Think about an IfcWindow which may have both a Frame element in one color and a set of glass panes with a different (transparent) color. See https://standards.buildingsmart.org/IFC/RELEASE/IFC4/ADD1/HTML/link/ifcstyleditem.htm
Secondly the sample code you've provided is all wrong for what you want to do. It hierarchically descends the Spatial Hierarchy (Building->Storey->Space) and then lists elements in those spatial elements. But it doesn't get into the representation of those elements so you'll never get a IfcSurfaceStyle (Not least because IfcSurfaceStyle is not derived from IfcObjectDefinition), so if (o is IIfcSurfaceStyle surfaceStyle)
will never be satisfied.
Before you start copy and pasting code I really recommend exploring some simple models with XbimXplorer so you can better understand how IFC works, as the Xbim .net code is just a direct implementation of BuildingSMART IFC.
Take is easy, if you can't answer don't waste my time please, or don't answer at all. Before copy paste links take a breath.
Hello When i load ifc file how can i get the color of each element? this don't give me any color