procedure(fixm(lib from_lib to_lib) ;_Oct 19 00 sikand 678
let((dbad xim libid x y yim)
libid=ddGetObj(lib)
;; get all the headers
foreach( libcell libid~>cells
foreach(viewcell libcell~>views
x=dbOpenCellView(lib libcell~>name viewcell~>name nil "r" nil)
xim=x~>instHeaders
ddd = xim
dbad=setof(xx xim xx~>libName == from_lib)
when(dbad
y=dbOpenCellView(lib libcell~>name viewcell~>name nil "a" nil)
yim=y~>instHeaders
ydbad=setof(yy yim (yy~>libName==from_lib))
foreach( thing ydbad
if( viewcell~>name == "schematic" then
foreach( inst thing~>instances
schReplaceProperty( list(inst) "libName" to_lib )
)
else
foreach( inst thing~>instances
leReplaceAnyInstMaster(inst to_lib thing~>cellName thing~>viewName)
)
)
) ; ** foreach thing **
dbSave(y)
dbClose(y)
) ; ** when dbad **
) ; ** foreach viewcell **
) ; ** foreach libcell **
) ; ** let **
) ; ** procedure fixm **