Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: Asperamanca on November 07, 2012, 07:18:29 pm
-
I have a script that will recursively perform a "search and replace" for all elements of a package. It currently replaces in names, notes and filenames.
Now I would like to extend the script so it also replaces in attributes and operations of classes. But how do I edit attributes of a class within a script?
The description of the "Attributes" collection in class says it's "Read-only". It also says to "use the AddNew and Delete functions to manage attributes", but that doesn't make much sense on a read-only collection. And I didn't find the corresponding methods on the "class element" level.
Any ideas?
-
The read-only means you can not alter the collection. But you can add/remove contents from the collection via methods of these collections. Well, I'd recommend my Scripting book :-)
q.
-
Thanks! That was a bit misleading.
-
You have to read "Read-only" as in the property Element.Attributes is readonly.
That means you can only Get the property but not Set it.
But yes a bit misleading, it had me too in the beginning ::)
Geert