Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: Cisore on June 06, 2012, 12:09:42 am
-
Hello,
I don't arrived to add one package in diagram component with VBScript.
I arrived with a class. I have copy the code for the package but it's doesn't work !
set digramHautNivo = newModel.Diagrams.AddNew( "hautNiveau", "Component" )
digramHautNivo.Update()
dim diagramObjects as EA.Collection
set diagramObjects = digramHautNivo.DiagramObjects
dim packActivityDiagOb as EA.DiagramObject
set packActivityDiagOb = diagramObjects.AddNew( "", "" )
packActivityDiagOb.ElementID( PRow.PackageID )
packActivityDiagOb.Update()
I have try the line "set packActivityDiagOb = diagramObjects.AddNew( "", "" )" with arguments :
"" , "Package"
"l=200;r=400;t=200;b=600;" , ""
"l=200;r=400;t=200;b=600;" , "Package"
"" , ""
I have replace the line "packActivityDiagOb.ElementID( PRow.PackageID )" with :
packActivityDiagOb.ElementID( newPack.PackageID )
packActivityDiagOb.InstanceID(newPack.PackageID)
packActivityDiagOb.DiagramID(newPack.PackageID)
But no work.
Please help me :'(
-
In order to place a package you need to use the package's element, not the package. Get Package.Element and use the ElementID therein.
q.
P.S. I'm currently writing a book about EA scripting. It will take a couple of days until I'll publish the first version. But maybe it's soon enough to get you some more help.
-
It's work :D Thanks.
P.S. I'm currently writing a book about EA scripting. It will take a couple of days until I'll publish the first version. But maybe it's soon enough to get you some more help.
I'm very interesting, I will be glad if you tell me the progress of you work.
(And if I can help you do not hesitate ... but I think not)
-
Again two questions :-[ :
-Do you know how can I link two DiagramObjects ? I don't arrived with Connector !
-How can I change the effect of one Action (for Activity diagram) with a script ?
-
I can answer only the first question: you need to create an object in DiagramLinks.
q.
-
I can answer only the first question: you need to create an object in DiagramLinks.
q.
What is the difference bewteen DiagramLinks and Connector ?
Because it's possible to do the same work with :
dim connector as EA.Connector
set connector = diagram.Connectors.AddNew("","Import")
connector.ClientID FirstElement.ElementID
connector.SupplierID SecondeElement.ElementID
connector.Update()
-
Connector is the real connector. DiagramLinks is an instance used in a diagram (you can use it on multiple diagrams with different representations). Same applies for DiagramObjects.
q.
-
-How can I change the effect of one Action (for Activity diagram) with a script ?
I arrived to change action's effect BUT when I change for one action, the effect of all other exiting action are changed too.
Do you have any idea ?
the code :
dim p as EA._CustomProperty
for each p in elm.CustomProperties
if(p.Name="effect") then
p.Value="new effect"
end if
next