parameters: (ifcfile, prodrepr)
return_statement: return colors
docstring: Build the colors relation table from a product.
  
      Returns
      -------
      dict
          A dictionary with `{id: (r,g,b), ...}` values.
docstring_summary: Build the colors relation table from a product.
docstring_tokens: Build the colors relation table from a product .
function: def buildRelProductColors(ifcfile, prodrepr):
      """Build the colors relation table from a product.
  
      Returns
      -------
      dict
          A dictionary with `{id: (r,g,b), ...}` values.
      """
      if DEBUG_prod_repr:
          _msg(32 * "-")
          _msg("Product-color table")
  
      colors = dict()
      i = 0
  
      for p in prodrepr.keys():
          # Representation item, see `IfcRepresentationItem` documentation.
          # All kinds of geometric or topological representation items
          # `IfcExtrudedAreaSolid`, `IfcMappedItem`, `IfcFacetedBrep`,
          # `IfcBooleanResult`, `IfcBooleanClippingResult`, etc.
          _body = ifcfile[p].Representation.Representations[0]
          repr_item = _body.Items[0]
  
          if DEBUG_prod_colors:
              _msg("{}: {}, {}, '{}', rep_item {}".format(i, ifcfile[p].id(),
                                                          ifcfile[p].is_a(),
                                                          ifcfile[p].Name,
                                                          repr_item))
          # Get the geometric representations which have a presentation style.
          # All representation items have the inverse attribute `StyledByItem`
          # for this.
          # There will be geometric representations which do not have
          # a presentation style so `StyledByItem` will be empty.
          if repr_item.StyledByItem:
              if DEBUG_prod_colors:
                  _msg("  StyledByItem -> {}".format(repr_item.StyledByItem))
              # it has to be a `IfcStyledItem`, no check needed
              styled_item = repr_item.StyledByItem[0]
  
              # Write into colors table if a `IfcStyledItem` exists
              # for this product, write `None` if something goes wrong
              # or if the ifc file has errors and thus no valid color
              # is returned
              colors[p] = getColorFromStyledItem(styled_item)
  
          i += 1
      return colors
function_tokens: def buildRelProductColors ( ifcfile , prodrepr ) : if DEBUG_prod_repr : _msg ( 32 * "-" ) _msg ( "Product-color table" ) colors = dict ( ) i = 0 for p in prodrepr . keys ( ) : # Representation item, see `IfcRepresentationItem` documentation. # All kinds of geometric or topological representation items # `IfcExtrudedAreaSolid`, `IfcMappedItem`, `IfcFacetedBrep`, # `IfcBooleanResult`, `IfcBooleanClippingResult`, etc. _body = ifcfile [ p ] . Representation . Representations [ 0 ] repr_item = _body . Items [ 0 ] if DEBUG_prod_colors : _msg ( "{}: {}, {}, '{}', rep_item {}" . format ( i , ifcfile [ p ] . id ( ) , ifcfile [ p ] . is_a ( ) , ifcfile [ p ] . Name , repr_item ) ) # Get the geometric representations which have a presentation style. # All representation items have the inverse attribute `StyledByItem` # for this. # There will be geometric representations which do not have # a presentation style so `StyledByItem` will be empty. if repr_item . StyledByItem : if DEBUG_prod_colors : _msg ( "  StyledByItem -> {}" . format ( repr_item . StyledByItem ) ) # it has to be a `IfcStyledItem`, no check needed styled_item = repr_item . StyledByItem [ 0 ] # Write into colors table if a `IfcStyledItem` exists # for this product, write `None` if something goes wrong # or if the ifc file has errors and thus no valid color # is returned colors [ p ] = getColorFromStyledItem ( styled_item ) i += 1 return colors