• 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. TCL script to read OLB library file and generate list of...

Stats

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

TCL script to read OLB library file and generate list of the symbols into text file

fSeyer
fSeyer 11 months ago

Hi 

is it possible to make TCL script that will read each OLB library file and generate a list of the symbols (just the name of symbol) into a text files?

thank you

  • Sign in to reply
  • Cancel
  • fSeyer
    0 fSeyer 11 months ago in reply to CadAP

    Hi CadAP,

    here's the code, not sure if i doing wrong. Thanks

    set dirName {C:/SPB_Data/Capture_Lib} ; # provide your library location.

    set lSession $::DboSession_s_pDboSession
    DboSession -this $lSession
    set lStatus [DboState]
    set lNullObj NULL
    namespace eval readOlb {} {
    # variable dir [file normalize [info script]]
    set dirName {C:/SPB_Data/Capture_Lib}
    # variable dirName [file dirname $dir]
    catch { variable fileData [glob -directory $dirName *.olb] } filereaderror
    }
    set lSymbollist {}
    set lFile [open "$readOlb::dirName/Symbol.txt" a+]
    foreach olb $readOlb::fileData {
    puts $lFile $olb
    set libname [DboTclHelper_sMakeCString $olb]
    set lDboLibrary [DboSession_GetLib $lSession $libname $lStatus]
    set lib1 [$lDboLibrary GetContainingLib]
    set partName [DboTclHelper_sMakeCString ]
    set pkgIter [$lDboLibrary NewPackagesIter $lStatus]
    set pPkg [$pkgIter NextPackage $lStatus]
    set lNullObj NULL
    while {$pPkg!=$lNullObj} {
    $pPkg GetName $partName
    # puts "partName : [DboTclHelper_sGetConstCharPtr $partName]"
    puts $lFile "PartName : [DboTclHelper_sGetConstCharPtr $partName]"
    set pPkg [$pkgIter NextPackage $lStatus]
    }
    # puts $lDboLibrary
    delete_DboLibPackagesIter $pkgIter
    }
    close $lFile
    $lSession RemoveLib $lDboLibrary

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • fSeyer
    0 fSeyer 11 months ago in reply to fSeyer

    Hi CadAP,

    after restarting the capture the code works fine. 
    maybe i just typed the wrong way earlier.
    code gives output i want.
    Thank you the Help!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • CadAP
    0 CadAP 11 months ago in reply to fSeyer

    HI Fseyer,

    I see you have added below variable at two place:

    set dirName {C:/SPB_Data/Capture_Lib} ; # provide your library location. --> Please remove this one, I have added just for your example.

    set dirName {C:/SPB_Data/Capture_Lib} ;#--> This one is correct (defined under namespace.). Do not remove.

     

    Thanks

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • fSeyer
    0 fSeyer 11 months ago in reply to CadAP

    Hi CadAP,

    yes i removed the example variable and restart my capture then it works fine.

    thank you

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • fSeyer
    0 fSeyer 11 months ago in reply to CadAP

    Hi CadAP,

    sorry i got one more thing to ask, how can i run this code standalone?
    without opening the capture, can run directly into windows cmd prompt?
    my main goal is to incorporate with the allegro skill lisp so i was thinking running TCL into batchscript.

    Thanks

    • 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