Tested and solved.
It's possible to access packages within element attributes, but is a little wicked.
First let me put things clearly:
1. Packages are containers of elements, that have an associated Element (Hidden one) for input of general information (just like element, e.g. Author, Status, Priority, etc..)
2. The Class stereotyped Model Document, can have attributes of Type Package, when this occur we just have set an attribute of a Class that is not Primitive, and for that EA just set a ClassifierID for the Attribute.
All things together:
» The package that we added to the Class as an attribute (for documentation purpose), was set with ClassifierID equal to ElementID that represents the Package General Information (as already said).
» To access Packages from Class Model Document you have to:
1. Obtain The Element associated to Package: REpository.GetElementByID(Element.Attribute.ClassifierID)
2. Iterate through packages for the package that have an Element associated that equals the classifierID we have in attribute: Package.Element.ElementID = REpository.GetElementByID(Element.Attribute.ClassifierID).ElementID
NOTES:
- Attributes with primitive type have classifierID set to 0.
- Root Node Packages have no element associated.
I hope that this helped you in some way, and all other one's of EA's community.
My purpose of accessing packages in Class Model Document (MDC): i had to generate HTML reports for an MDC because EA's doesn't do it out of the box, so i created an Addin for the generation of HTML Reports based on MDC Classes.