[gme-users] MGAMeta: UsingDefinedFCOs
Larry Howard
larry.howard at vanderbilt.edu
Sun Mar 2 08:46:02 CST 2008
Simon,
In general, casting is a good first step when you run into this kind
of issue. No guarantees, just a measure to ensure a particular
interpretation of a returned COM pointer type.
So,
meta = win32com.client.gencache.GetModuleForProgID("Mga.MgaMetaFCOs")
rFCOs = project.RootMeta.RootFolder.DefinedFCOs
for rFCO in rFCOs:
print meta.IMgaMetaFCO(rFCO).Name
works fine for me.
In searching over a large body of our Python code for GME, I find a
significant amount of casting of Meta-related COM pointers. This is
merely an observation from experience, but it bears out the above
guidance.
Regards,
lph
--
Larry Howard, Sr. Research Scientist
Institute for Software Integrated Systems, Vanderbilt University
On Mar 2, 2008, at 5:46 AM, Simon Görke wrote:
> Hello everybody,
>
> I have a problem accessing the FCOs of my Meta model from an
> interpreter
> written in Python / COM.
>
> While a simple
>
> print project.RootMeta.RootFolder.DefinedFCOByName("MetaEntityName",
> 1).Name
>
> works without problems, using
>
> rFCOs = project.RootMeta.RootFolder.DefinedFCOs
> print rFCOs.Count
> for rFCO in rFCOs:
> print rFCO.Name
>
> is not successful. The number of meta entities returned by the
> rFCOs.Count
> seems correct, however I am not able to actually access the FCOs
> returned
> (Python gives me "AttributeError: <unknown>.Name").
> Within the interpreter, I have to access ALL Meta Entities without
> knowing
> their names, so using the "DefinedFCOs" method seemed to be a good
> idea to
> me.
>
> BTW: Using MGA Collections in general does not seem to be part of the
> problem, as the follwing code snippet is working:
>
> FCOs = project.RootFolder.ChildFCOs
> for FCO in FCOs:
> print FCO.Name
>
> I really do not know how to go on on and wheather this issue results
> from
> lack of understanding on my side or even a problem in the GME /
> Python COM
> Interface?
> Any advice is highly appreciated!
>
> Thanks,
> Simon
>
> _______________________________________________
> gme-users mailing list
> gme-users at list.isis.vanderbilt.edu
> http://list.isis.vanderbilt.edu/mailman/listinfo/gme-users
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2698 bytes
Desc: not available
Url : http://list.isis.vanderbilt.edu/pipermail/gme-users/attachments/20080302/61b3adb8/attachment.bin
More information about the gme-users
mailing list