• 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 Capture CIS
  3. How can I use a tcl script to update the modified information...

Stats

  • State Verified Answer
  • Replies 6
  • Subscribers 43
  • Views 1864
  • Members are here 0
More Content

How can I use a tcl script to update the modified information from library to Design Cache which is in .DSN project?

Morgan
Morgan 6 months ago

Hi Community,

If I have modified the part name and footprint in the library, for example, the part name has been changed from MAX3232EIDR to MAX3232EIPWRG4, and the footprint has been changed from SOIC16 to TSSOP16, how can I use a tcl script to update them from library to Design Cache which is in .DSN project? (with Cadence Capture CIS)

#

#

The following tcl script is Get Part Value from schematic and Get  SourcePackage  Name from Design Cache.

#

#

#Get Part Value from schematic

set lPartValueNameStr [DboTclHelper_sMakeCString]

$pPlacedInst GetPartValue $lPartValueNameStr

set lPartValueName [DboTclHelper_sGetConstCharPtr $lPartValueNameStr]

puts "lPartValueName : $lPartValueName"

#

#

#Get  SourcePackage  Name from Design Cache

set lCachedPartValueNameStr [DboTclHelper_sMakeCString]

$pPlacedInst GetSourcePackageName $lCachedPartValueNameStr

set lCachedPartValueName [DboTclHelper_sGetConstCharPtr $lCachedPartValueNameStr]

puts "lCachedPartValueName : $lCachedPartValueName"

#

#

Regards,

Morgan Brown

  • Sign in to reply
  • Cancel
  • CadAP
    0 CadAP 6 months ago

    Morgan 

    Below proc will help to get the cached lib property.

    You can filter out the part from updated library based on attribute match from the part present in cached lib and then use below API to replace cache:

    ReplaceCache(OldPackageOrSymbolName, OldLibName, NewName, NewLibName,
    Class : DboLib(DboBaseObject):
    bUpdateCache = 0, bPreserverefDes = 0) : returns DboState
    Class : DboLib(DboBaseObject):
    Parameters:
    OldPackageOrSymbolName: CString
    OldLibName: CString
    NewName: CString
    NewLibName: CString
    bUpdateCache: int
    bPreserverefDes: int

    proc showCacheEntries { pDesign } {
    set lPrpName [DboTclHelper_sMakeCString]
    set lPrpValue [DboTclHelper_sMakeCString]
    set lPrpType [DboTclHelper_sMakeDboValueType]
    set lEditable [DboTclHelper_sMakeInt]
    set cptr DboTclHelper_sGetConstCharPtr
    set lCacheNameCStr [DboTclHelper_sMakeCString]
    set lCacheLibNameCStr [DboTclHelper_sMakeCString]
    set lCachePropNameCStr [DboTclHelper_sMakeCString "Source Package"]
    set lCacheValNameCStr [DboTclHelper_sMakeCString]
    set lStatus [DboState]
    set lCacheObjectsIter [$pDesign NewCachesIter $lStatus $::IterDefs_ALL]
    set lCachedObject [$lCacheObjectsIter NextCachedObject $lStatus]
    while { $lCachedObject!= "NULL" } {
    set lCachedLibObject [DboBaseObjectToDboLibObject $lCachedObject]

    set lPropsIter [$lCachedLibObject NewEffectivePropsIter $lStatus]
    set lStatus [$lPropsIter NextEffectiveProp $lPrpName $lPrpValue $lPrpType $lEditable]
    while {[$lStatus OK] == 1} {
    if {[$cptr $lPrpName] != ""} {

    puts "\tName=[$cptr $lPrpName] Value= [$cptr $lPrpValue] "
    }
    set lStatus [$lPropsIter NextEffectiveProp $lPrpName $lPrpValue $lPrpType $lEditable]
    }
    delete_DboEffectivePropsIter $lPropsIter
    # $lStatus -delete
    # puts "Value: = [DboTclHelper_sGetConstCharPtr $lCacheValNameCStr]"
    # $lCachedObject GetName $lCacheNameCStr
    # $pDesign GetSourceLibName $lCacheNameCStr $lCachedLibObject $lCacheLibNameCStr

    # puts -nonewline "[DboTclHelper_sGetConstCharPtr $lCacheNameCStr] : "

    set lCachedObject [$lCacheObjectsIter NextCachedObject $lStatus]
    }
    delete_DboDesignCachesIter $lCacheObjectsIter
    $lStatus -delete
    }

    Hope it helps.

    Do let me know if you require any help.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Reject Answer
    • Cancel
  • Morgan
    0 Morgan 6 months ago in reply to CadAP

    Hi CadAP,

    • Thanks for the code, but I'm not very familiar with the syntax of tcl database command, can you tell me how to use ReplaceCache and showCacheEntries?help me please!

    • Also, can you provide some details about the Capture Database TCL Command, especially those classes and commands? I found the OrCAD_Capture_TclTk_Extensions_Revision1.2 file, but it is too crude, and there is no description of the proc parameters in Appendix A, Appendix B, and Appendix C.
    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • CadAP
    +1 CadAP 6 months ago in reply to Morgan

    HI Morgan,

    Procedure (prco) share in the above is used to get all the properties of cached part. You can take on which common property you need to check in the library which you used to replace cache par.

    Please check the page no-23 OrCAD_Capture_TclTk_Extensions_Revision1.2, you will get the library hierarchy as well as design hierarchy.

    For more information on library and design hierarchy, please refer to page 23 of the OrCAD Capture Tcl/Tk Extensions Revision 1.2 document. This document provides details on how to access different classes and use their APIs to retrieve specific information.

    For example: 

    set lCacheObjectsIter [$pDesign NewCachesIter $lStatus $::IterDefs_ALL]  --> It returns DboLibCachesIter , Now in pdf I will search for class DboLibCachesIter .

    I captured few api under that class from the pdf.

    START class DboLibCachesIter(TBaseDboLibChangedObjectsIter):


    NextCachedObject(status) : returns DboBaseObject


    Class : DboLibCachesIter(TBaseDboLibChangedObjectsIter):

    Now I will use api NextCachedObjectto get the cached object like below:

    set lCachedObject [$lCacheObjectsIter NextCachedObject $lStatus] --> returns DboBaseObject, now i'll find api under DboBaseObject and use those.

    By following this process, you can navigate through the class hierarchy and use the available APIs to retrieve the desired information.

    Please check the below article how cached parts are replaced from a library.

    Article (20512519) Title: How to update the design cache library path to a new library path
    URL: https://support.cadence.com/apex/ArticleAttachmentPortal?id=a1O3w000009mMUXEA2

    Hope this is helpful for you.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Reject Answer
    • Cancel
  • Morgan
    0 Morgan 6 months ago in reply to CadAP

    Hi CadAP,

    Can you help me, Copy the content of the article and put it here? Thank you very much.

    Article (20512519) Title: How to update the design cache library path to a new library path
    URL: https://support.cadence.com/apex/ArticleAttachmentPortal?id=a1O3w000009mMUXEA2

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • CadAP
    0 CadAP 6 months ago in reply to Morgan

    Morgan 

    Find the code below:

    Please update the variable `lNewLibpath` to point to the specific directory where your `.olb` files are located, replacing the current value with your desired file path."

    #Replace Cache object from a new library path


    namespace eval readOlb {} {
    # variable dir [file normalize [info script]]
    set lNewLibpath {C:\Cadence\SPB_23.1\tools\capture\library}
    regsub -all {\\} $lNewLibpath {/} dirName
    # variable dirName [file dirname $dir]
    catch { variable fileData [glob -directory $dirName *.olb] } filereaderror
    }


    proc readOlb::updateAllCacheParts {} {
    set lSession $::DboSession_s_pDboSession
    DboSession -this $lSession
    set lStatus [DboState]
    set lNullObj NULL
    set lDesign [$lSession GetActiveDesign]
    set lNameCString [DboTclHelper_sMakeCString]
    set lSrcLibPathCS [DboTclHelper_sMakeCString]
    set lDesignCacheIter [$lDesign NewCachesIter $lStatus]
    set lCachedObject [$lDesignCacheIter NextCachedObject $lStatus]
    set lPartName [DboTclHelper_sMakeCString]
    set updatedPartList {}
    set counter 0
    # set lContLib [$lCachedLibObject GetContainingLib]
    # # set llibname [$lSession GetLib $lContLib $lStatus ]
    while {$lCachedObject != $lNullObj} {

    set lCachedLibObject [DboBaseObjectToDboLibObject $lCachedObject]
    set lContLib [$lCachedLibObject GetContainingLib]
    $lContLib GetName $lPartName
    $lCachedLibObject GetSourceLibName $lSrcLibPathCS
    # $lCachedObject GetPathName $lPartName "/"
    set obj [$lCachedObject GetName $lNameCString]
    set lGetPartName [DboTclHelper_sGetConstCharPtr $lNameCString]
    # set lGetPartName [DboTclHelper_sGetConstCharPtr $lNameCString]
    # puts [DboTclHelper_sGetConstCharPtr $lPartName]
    set srcLibPath [file normalize [DboTclHelper_sGetConstCharPtr $lSrcLibPathCS] ]
    # puts [file normalize $srcLibPath]
    # puts $lGetPartName
    foreach libPath $readOlb::fileData {

    # puts $libPath
    set lNewLibPath [DboTclHelper_sMakeCString $libPath]
    set lDboLibrary [DboSession_GetLib $lSession $lNewLibPath $lStatus]
    # puts $lNewLibPath
    # puts $lDboLibrary
    lappend libpathlist $lDboLibrary
    if {$lDboLibrary != $lNullObj || $srcLibPath != $lNullObj} {

    set lIsPackageExits [$lDboLibrary PackageExists $lNameCString $lStatus]
    # puts $lIsPackageExits
    if {$lIsPackageExits == 1 && [lsearch $updatedPartList $lGetPartName] < 0 && $srcLibPath != $libPath } {
    # puts $srcLibPath
    # puts $libPath
    # puts $lGetPartName
    $lContLib ReplaceCache $lNameCString $lSrcLibPathCS $lNameCString $lNewLibPath
    lappend updatedPartList "CachePartName:== $lGetPartName Cache_NewLocation:= $libPath"
    $lContLib MarkModified
    $lSession MarkAllLibForSave $lContLib
    $lSession SaveLib $lContLib

    incr counter
    }
    }
    $lSession RemoveLib $lDboLibrary
    }
    set lCachedObject [$lDesignCacheIter NextCachedObject $lStatus]
    }

    delete_DboDesignCachesIter $lDesignCacheIter

    set lDesignPath [DboTclHelper_sMakeCString]
    $lDesign GetName $lDesignPath
    set lDesignNameindex [string last "\\" [DboTclHelper_sGetConstCharPtr $lDesignPath]]
    set lDesignName [string range [DboTclHelper_sGetConstCharPtr $lDesignPath] [expr {$lDesignNameindex +1}] end]
    # puts $lDesignName
    if {$counter > 0} {
    puts "++++++++=========Saving the Design===========+++++++++++"
    catch {SelectPMItem "./$lDesignName"}
    catch {Menu "File::Save"}
    ClearSessionLog
    DboState_WriteToSessionLog "[DboTclHelper_sMakeCString "Below Cache Parts have been updated:"]"
    capDisplayMessageBox "Successfuly updated the Cache Library Location.Check Session Log For Informations" "INFORMATION!"
    puts $updatedPartList
    }

    foreach part $updatedPartList {
    # puts $part
    if {$counter > 0} {


    DboState_WriteToSessionLog "[DboTclHelper_sMakeCString "$part"]"
    set updatedPartList {}
    }
    }

    }
    readOlb::updateAllCacheParts

    • 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