How does Imprinting and the affinity work together?
You don't get any benefits from Affinity.



The activation cost of Soul Foundry's activated ability is based on the Converted Mana Cost (CMC) of the imprinted card, and Somber Hoverguard's CMC is 6.


  202.3. The converted mana cost of an object is a number equal to the total amount of mana in its mana cost, regardless of color.
  
  202.1. A card’s mana cost is indicated by mana symbols near the top of the card. [...]


Affinity doesn't affect the mana cost. It's a cost reduction that reduces the cost to cast the spell, not its mana cost. To paraphrase 601.2e,


  cost to cast a spell
  = mana cost or alternative cost
  + additional costs and cost increases
  - cost reductions