[gme-users] setting up GME subtypes in an interpreter
    Matthew J. Emerson 
    mjemerson at isis.vanderbilt.edu
       
    Mon Feb 20 16:29:07 CST 2006
    
    
  
I'm trying to attach one FCO to another FCO. Actually I anticipate
having a general problem where after creating a large number of complex
model elements, I discover that I need to make them all subtypes of some
other model element. This is because of the weird unsupported semantics
I unfortunately decided to give to GME subtyping. So, I wanted to
quickly make a small tool that I could use to do this when the need
arises.
 
For now, this is what I came up with in terms of a raw COM interpreter:
 
STDMETHODIMP RawComponent::InvokeEx( IMgaProject *project,  IMgaFCO
*currentobj,  
                                                      IMgaFCOs
*selectedobjs,  long param) {
      COMTRY {
        if(interactive) {
            CComBSTR projname;
            CComBSTR focusname = "<nothing>";
            CComPtr<IMgaTerritory> terr;
            IMgaFCO* subtype(NULL);
            IMgaFCO* supertype(NULL);
            CComBSTR subtypeID ("id-0065-00000611");
            CComBSTR supertypeID ("id-0065-00000890");
            COMTHROW(project->CreateTerritory(NULL, &terr));
            COMTHROW(project->BeginTransaction(terr));
            try {
                  COMTHROW(project->GetFCOByID(subtypeID, &subtype));
                  COMTHROW(project->GetFCOByID(supertypeID,
&supertype));
                  if(subtype && supertype)
COMTHROW(subtype->AttachToArcheType(supertype, false));
                  COMTHROW(project->CommitTransaction());
            }     catch(...) { project->AbortTransaction(); throw; }
 
        } 
      } COMCATCH(;);
}
 
This is unsophisticated, but effective considering I know nothing about
COM programming. ;) Since I don't think I'll need to do this more than
once or twice a week, I can simply edit the object IDs and recompile the
interpreter as needed.
 
Thanks for the help Zoli.
 
--Matt
 
  _____  
From: gme-users-bounces at list.isis.vanderbilt.edu
[mailto:gme-users-bounces at list.isis.vanderbilt.edu] On Behalf Of Zoltan
Molnar
Sent: Monday, February 20, 2006 4:04 PM
To: gme-users
Subject: RE: [gme-users] setting up GME subtypes in an interpreter
 
IsBound indicates whether e.g. a reference inherits its target from the
base, or it has a separate target specified.
What kind of element will you attach in this way?
Zoli
	-----Original Message-----
	From: gme-users-bounces at list.isis.vanderbilt.edu
[mailto:gme-users-bounces at list.isis.vanderbilt.edu] On Behalf Of Zoltan
Molnar
	Sent: Monday, February 20, 2006 3:58 PM
	To: gme-users
	Subject: RE: [gme-users] setting up GME subtypes in an
interpreter
	You have to add the following xml attributes:
	-derivedfrom
	-isinstance
	-isbound
	-isprimary
	 
	Zoli
	 
		-----Original Message-----
		From: gme-users-bounces at list.isis.vanderbilt.edu
[mailto:gme-users-bounces at list.isis.vanderbilt.edu] On Behalf Of Matthew
J. Emerson
		Sent: Monday, February 20, 2006 3:51 PM
		To: gme-users
		Subject: RE: [gme-users] setting up GME subtypes in an
interpreter
		Thanks Zoli.
		 
		In the case where I only want to adjust a single element
in this way, is it possible to hand-edit the .xme form of the model? If
so, can you describe the necessary modification?
		 
		--Matt
		 
		
  _____  
		From: gme-users-bounces at list.isis.vanderbilt.edu
[mailto:gme-users-bounces at list.isis.vanderbilt.edu] On Behalf Of Zoltan
Molnar
		Sent: Monday, February 20, 2006 3:00 PM
		To: gme-users
		Subject: RE: [gme-users] setting up GME subtypes in an
interpreter
		 
		Hi,
		 
		You can use AttachToArcheType [in Mga.Idl, defined as:
AttachToArcheType([in] IMgaFCO *newtype, [in] VARIANT_BOOL instance);]
which can make an element a subtype of another.
		For example in a raw com interpreter you would just
create a territory, open a transaction, Attach an fco, then commit the
transaction.
		 
		br, Zoli
			-----Original Message-----
			From: gme-users-bounces at list.isis.vanderbilt.edu
[mailto:gme-users-bounces at list.isis.vanderbilt.edu] On Behalf Of Matthew
J. Emerson
			Sent: Monday, February 20, 2006 2:50 PM
			To: gme-users
			Subject: [gme-users] setting up GME subtypes in
an interpreter
			Is it possible to use an interpreter to find two
existing elements in a model and make one into the subtype of another?
Does anyone have a code sample?
			 
			--Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.isis.vanderbilt.edu/pipermail/gme-users/attachments/20060220/9dac1e53/attachment.htm
    
    
More information about the gme-users
mailing list