i need the code to change the metal layers in layout, EX: when the code is loaded all the M1 layers in layout should be replaced by M2 automatically. iam able to do till gettin the available layers..but iam not able to replace them
Since you managed to get the layer. it will be easy for you to replace the metal layers.
Example of changing a selected shapes from M1 to M2 on current cell view:
selected_obj = geGetSelectedSet()
foreach( obj selected_obj
when( obj_id~>layerName == "M1"
obj_id~>lpp = list("M2" "drawing")
This is just an example to show you a simple way in changing the layer. You may write a routine for this. Happy coding.
if you want to replace all the M1 layers in the current cellview (Selected or unselected) then do this.
when( geGetEditCellView()->mode == "r" println( "Need write access" ) return() );when
foreach( shape geGetEditCellView()->shapes
when( shape->layerName == "M1" ; or shape->lpp == list( "M1" "drawing" )
shape->lpp = list( "M2" "drawing" ) ; or shape->layerName = "M2"
In reply to babji:
In reply to Andrew Beckett:
How about if we want to change all M1 shapes (Selected or not, level 0) can we do this.
setof( X geGetEditCellView( )~>shapes X~>lpp == list( "M1" "drawing" ) )~>lpp = list( "M2" "drawing" )
You could, though it would be more efficient to find the matching lpp object first and then find its shapes, then iterate over those shapes to change the layer and purpose. I don't have an example to hand, but it would be something like the following:
m1lpp = car(setof(lpp geGetEditCellView()~>lpps lpp~>layerName=="M1" && lpp~>purpose=="drawing"))
foreach(shape m1lpp~>shapes shape~>lpp=list("M2" "drawing"))
Typically the number of shapes to process is an order of magnitude or more greater than the number of distinct layer-purpose pairs, hence the probable efficiency gain. YMMV depending on the design of course.
In reply to skillUser:
I should point out that Andrew's response is even more efficient since my example shows the use of foreach to iterate over the shapes to change their lpp, where really you can have a list on the left-hand side of the = when using the ~> operator and update the lpp for all items in the list in one hit (as babji also showed in their post).
In reply to Rahul Biradar:
It is just another big loop.
You need a list: processed cellViews
Start of processing loop:
Change layers in the current cellView.
Save the cellView
Add its name to the list of processed cellViews.
You have to find all the instance masters in the current cellView (cvId~>instHeaders~>master)
Close the cellView (this minimizes the number of open cellViews)
for each master not in the list of processed cellViews
Open the master for append
Do the processing loop in the master
Keep processing the masters till all are done
End of processing loop
From an architecture standpoint, the loop should be in a function and called recursively.
In reply to theopaone:
Or you could just use leReplace().
You can use leSearchHierarchy to find the objects and leReplace to update the layer.
Andrew may have some hierarchy parsing code which he shares.
Some untested code showing the idea of a recursive layer replacement rather than leReplace:
procedure(CCFreplaceLayersHier(cv @optional (done makeTable('visited nil))) let((LP) done[cv]=t LP=car(exists(lpp cv~>lpps lpp~>layerName=="M1" && lpp~>purpose=="drawing")) ; if there are shapes, and this isn't a pcell submaster, and it can be reopened in edit mode when(LP~>shapes && !(cv~>superMaster) && dbReopen(cv "a") LP~>shapes~>lpp=list("M2" "drawing") ) ; recursively visit all the child masters foreach(master cv~>instanceMasters unless(done[master] CCFreplaceLayersHier(master done) ) ) t ))
Thank you for your replies
hi Andrew Beckett
the below code is not working but it's executing...... please help me with this
I just tried the code above, and it worked for me. I have a technology where the layers are called M1, M2 etc - you'd obviously have to change the layer names in the code if they're called something different.
Then I opened the top level layout, and used:
Note however that the code won't replace M1 used in MPP (multi-part path) or in vias, or inside PCells. Of course, I have no idea what the extent of what you're trying to do is...