Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - SvenK

Pages: [1] 2
1
Automation Interface, Add-Ins and Tools / Get DiagramObject objects
« on: May 02, 2013, 07:13:00 pm »
Hello,

I want to set the style of all components in all diagrams automatically using jscript. I created an SQL search and have the Object_IDs of the desired DiagramObjects. However, I couldn't find a function to get the DiagramObject using the ID (something similar to Reposityor.GetElementByID (long ElementID) ).

Do I really have to iterate over each Diagram there iterate over Diagram.DiagramObjects?

Sven

2
Quote
EA will not include the same script twice, so in your example if you include B in a script X, and subsequently A in the same script X, than this second include of A is ignored and the changes made in B will be visible to X.

I wasn't aware of that. So my concerns were if superfluous. Thanks for the clarification.

3
Quote
But what are you trying to achieve by this?

I want to include some files only once.

Assume a script A creates a variable myvariable= new Object().

Another script B adds something to this variable: myvariable.number=10

If at another place script A is again included, myvariable is overwritten...

While writing this, I think I may introduce some kind of include-guard to solve the problem.

4
Hello,

is it possible to include scripts during runtime? In JScript you have to do
Code: [Select]
!INC foo.bar
However, neither of the following works:
Code: [Select]
if (something)
{
  !INC foo.bar
}

Code: [Select]
eval("!INC foo.bar")



5
Automation Interface, Add-Ins and Tools / Set appearance of elements
« on: March 11, 2013, 11:34:56 pm »
Hello,

according to http://www.sparxsystems.com/uml_tool_guide/sdk_for_enterprise_architect/element2.htm , the appearance of an element can be set using SetAppearance (long Scope, long Item, long Value). However, it is not explained how Value should like. How can I set a color (R,G,B) with one integer?

In addition, I'm interested, how Scope=0 (Local) works. How does EA knows for what diagram the specified color should be used?

Thanks in advance
Sven

6
Automation Interface, Add-Ins and Tools / Re: Base64 Encoding in XMI Export
« on: February 14, 2013, 01:21:36 am »
Thanks. That helped. The difference is due to different modify times of the str.dat file archived in the zip.

Now I have to figure out how to avoid changing GUIDs for (default) stereotypes.

7
Automation Interface, Add-Ins and Tools / Base64 Encoding in XMI Export
« on: February 13, 2013, 03:05:04 am »
Hello,

the baseline feature is basically an XMI export of the current model. We use the XMIs to compare different baselines using external tools. However, we faced the problem that Base64 encoded data (e.g. Linked Document) always changes slightly, although no changes where done. It is always the first and the two last lines of the encoded data which changed. Is there some kind of timestamp stored? How can I avoid this?

How is the data stored? I thought it would be plain RTF. However, I can't open a file containing the decoded data.

Another strange behavior I got with the xmi.id of stereotypes. The ID of e.g. stereotype "master document" always changes also when creating a baseline.

Any hints on this?

Sven

8
Thanks!

For the sake of completeness, this is the corresponding JScript code.
Code: [Select]
function getNewGuid()
{
      var typeLib = new ActiveXObject("Scriptlet.TypeLib")
      return typeLib.Guid.slice(0,38) // Last two character are unreadable
}

Here are some interesting details on why using TypeLib:
http://blogs.technet.com/b/heyscriptingguy/archive/2005/02/21/how-can-i-create-a-guid-using-a-script.aspx

Sven

9
Thanks, so it is only a constant (same values in my project file).
With this I figured out that ScriptAuthor references to the Group where a script is stored (weird name).

So the last think I have to figure out is how to get a new GUID to use it as ScriptName if I add a new script.

10
In the table t_script, the following fields are available:
ScriptCategory: Referece to an GUID; only different for Group or script
ScriptName: Unique GUID
ScriptAuthor: GUID of the Author
Notes: Short description of script type in XML
Script: The actual script content

However, in what table can the ScriptCategory be found.
And how to get a GUID when inserting an new script to the t_script table?

Any help would be appreciated.

Sven

11
It was easier to find than expected:
t_script

12
Thanks for the hint.

In what table are the scripts stored? I was thinking of writing a script to import other scripts directly into the database.
It's is quite uncomfortable to be not able to versioning our scripts and to make diffs on changes.

Sven

13
Hello,

as there is no feasible way to automatically import a couple of JScripts into EA, I started to investigate in MDG Technologies to do so.
However, I faced some problems:

I maintain a couple of scripts and stored them in different groups. However, the group information is lost when exporting as MDG. Do I have to maintain all scripts in a flat tree? This becomes very confusing.

It is not possible to edit scripts imported from MDG, which is on one hand obvious. However, how do I develop the scripts? Do I need a "master development project file" where the scripts are stored instead of imported as MDG and only develop functionality within this project?

Can I use variables in the !INC command to switch between script groups?
E.g.
Code: [Select]
var group="MyLocalGroup"
!INC <group>.myscript

Code: [Select]
var group="MyMdgGroup"
!INC <group>.myscript

Do you have a better workflow to develop JScripts and easily distribute/update them?

Sven

14
Automation Interface, Add-Ins and Tools / Re: Deep Delete element
« on: January 09, 2013, 12:54:03 am »
Quote
Btw i made a mistake, you should pass FALSE to EA to prevent deletion. Update the previous post for future reference

What is the reason for passing False?
In
http://www.sparxsystems.com/uml_tool_guide/sdk_for_enterprise_architect/collection.htm
it is written that the Boolean in DeletAt() is unused.

15
Hi Gert,

thanks for the information.
Not the nicest solution but I'm now using Arrays.

Sven

Pages: [1] 2