1
General Board / Re: Swimlanes
« on: September 01, 2011, 12:54:27 am »
I have created a script to create automatically some swimlanes on a diagram. But you have to open the swimlines dialog to reflect the changes.
option explicit
!INC Local Scripts.EAConstants-VBScript
'
' This code has been included from the default Diagram Script template.
' If you wish to modify this template, it is located in the Config\Script Templates
' directory of your EA install path.
'
' Script Name: Create swimlanes for Model Driven RE
' Author: Sven Stefan Krauss
' Curtiss-Wright Antriebstechnik GmbH
' Purpose: Creat swimlines on a diagram
' Date: 01.07.2011
'
' Current issue:
' You have to open the swimlines dialog to show the results.
' Any ideas?
'
' Diagram Script main function
'
sub OnDiagramScript()
' Get a reference to the current diagram
dim currentDiagram as EA.Diagram
set currentDiagram = Repository.GetCurrentDiagram()
if not currentDiagram is nothing then
' Get a reference to any selected connector/objects
dim selectedConnector as EA.Connector
dim selectedObjects as EA.Collection
set selectedConnector = currentDiagram.SelectedConnector
set selectedObjects = currentDiagram.SelectedObjects
Repository.EnsureOutputVisible("Script")
Repository.ClearOutput("Script")
Session.Output currentDiagram.Name
Session.Output "Creating Swimlane: Customer Requirements..."
currentDiagram.SwimlaneDef.Swimlanes.Add "Customer Requirements",200
Session.Output "Creating Swimlane: Components..."
currentDiagram.SwimlaneDef.Swimlanes.Add "Components",100
Session.Output "Creating Swimlane: Design Concept..."
currentDiagram.SwimlaneDef.Swimlanes.Add "Design Concept",100
Session.Output "Creating Swimlane: Verfication..."
currentDiagram.SwimlaneDef.Swimlanes.Add "Verfication",100
Session.Output "Creating Swimlane: Child Requirements..."
currentDiagram.SwimlaneDef.Swimlanes.Add "Child Requirements",100
currentDiagram.Update()
if not selectedConnector is nothing then
' A connector is selected
elseif not selectedObjects.Count > 0 then
' One or more diagram objects are selected
else
' Nothing is selected
end if
else
Session.Prompt "This script requires a diagram to be visible", promptOK
end if
end sub
OnDiagramScript
option explicit
!INC Local Scripts.EAConstants-VBScript
'
' This code has been included from the default Diagram Script template.
' If you wish to modify this template, it is located in the Config\Script Templates
' directory of your EA install path.
'
' Script Name: Create swimlanes for Model Driven RE
' Author: Sven Stefan Krauss
' Curtiss-Wright Antriebstechnik GmbH
' Purpose: Creat swimlines on a diagram
' Date: 01.07.2011
'
' Current issue:
' You have to open the swimlines dialog to show the results.
' Any ideas?
'
' Diagram Script main function
'
sub OnDiagramScript()
' Get a reference to the current diagram
dim currentDiagram as EA.Diagram
set currentDiagram = Repository.GetCurrentDiagram()
if not currentDiagram is nothing then
' Get a reference to any selected connector/objects
dim selectedConnector as EA.Connector
dim selectedObjects as EA.Collection
set selectedConnector = currentDiagram.SelectedConnector
set selectedObjects = currentDiagram.SelectedObjects
Repository.EnsureOutputVisible("Script")
Repository.ClearOutput("Script")
Session.Output currentDiagram.Name
Session.Output "Creating Swimlane: Customer Requirements..."
currentDiagram.SwimlaneDef.Swimlanes.Add "Customer Requirements",200
Session.Output "Creating Swimlane: Components..."
currentDiagram.SwimlaneDef.Swimlanes.Add "Components",100
Session.Output "Creating Swimlane: Design Concept..."
currentDiagram.SwimlaneDef.Swimlanes.Add "Design Concept",100
Session.Output "Creating Swimlane: Verfication..."
currentDiagram.SwimlaneDef.Swimlanes.Add "Verfication",100
Session.Output "Creating Swimlane: Child Requirements..."
currentDiagram.SwimlaneDef.Swimlanes.Add "Child Requirements",100
currentDiagram.Update()
if not selectedConnector is nothing then
' A connector is selected
elseif not selectedObjects.Count > 0 then
' One or more diagram objects are selected
else
' Nothing is selected
end if
else
Session.Prompt "This script requires a diagram to be visible", promptOK
end if
end sub
OnDiagramScript