Book a Demo

Author Topic: Edit 'Feature visibility' using API  (Read 2937 times)

piotrek84

  • EA Novice
  • *
  • Posts: 19
  • Karma: +0/-0
    • View Profile
Edit 'Feature visibility' using API
« on: February 24, 2010, 09:00:33 pm »
Hi All,
Is there any way of changing feature visibility (e.g. show taggs on diagram by default) using API? I can't seem to find a property allowing this...
Also, is there a 'GetAppearance' method for Elements somwhere?

Thanks in advance,
Peter
« Last Edit: February 24, 2010, 09:07:25 pm by piotrek84 »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Edit 'Feature visibility' using API
« Reply #1 on: February 25, 2010, 08:51:55 pm »
Peter,

These settings are hidden somewhere in the "magic string" fields of EA.
I used this code to set the "show parameter details" to "name only"

Code: [Select]
           EA.Diagram diagram = ((EADiagram)aDiagram.getWrappedDiagram()).getWrappedDiagram() as EA.Diagram;
            string style = diagram.ExtendedStyle;
            //the ExtendedStyle is a magic string that contains (amongst others) OpParams=<number>.
            //OpParams=3 will display only the name of the parameters in messages in sequence diagrams
            int begin = style.IndexOf("OpParams=");
            if (begin >= 0)
            {
                string searchString = style.Substring(begin, 10);
                diagram.ExtendedStyle = style.Replace(searchString, "OpParams=3");
                diagram.Update();
                Logger.log("Diagram " + diagram.Name + " updated");
            }

Geert

piotrek84

  • EA Novice
  • *
  • Posts: 19
  • Karma: +0/-0
    • View Profile
Re: Edit 'Feature visibility' using API
« Reply #2 on: February 27, 2010, 12:19:04 am »
Thanks.

Regards,
Peter