Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Mesple on January 16, 2019, 04:13:09 am

Title: MDG Techno: Add Custom Compartments to Element - BUG?!
Post by: Mesple on January 16, 2019, 04:13:09 am
Hi all,

I tried to write a shape script containing a "custom compartment" named "Toto" to display the name of child elements.

"
shape ChildElement
{
   SetCompartmentName("Toto");
   AppendCompartmentText("#NAME#");
}
"
is-it right?

and then, as mentioned in the help (https://sparxsystems.com/enterprise_architect_user_guide/14.0/modeling_tools/add_custom_compartments_to_ele.html), I've attached a linked Note to manage the compartment visibility (Method 2) but my compartment named "Toto" doesn't appear in the "Feature type" list?  :-[
Why? Any idea?

Thanks a lot
Olivier
Title: Re: MDG Techno: Add Custom Compartments to Element - BUG?!
Post by: Eve on January 16, 2019, 09:38:10 am
Just gave it a try. It does show up for me. The only thing I can think of is that you need to have the compartment show up before it will be available as a feature type. That means you have to have at least one child that isn't on the diagram.
Title: Re: MDG Techno: Add Custom Compartments to Element - BUG?!
Post by: Paolo F Cantoni on January 16, 2019, 05:32:25 pm
Just gave it a try. It does show up for me. The only thing I can think of is that you need to have the compartment show up before it will be available as a feature type. That means you have to have at least one child that isn't on the diagram.
This is definitely a requirement (IIRC).

Paolo
Title: Re: MDG Techno: Add Custom Compartments to Element - BUG?!
Post by: Mesple on January 16, 2019, 06:29:08 pm
Thanks a lot! It works  :) Great

"
decoration Classe
{
 orientation="NE";
 image("Classe.png",0,0,100,100);
}

//Shape ChildElement adds Child Compartments to the parent.

shape ChildElement
{
   if(HasProperty("stereotype", "Besoin"))
   {
      SetCompartmentName("Besoins");
      AppendCompartmentText("#NAME#");
   }
}
"
Olivier