[gme-users] MGAMeta: UsingDefinedFCOs
Simon Görke
simon.goerke at ils.uni-stuttgart.de
Thu Mar 6 06:44:32 CST 2008
Indeed casting solved the problem - thanks.
Regards,
Simon
> -----Original Message-----
> From: gme-users-bounces at list.isis.vanderbilt.edu
> [mailto:gme-users-bounces at list.isis.vanderbilt.edu] On Behalf
> Of Larry Howard
> Sent: Sunday, March 02, 2008 3:46 PM
> To: A list for GME users to share thoughts and discuss bugs and fixes.
> Subject: Re: [gme-users] MGAMeta: UsingDefinedFCOs
>
> 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
>
>
More information about the gme-users
mailing list