A set of selected pin labels are put into a list by doing :-
=> ("A<0>" "A<1>" "A<2>")
Another array after some operation increments the set of these pin labels by 3, i.e. :-
a = ("A<3>" "A<4>" "A<5>")
If one wants to sequentially substitute every element of array 'a' into the cv~>theLabel array ( in order to change the pin labels in the layout view also ) then how to proceed ?
I tried the following things which arent working :-1.A simple assignment operator
2. foreach mapcar
There is though one important finding which shows that when one label is selected, then even a simple assignment operator works i.e.
cv~>theLabel => ("A<0>")
a => ("A<4>")
cv~>theLabel => ("A<4>")
but the challenge remains when multiple pin labels are selected
You have a list of objects which must be processed separately. If you have the text selected, you get all the selected objects using txtObjs = geGetSelectedSet()
Then process the individual objects in a foreach loop:
foreach( obj txtObjs when(obj~>objType == "label" obj~>theLabel = newLabel ))
In reply to theopaone:
Thanks for the help but when I tried ur following code, in that every label in the txtObjs array becomes equal to the newLabel.
I tried this :-
A set of pins were selected => A<0> A<1> A<2>
After which I wrote the following code
txtObjs = geGetSelectedSet() => (" a set of cv numbers")
when(obj~>objType == "label" obj~>theLabel = newLabel )) => ("newLabel" "newLabel" "newLabel")
What I want to do is that every element of the cv~theLabel array ( i.e. ("A<0>" "A<1>" "A<2>" "nil") ) should be mapped with the element of an array ' a ' ( i.e. ("A<3>" "A<4>" "A<5>" "nil") ) such that finally the cv~theLabel array becomes equal to ( ("A<3>" "A<4>" "A<5>" "nil") and the pin labels in the layout window changes accordingly.
In reply to shazzy:
You supply the algorithm to map the original name to the new name and puts the new value into the variable newLabel inside the loop.
foreach((obj labelVal) txtObjs a when(obj~>objType=="label" obj~>theLabel=labelVal ))
This assumes that txtObjs has the same number of entries as the list in variable a. By making the first argument to foreach a list of two variables, it will process both lists in parallel.
Note: A bit of terminology here - "cv" normally means "cellView" and so it's rather confusing to call a list of objects "cv". These are lists not arrays (arrays are normally random access whereas lists are sequential).