step by step
2016 SOLIDWORKS API Help - GetMates Method (IComponent2) SwComponent.GetMates
for each mate you will need to get the mateEntities
from each mate entity you can then get the component
with the component you can see if it is the same as the one you are starting with or not. if it isnt then you found a new component to add
once you build your list you can use
Hi! Did you manage to write a macro? Can you share it?
that is up to you Alex.
i gave you the road map, now it is up to you