Newb, traversing assembly instances

Hi,

I am new to Solidworks.

I'm trying to write a macro to traverse an assembly and, for each instance, compute a reference and save it in the instance.

Later, another macro should create a drawing and place a centered annotation, in each instace, with the computed reference.

I've tryed to use the custom properties, but if I do that, the reference is attached to the part and the reference is then copied to all instances of that part. I don't want that because the reference may vary from instance to instance. Also I'm having problems in centering the annotation in part, because I don't know how to get the positions of the parts in the drawing.

Hope I've expressed my self correctly (and hope someone can help me ).

Thanks in advance,

Joana

SolidworksApi macros