Book a Demo

Author Topic: Add new diagram - Encountered an improper argument  (Read 5978 times)

neuron

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Add new diagram - Encountered an improper argument
« on: January 14, 2010, 01:48:22 am »
Hello,
I'am trying to add new diagram,
but after this code I have error "Encountered an improper argument"
and after I reopen .ea file, the diagram is added to package.
Can somebody help me ?

C# CODE:

public bool EA_OnPostNewMethod(
      EA.Repository repository,
      EA.EventProperties eventProperties)
    {
      EA.Package package = (EA.Package)repository.GetPackageByID(5);
      EA.Diagram diagram = (EA.Diagram)package.Diagrams.AddNew("ExampleDiagram", "Class");
      diagram.Notes = "Example note";
      diagram.Update();

      return true;
    }


Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Add new diagram - Encountered an improper argu
« Reply #1 on: January 14, 2010, 01:52:26 am »
Are you sure the type of the diagram you are adding is correct?

Geert

neuron

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: Add new diagram - Encountered an improper argu
« Reply #2 on: January 14, 2010, 02:47:59 am »
Hello,

I changed diagram type to "Activity", which is the first one from help - Built-In Diagram Types.

C# CODE:

...
EA.Diagram diagram = (EA.Diagram)package.Diagrams.AddNew("ExampleDiagram", "Activity");
...

...activity diagram is added immediately, but I still have that error message "Encountered an improper argument"...

neuron

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Add new diagram - Encountered an improper argu
« Reply #3 on: January 14, 2010, 06:15:04 pm »
Have you already tracked down wich statement exactly is giving you the error?

Geert