• 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 3485
  • 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
  • CadAP
    +1 CadAP 11 months ago

    Hi Fseyer,

    Please use below code make sure below is set before sourcing the below code.

    After sourcing the code file Symbol.txt will create at library location.

    set dirName {C:/Users/Downloads/lib_doc} ; # 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:/Users/Downloads/lib_doc}
    # 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

    Hope this helps

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

    Hi CadAP


    Thank you for the reply.
    i'm not sure but i getting a return of can't read "readOlb::dirName": no such variable

    • 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,

    Can you please let me know how you are ruining the above code and also share the screen shot from command promt.?

    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

    i just copied the code and save as "Olb_exportTxt.tcl"
    set dirName to directory to where my .olb files
    then type in capture cmd window > source {C:/SPB_Data/TCL/Olb_exportTxt.tcl}

    • 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,

    Please share the tcl code you are using, My end same code working fine.

    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