I waswriting a simple script to delete all attributes with „pro_id” substringinside. I wrote a script, tried it, found a mistake, tried to run this onceagain and got very interesting message.
My scriptand message are shown in attachment.
Note: project names have been obscured for purpose.
function main(){
var i,j;
var Ent;
var Attr;
for (i=0; i<MyModel.Entities.Count; i++)
{
Ent = MyModel.Entities.GetObject(i);
for (j=0; j<Ent.Attributes.Count; j++)
{
Attr = Ent.Attributes.GetObject(j);
if (Attr.Name.indexOf(‘pro_id’) != -1)
{
Ent.Attributes.delete(j);
}
}
}
}
You can’t just delete an Attribute from an Entity Attributes list with
Ent.Attributes.delete(j);
Even if you succeed, your model will be corrupted. You must call the Delete method of the Attribute:
if (Attr.Name.indexOf(‘pro_id’) != -1) Attr.Delete();
But thanks for bringing up an issue with scripting, looks like an internal bug…