Book a Demo

Author Topic: Automatically Create a Legend  (Read 4121 times)

Brian L

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Automatically Create a Legend
« on: November 15, 2013, 05:41:56 am »
Does anyone know the method call to create a legend from script?
There is no mention on how to create one on Sparx's site nor in the ScriptingEA book.

Thank you for your time,
Brian

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Automatically Create a Legend
« Reply #1 on: November 15, 2013, 07:48:12 am »
You need to create a element of type Text. Additionally you need to create an entry in t_xref which is a bit complex. The easiest way: create an empty repository with a single diagram and a single legend. Then go to the query builder and execute
Code: [Select]
SELECT * FROM t_xrefThe XRefID is an arbitrary GUID. Client is the GUID of the Text element. Description is the meat. Good luck :)

q.
« Last Edit: November 15, 2013, 07:49:47 am by qwerty »

Brian L

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Re: Automatically Create a Legend
« Reply #2 on: November 15, 2013, 08:15:58 am »
Ah. So I create it like I would create a Text element, but I need to add an xref with a modified description.  That is a bit of work.

I only need two different types of legends that will be reused based on diagram type.  The easiest way sounds like creating the legends in a 'holding' diagram and pull them by ID when I need them.

Thank you for the help!