[gme-users] About creating child objects using C#

Kevin Smyth kevin.m.smyth at gmail.com
Thu Feb 1 10:05:24 CST 2018


Hi Somesh,

You can do this with the COM API as follows:
var child =
((MgaModel)subject).CreateChildObject(((MgaMetaModel)subject.MetaBase).RoleByName["Kind"]);
(The role name is typically the name of the metamodel Model, Atom,
Reference, or Set)


But I would suggest using the CSharpDSMLGenerator (the .NET button in
MetaGME). This generates a .dll which you can reference, then use like:

MgaFCO subject;
var component = ISIS.GME.Dsml.CyPhyML.Classes.Component.Cast(subject);
var parameter = ISIS.GME.Dsml.CyPhyML.Classes.Parameter.Create(component);

The domain-specific API is more convenient. (But it uses the COM API under
the hood, so anything you can do in the domain-specific API can be done
with the COM API).

Kevin

On Thu, Feb 1, 2018 at 4:40 AM, Somesh Das <somesh_au at yahoo.com> wrote:

> Hi,
> I am creating an interpreter for GME using C#. I want to create child
> objects programmatically. For this, first I have to get all child objects
> defined in the metamodel.
> In C++, we can get all child objects using "getFCOmeta().childFCOs()" and
> for creating child objects we use "myAtom = BON::Atom::create(parent,
> childObj->KindName);"
> Now, my question is, which methods are available in C# to perform above
> mentioned operation (i.e. getting child objects from meta and creating
> childobject).
>
> Thanks & Regards
> Somesh Das
>
>
> _______________________________________________
> gme-users mailing list
> gme-users at list.isis.vanderbilt.edu
> http://list.isis.vanderbilt.edu/cgi-bin/mailman/listinfo/gme-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.isis.vanderbilt.edu/pipermail/gme-users/attachments/20180201/0487838a/attachment.html>


More information about the gme-users mailing list