Author Topic: Alternate images  (Read 213 times)

i4mdone

  • EA Novice
  • *
  • Posts: 14
  • Karma: +0/-0
    • View Profile
Alternate images
« on: October 09, 2018, 09:52:02 pm »
Has anybody seen the need/desire to be able to set a default alternate image so that you could then select an option (or something) to switch the entire diagram to the objects alternate images instead of the typical box?

You can set the alternate image individually one by one, but that seems very tedious.  Also that just sets it but doesn't set it as a default for that particular type.

qwerty

  • EA Guru
  • *****
  • Posts: 9675
  • Karma: +176/-150
  • I'm no guru at all
    • View Profile
Re: Alternate images
« Reply #1 on: October 10, 2018, 12:55:48 am »
No, there is no such option. You could well script it to switch alternative images for the current diagram.

q.

Glassboy

  • EA Practitioner
  • ***
  • Posts: 1115
  • Karma: +77/-72
    • View Profile
Re: Alternate images
« Reply #2 on: October 10, 2018, 07:35:31 am »
It's an interesting idea but it would have to be with a known high quality set of images or your diagram would just end up looking like garbage.

steen.jensen@sll.se

  • EA User
  • **
  • Posts: 41
  • Karma: +0/-1
    • View Profile
Re: Alternate images
« Reply #3 on: October 10, 2018, 08:11:33 am »
Anyone knows how to import a batch of  nice symbols for alternate_picture??
I have just dragged a bunch from windows file explorer to an empty diagram, but I dont get the right name for each picture ;(

Glassboy

  • EA Practitioner
  • ***
  • Posts: 1115
  • Karma: +77/-72
    • View Profile
Re: Alternate images
« Reply #4 on: October 10, 2018, 09:25:25 am »
Anyone knows how to import a batch of  nice symbols for alternate_picture??
I have just dragged a bunch from windows file explorer to an empty diagram, but I dont get the right name for each picture ;(

yeah it's a basic feature that has been around for ever http://www.sparxsystems.com/enterprise_architect_user_guide/14.0/guidebooks/tools_ba_image_manager.html

Glassboy

  • EA Practitioner
  • ***
  • Posts: 1115
  • Karma: +77/-72
    • View Profile
Re: Alternate images
« Reply #5 on: October 10, 2018, 09:35:13 am »
I keep meaning to make an image library from the OSA Icon set, but I never quite get the time.

Sunshine

  • EA User
  • **
  • Posts: 682
  • Karma: +46/-3
  • Emoji's make you look younger
    • View Profile
Re: Alternate images
« Reply #6 on: October 10, 2018, 10:05:23 am »
Qwerty is correct you could write a script. Just so happens I did one a while back
The script will probably need some modifications if you want set different images depending on element type.
Code: [Select]
!INC Local Scripts.EAConstants-JScript

/*
  * Script Name: Set Element Alternative Image
 * Description: Sets elements image on a diagram. Need to have images loaded into model.
 * For example images such as these http://www.sparxsystems.com/resources/image_library.html
 */

/*
 * Diagram Script main function
 */
function OnDiagramScript()
{
// Get a reference to the current diagram
var currentDiagram as EA.Diagram;
currentDiagram = Repository.GetCurrentDiagram();

if ( currentDiagram != null )
{
        Session.Output("Diagram Name:" + currentDiagram.Name);
ObjectsInDiagram( "    ", currentDiagram );
Session.Prompt( "The setting to non rectangular is now completed", promptOK)
}
else
{
Session.Prompt( "This script requires a diagram to be open.", promptOK)
}
}


//
// Converts the elements of the provided package to the Script output window
//
// Parameters:
// - indent A string representing the current level of indentation
// - thePackage The package object to be processed
//
function ObjectsInDiagram( indent, theDiagram )
{
    // Cast thePackage to EA.Package so we get intellisense
    var theCurrentDiagram as EA.Diagram;
    theCurrentDiagram = theDiagram;
   
    // Iterate through all elements and add them to the list
    var elementEnumerator = new Enumerator( theCurrentDiagram.DiagramObjects);
    while ( !elementEnumerator.atEnd() )
    {
  var diagramObject as EA.DiagramObject;
        diagramObject = elementEnumerator.item();
        SetObject(indent+"    ",diagramObject );
        elementEnumerator.moveNext();
    }
}

function SetObject(indent, theObject)
{

    var diagramObject as EA.DiagramObject;
    diagramObject = theObject;
// List of ImageID values can be found in table t_image
diagramObject.SetStyleEx("ImageID", "1796848196");
diagramObject.Update();
}

OnDiagramScript();

Sunshine

  • EA User
  • **
  • Posts: 682
  • Karma: +46/-3
  • Emoji's make you look younger
    • View Profile
Re: Alternate images
« Reply #7 on: October 10, 2018, 10:07:32 am »
Anyone knows how to import a batch of  nice symbols for alternate_picture??
I have just dragged a bunch from windows file explorer to an empty diagram, but I dont get the right name for each picture ;(
Have you tried importing the images provided by Sparx Systems
http://www.sparxsystems.com/resources/image_library.html

steen.jensen@sll.se

  • EA User
  • **
  • Posts: 41
  • Karma: +0/-1
    • View Profile
Re: Alternate images
« Reply #8 on: October 14, 2018, 05:34:33 am »

yeah it's a basic feature that has been around for ever http://www.sparxsystems.com/enterprise_architect_user_guide/14.0/guidebooks/tools_ba_image_manager.html

But I want to import say 100 selected images with the file names as the names in Image Manager..
Not Import one images at a time !

Steen

qwerty

  • EA Guru
  • *****
  • Posts: 9675
  • Karma: +176/-150
  • I'm no guru at all
    • View Profile
Re: Alternate images
« Reply #9 on: October 14, 2018, 07:17:35 pm »
I once had a script to do that. The images go to t_image where you store them as blob in the column Image. ImageID is a unique key, Name is the name and Type is set to Bitmap for png/jpg images.

q.