1
Automation Interface, Add-Ins and Tools / Re: Creating new constraints in a collection
« on: June 26, 2019, 11:09:49 pm »
Oops haha
fixed
fixed
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.
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");
}
}
}