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.


Topics - Hurra

Pages: 1 ... 3 4 [5]
61
Hello!

I have an output to show connections to/from the current selected element as follows:

Code: [Select]
package >
HEADING 1 {Pkg.Name}
element >
HEADING 2 {Element.Name}
{Element.Notes}

connector >
source >
element >
{Element.Name}
< element
< source
{Connector.Name}
target >
element >
{Element.Name}
< element
< target
< connector
< element
< package


However, I would like to show it in a table:
SourceConnectionTarget
Source #1Connection #1Target #1




The problem is though that the information is in different section-contents (or whatever it is called, i.e. connector >, source >). I can't get all the information in the table. Is there a way around this?

Second question:
Is there a way to include the shapescript of elements/stereotypes? I found insert image and similar, but since the shapescript is embedded with the element/stereotype I thought it would be easy to show the image/shapescript. I do not find anything. Someone knows something about this?

Cheers!

62
Hello!

Where is my thought process off?

I have an on Diagram-script.

currentDiagram = Repository.GetCurrentDiagram(); (as EA.Diagram)
allObjects = currentDiagram.DiagramObjects; (as EA.Collection)

Code: [Select]
var listOfObjectNames = new Array();
var listOfElementIDs = new Array();
for (var i = 0; i < allObjects.Count; i++)
{
thisObject = allObjects.GetAt(i);
thisElement = Repository.GetElementByID(thisObject.ElementID);
listOfObjectNames.push(thisElement.Name);
listOfElementIDs.push(thisElement.ElementID);

}

allElements = Repository.GetElementSet(listOfElementIDs, 1);
listOfObjectNames.sort();

for (var j = 0; j < allObjects.Count; j++)
{
Session.Output(listOfObjectNames[j]);
allElements.GetByName(listOfObjectNames[j]);
thisObject = thisElement;
// Do stuff
thisObject.left = thisObject.left - 10;
thisObject.Update;
}
currentDiagram.Update;

My problem is the Collection.GetByName. At first I tried it on a collection with DiagramObjects, but I found in the documentation that:
Quote
GetByName(string Name)
Object
Notes: Gets an item in the current collection by name. Supported for Model, Package, Element, Diagram and element TaggedValue collections.
If the collection does not contain any items (or, for the Tagged Value collection, if the collection contains items but the method cannot locate an object with the specified name) the method returns a null value. For other collections, if the method is unable to find an object with the specified name, it raises an exception.
Parameters:
Name: String

Therefore I created a collection with Elements, through allElements = Repository.GetElementSet(listOfElementIDs, 1);. But I get the same error message. The end of this code snippet is kind of pseudo code.

The main problem is that I can't get Collection.GetByName to work.

Help?

63
Hello!

I made a small script to export a diagram as PDF. I know there is a setting in Diagram Properties > Diagram > Page Setup > Advanced > Scaled Printing: Scale to 1 Page which I use for larger diagrams.

I did some googling but didn't found any functions for this in the API. Is there? Or how can I change this setting with script, or make this setting default for a model/project?

Thank you!

64
Automation Interface, Add-Ins and Tools / List Composite Diagrams
« on: June 08, 2017, 11:19:02 pm »
Hello!

I am interested in adding a diagram as list in another diagram for navigation purposes. The default SQL search string is
Code: [Select]
SELECT
t_object.ea_guid AS CLASSGUID,
t_object.Object_Type AS CLASSTYPE,
t_object.Name,
t_object.Status,
t_object.Author,
t_object.Diagram_ID

FROM t_object
INNER JOIN
(t_diagram INNER JOIN t_diagramobjects ON t_diagram.Diagram_ID = t_diagramobjects.Diagram_ID) ON t_object.Object_ID = t_diagramobjects.Object_ID

WHERE t_diagram.ea_guid='{myElementGUID}'

ORDER by t_object.Name

By adding
Code: [Select]
AND NType=8

in the WHERE statement I get a list of all elements in the diagram with composite, or child, diagrams. However, instead of listing the elements I would like to list the diagrams. I have a hard time figuring out the SQL query for this search.

I should find all diagrams which is composite, or child diagrams, to the elements in the current diagram. With JScript and the API I could figure this out, but not with SQL.

Could I get some pointers?

Thank you!

65
Hello!

I would like to have the size of a vertical compartment on the left side fixed.


| xxx| ...............|
| xxx| ...............|
| xxx| ...............|
| xxx| ...............|

Extend the width would be:

| xxx| ..............................|
| xxx| ..............................|
| xxx| ..............................|
| xxx| ..............................|

My shape script today has two rectangles with 10% respectively 90%, this will be extended when the width is extended.

I hope you understand and thanks for your help!

66
Hello!

I have made a simple JScript to add a stereotype to selected elements in the project browser. The problem is that it only adds stereotypes, not remove current stereotype. The applied stereotypes just keeps piling up. How do I remove applied stereotypes?

Thanks!

Robert.

Code: [Select]
!INC Local Scripts.EAConstants-JScript
!INC EAScriptLib.JScript-Dialog


/*
* Project Browser Script main function
*/
function OnProjectBrowserScript()
{
  // Show the script output window
Repository.EnsureOutputVisible( "Script" );

     // Get the type of element selected in the Project Browser
     var selElem as EA.Collection;

     var input=DLGInputBox( 'Enter new stereotype', 'Multi-select element update', '');
     
     selElem = Repository.GetTreeSelectedElements();
     for (i=0; i < selElem.Count; i++) {
var e as EA.Element;
e = selElem.GetAt(i);
e.Stereotype = input;
Session.Output('Element changed: '+e.Name+' changed stereotype to '+e.Stereotype);
e.Update();
e.Refresh();
     }
Session.Output('All selected elements updated.');
}

OnProjectBrowserScript();

67
Bugs and Issues / Inherit background color in MDG Technology
« on: October 25, 2016, 01:01:51 am »
Hello!

I have an MDG technology where I create stereotypes which is a GENERALIZATION of Archimate2::ArchiMate_X and EXTENSION of metaclass x. I want my new stereotypes to inherit properties from Archimate, such as shapes and colors, however the background color will not inherit.

Comments?

Thank you!

68
Automation Interface, Add-Ins and Tools / Add in: get stereotype
« on: September 20, 2016, 04:49:10 pm »
Hello!

A few weeks ago a saw a post on this forum on how it is possible to create a add-in to allow shape scripts such as

Code: [Select]
decoration symbol {
    orientation = "SE";
Image("#STEREOTYPE#.emf",0,0,100,100);
}

However, I didn't know anything about creating add-ins and had to read up on that. Now I can't find the post regarding that add-in. I have searched this forum and googled like crazy...

Can someone help me with this topic or refer me to that forum post?

Thank you,

Robert.

Pages: 1 ... 3 4 [5]