Book a Demo

Author Topic: Scale and make diagram monochromatic  (Read 4912 times)

Jaroslav

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Scale and make diagram monochromatic
« on: May 31, 2013, 12:55:49 am »
I would like to save diagram as scaled image. I tried this code in my AddIn:

Code: [Select]
private void ProcessDiagram(EA.Diagram diagram) {
    diagram.Scale = 200;
    _project.PutDiagramImageToFile(diagram.DiagramGUID, "temp.png", 1);
    _repository.CloseDiagram(diagram.DiagramID);
}

But it won't work, the diagram is still 1:1. I would like to have larger font in exported diagram.

Also I would like to have exported image grayscaled (it can be achieved in my add-in) or ideally monochromatic (I can do this somehow also in my add-in, but built-in EA feature will be very helpful), is it possible?

I'm using Enterprise Architect 7.1 (our company going to update EA to recent version 10 soon).

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Scale and make diagram monochromatic
« Reply #1 on: May 31, 2013, 03:08:18 am »
I'd guess you need to perform Diagram.Update() after assigning the scale.

q.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Scale and make diagram monochromatic
« Reply #2 on: May 31, 2013, 09:10:59 am »
Images are always saved at 100%. (Except that in Tools | Options | Diagram, there is an option 'Scale Saved Bitmaps to: ... ' But I have no idea if it exists in your version.)

Jaroslav

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Scale and make diagram monochromatic
« Reply #3 on: May 31, 2013, 09:12:24 pm »
Thank you for your replies. I installed EA 10 demoversion and found the "Scale Saved Bitmaps To" option. Also the diagram option "Whiteboard Mode" is exact the feature I need.

Setting "Scale Saved Bitmaps To" is not problem in our development team, it is one setting forever. However, it is not possible to change "Whiteboard Mode" in each digram manually before their export and turn the option back for drawing diagrams (yes, it is possible to draw only in whiteboard mode, but ...).

My question is, how to programmatically change diagram mode to "whiteboard" and back? I cannot find any appropriate method in automation interface.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Scale and make diagram monochromatic
« Reply #4 on: June 01, 2013, 12:36:32 am »
You need to modify/add in StyleEx:
Code: [Select]
Whiteboard=1;
Remove or set to =0 for using the normal display mode.

I'll have to divide these options in my Inside book for the next release...

q.
« Last Edit: June 01, 2013, 12:39:00 am by qwerty »

Jaroslav

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Scale and make diagram monochromatic
« Reply #5 on: June 11, 2013, 10:03:00 pm »
Thank you for your help. This is my final solution of exporting colorless diagrams in higher resolution:

1) Set up the option Tools / Options ... / Diagram / Scale Saved Bitmaps to 200%.

2) The C# code is:
 
Code: [Select]
string originalStyle = diagram.StyleEx;
diagram.StyleEx = MyUpdateValueInCommaSeparatedArrayFunction(diagram.StyleEx, "Whiteboard", "1");
diagram.Update();

project.PutDiagramImageToFile(diagram.DiagramGUID, imagePath, 1);
repository.CloseDiagram(diagram.DiagramID);

diagram.StyleEx = originalStyle;
diagram.Update();

[/list]