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 - QuimSA

Pages: [1]
1
Oops haha

fixed

2
Thanks geert!

Finished it already, if someone is interested, it looks like this:

Code: [Select]
var theElement as EA.Element; //Inicialization of Enterprise Architect element

function CreateConstraints(interf){//-------------------------------CREATES CONSTRAINTS----------------------------------

newConstraint = interf.Constraints.AddNew("",""); //enter here desired constarint name and type

newConstraint.Update();
newConstraint = null;
Session.Output("Successfully created constraint @: " + interf.Name);
}
function Main(){
theElement = Repository.GetTreeSelectedObject(); //Gets the object selected in project browser
var portCounter = theElement.Elements.Count;
for(j=0;j<portCounter;j++){
if(theElement.Elements.GetAt(j).Stereotype == "AUTOSAR Sender Receiver Port"){
CreateConstraints(theElement.Elements.GetAt(j));
Session.Output("Done");
}
}
}

3
Hi folks

I have to apply the same 2 constraints to a whole collection of interfaces and i'm wondering if there's a way to automatically do so by scripting. I've been searching and i'm not sure it's possible.
I'm thinking it should be possible using the 'Constraint class' method: Update(). But i dont know how

https://sparxsystems.com/enterprise_architect_user_guide/14.0/automation/constraint.html

I appreciate any help!
Thanks

P.D. By the way this is my first post in this forum, hi everyone!!! :D :D

Pages: [1]