• 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 properly move a part between OLBs with TCL?

Stats

  • State Verified Answer
  • Replies 11
  • Subscribers 14
  • Views 3388
  • Members are here 0
More Content

How to properly move a part between OLBs with TCL?

andakConsultingLtd
andakConsultingLtd 4 months ago

I am trying to clean up some old libraries i.e. move unused parts from active.olb to unused.olb. The code is presented below. Everything works pretty well except that there is something hanging inside active.olb that prevents creating a part that was there before. E.g. if PART_123 was moved from active olb to unused.olb, I can not create PART_123 again. If I look inside active.olb file, PART_123 is still mentioned, despite not being shown in the lib tree structure. I guess I am missing some cleanup in my code, but I can't figure what exactly, so I am asking for your help.

set lSession [DboTclHelper_sCreateSession]
set lStatus [DboState]
set lNullObj NULL

#Provide the location of olb FROM which package should be copied.
set lSourceLibPath [file normalize {D:\ACTIVE.OLB}]
set lSourceLibPathCstring [DboTclHelper_sMakeCString $lSourceLibPath]
set lSourceLib [$lSession GetLib $lSourceLibPathCstring $lStatus]

#Provide the location of olb TO which package should be copied.
set lDestnLibPath [file normalize {D:\UNUSED.OLB}]
set lDsctnLibPathCstring [DboTclHelper_sMakeCString $lDestnLibPath]
set lDestnLib [$lSession GetLib $lDsctnLibPathCstring $lStatus]

#parse all packages in the olb
set pkgIter [$lSourceLib NewPackagesIter $lStatus]
set pPkg [$pkgIter NextPackage $lStatus]

while {$pPkg!=$lNullObj} {
    set pActualPkgName [DboTclHelper_sMakeCString]
    $pPkg GetName $pActualPkgName
    $lDestnLib CopyPackageAll $pPkg $pActualPkgName $lStatus
    $lSourceLib DeletePackage $pPkg

    puts [DboTclHelper_sGetConstCharPtr $pActualPkgName]
    set pPkg [$pkgIter NextPackage $lStatus]
}

$lDestnLib MarkModified
$lSourceLib MarkModified

$lSession MarkAllLibForSave $lDestnLib
$lSession SaveLib $lDestnLib
$lSession RemoveLib $lDestnLib

$lSession MarkAllLibForSave $lSourceLib
$lSession SaveLib $lSourceLib
$lSession RemoveLib $lSourceLib

DboTclHelper_sDeleteSession $lSession

  • Cancel
  • Sign in to reply
Parents
  • CadAP
    0 CadAP 4 months ago

     andakConsultingLtd 

    Please use below article available on ASK portal.

    Article (20508160)
    Title: How to copy symbols or packages from one library (.olb) to another using Tcl script in OrCAD Capture
    URL: https://support.cadence.com/apex/ArticleAttachmentPortal?id=a1O3w000009lgEWEAY&pageName=ArticleContent

    Hope it helps.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • KD202502275710
    0 KD202502275710 4 months ago in reply to CadAP

    This is helpful CadAP

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • KD202502275710
    0 KD202502275710 4 months ago in reply to CadAP

    This is helpful CadAP

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
No Data
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