• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Allegro X Scripting - TCL
  3. How to use ReplaceCache ?

Stats

  • State Verified Answer
  • Replies 6
  • Subscribers 12
  • Views 2228
  • Members are here 0
More Content

How to use ReplaceCache ?

BT202504251050
BT202504251050 4 months ago

I am working on a Tcl script to automate the process of replacing a .OLB file via File Explorer → Design Cache → Replace Cache.

proc read_ini : Utlize to fetch the .olb path at Capture.ini [ Capture.ini => Part Library Directories => Dir0 ]

proc showCacheEntries:Change Part Library path

My question is why the ReplaceCache has no effect? [ Version : 17.2.0]

ReplaceCache(OldPackageOrSymbolName, OldLibName, NewName, NewLibName, bUpdateCache = 0, bPreserverefDes = 0)


proc showCacheEntries { pDesign } {
set lCacheNameCStr [DboTclHelper_sMakeCString]
set lCacheLibNameCStr [DboTclHelper_sMakeCString]
set lStatus [DboState]
set lCacheObjectsIter [$pDesign NewCachesIter $lStatus $::IterDefs_ALL]
set lCachedObject [$lCacheObjectsIter NextCachedObject $lStatus]

# ==================================
# Get Capture.ini to fetch location
# ==================================
set root [pwd]
set input [GetProductVersion]
if {[regexp {(\d+\.\d+)-\d+} $input match version]} {
puts "Version: $version"
} else {
puts "Version not found."
}
set lLibLocation [read_ini "$root/cdssetup/OrCAD_Capture/${version}.0/capture.ini" "Part Library Directories" "Dir0"]
set lLibLocation [string toupper $lLibLocation]
puts $lLibLocation

while { $lCachedObject!= "NULL" } {
set lCachedLibObject [DboBaseObjectToDboLibObject $lCachedObject]
$lCachedObject GetName $lCacheNameCStr
$pDesign GetSourceLibName $lCacheNameCStr $lCachedLibObject $lCacheLibNameCStr

# ==============================
# Get Design Cache Library Name
# ==============================
set lKey [DboTclHelper_sGetConstCharPtr $lCacheNameCStr]
set lLibrary [DboTclHelper_sGetConstCharPtr $lCacheLibNameCStr]
set lPartNameCStr [DboTclHelper_sMakeCString $lKey]
regexp {[^\\]+$} $lLibrary match
regexp {[^.]+$} $match extension

set NewLibrary "$lLibLocation$match"
set lNewLibNameCStr [DboTclHelper_sMakeCString $NewLibrary]

# ==============================
# Update Library Location
# ==============================

if {$extension == "OLB" && $lLibrary != $NewLibrary} {
puts "### UPDATE ### $lKey : $lLibrary -> $NewLibrary"
# ReplaceCache(OldPackageOrSymbolName, OldLibName, NewName, NewLibName, bUpdateCache = 0, bPreserverefDes = 0)
$pDesign ReplaceCache $lPartNameCStr $lCacheLibNameCStr $lPartNameCStr $lNewLibNameCStr 1 0
}
set lCachedObject [$lCacheObjectsIter NextCachedObject $lStatus]
}
delete_DboDesignCachesIter $lCacheObjectsIter
$lStatus -delete
}

  • Cancel
  • Sign in to reply
  • BT202504251050
    0 BT202504251050 3 months ago in reply to CadAP

    Cheer!! It seems work well. 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
<
Cadence Guidelines

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information