• 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 change part properties in a library using tcl...

Stats

  • State Suggested Answer
  • Replies 4
  • Answers 1
  • Subscribers 49
  • Views 837
  • Members are here 0
More Content

How can I change part properties in a library using tcl commands?

RT202604073158
RT202604073158 2 months ago

I am trying to automate a conversion of a long list of passive part numbers into parts in a library. I am already able to take a part that has appropriate symbol and set of properties and copy it into the library. I need to, for example, take a copied-in template of a 100 Ohm resistor and update the part number, value, footprint, etc. in the library permanently to make a similar 1 kOhm resistor. I just can't seem to figure out exactly how to access the properties and change them.

  • Cancel
  • Sign in to reply
Parents
  • TechnoBobby
    0 TechnoBobby 2 months ago

    Hi RT202604073158 ,

    When updating properties at library level, it’s important to use the correct object type based on the property being modified.
    Package level properties (for example, PCB Footprint) must be updated using the DboPackage APIs, while part level properties (such as Value) should be updated using DboLibPart APIs.

    Below is a sample script demonstrating this. You can modify it further based on your specific requirements.

    Hope it helps!

    proc UpdatePassivePartAndPackage {libName partName newValue newPartNumber pkgName newPCBFootprint} {

    set NullObj NULL
    set lStatus [DboState]

    set lSession $::DboSession_s_pDboSession
    DboSession -this $lSession

    # Open library
    set libCStr [DboTclHelper_sMakeCString $libName]
    set lLib [$lSession GetOpenLib $libCStr $lStatus]

    if {$lLib == $NullObj} {
    puts "ERROR: Unable to open library: $libName"
    return
    }

    # Update PART properties (VALUE, PART_NUMBER)
    set partIter [$lLib NewPartsIter $lStatus]
    set lPart [$partIter NextPart $lStatus]

    set partFound 0
    while {$lPart != $NullObj} {

    set pNameCStr [DboTclHelper_sMakeCString]
    $lPart GetName $pNameCStr
    set pName [DboTclHelper_sGetConstCharPtr $pNameCStr]

    if {$pName eq $partName} {

    puts "Updating part: $pName"

    # VALUE
    $lPart SetEffectivePropStringValue [DboTclHelper_sMakeCString "VALUE"] [DboTclHelper_sMakeCString $newValue]

    # PART_NUMBER
    $lPart SetEffectivePropStringValue [DboTclHelper_sMakeCString "PART_NUMBER"] [DboTclHelper_sMakeCString $newPartNumber]

    set partFound 1
    break
    }
    set lPart [$partIter NextPart $lStatus]
    }

    if {!$partFound} {
    puts "ERROR: Part '$partName' not found"
    return
    }

    # Update PACKAGE PCB Footprint
    set pkgIter [$lLib NewPackagesIter $lStatus]
    set lPackage [$pkgIter NextPackage $lStatus]

    set pkgFound 0
    while {$lPackage != $NullObj} {

    set pkgCStr [DboTclHelper_sMakeCString]
    $lPackage GetName $pkgCStr
    set pName [DboTclHelper_sGetConstCharPtr $pkgCStr]

    if {$pName eq $pkgName} {

    puts "Updating PCB Footprint for package: $pkgName"

    $lPackage SetPCBFootprint [DboTclHelper_sMakeCString $newPCBFootprint]

    set pkgFound 1
    break
    }
    set lPackage [$pkgIter NextPackage $lStatus]
    }
    delete_DboLibPackagesIter $pkgIter

    if {!$pkgFound} {
    puts "ERROR: Package '$pkgName' not found"
    return
    }

    puts "SUCCESS: Passive part updated"
    }

    # example usage
    UpdatePassivePartAndPackage "test.olb" "CAP-1.Normal" "10uF" "HBH221" "CAP" "smdcap"

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • RT202604073158
    0 RT202604073158 2 months ago in reply to TechnoBobby

    So while going to use the function, I can get it to find the library but it is failing to find the part name I'm passing. I am using it as shown below.

    UpdatePassivePartAndPackage "path_to_file/RESISTORS.OLB" "5600452-000.Normal" "1" "NewPart" "5600452-000" "testfp"

    Any guesses as to what would cause this? Obviously the process is running and aborting at this point based on the fact that the error message is one that is defined in the process. When opening the library and looking in the "Part Properties" it seems obvious that this is the name of the part. 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • RT202604073158
    0 RT202604073158 2 months ago in reply to RT202604073158

    Sorry, what I had copied and pasted was the error message when I tested by removing a letter just to make sure that the error was coming from my script. The error message does also happen when everything is spelled correctly.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • TechnoBobby
    0 TechnoBobby 2 months ago in reply to RT202604073158

    Hi RT202604073158 ,

    It appears you may be using an older capture version that relies on the legacy Symbol Editor. If you have access to a newer release, please try running the script there, as behavior may differ between versions.

    Additionally, you can verify the part names returned from:
    set pName [DboTclHelper_sGetConstCharPtr $pNameCStr]

    by adding a:
    puts $pName

    statement immediately after it. This will help confirm whether the expected value is being retrieved.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • TechnoBobby
    0 TechnoBobby 2 months ago in reply to RT202604073158

    Hi RT202604073158 ,

    It appears you may be using an older capture version that relies on the legacy Symbol Editor. If you have access to a newer release, please try running the script there, as behavior may differ between versions.

    Additionally, you can verify the part names returned from:
    set pName [DboTclHelper_sGetConstCharPtr $pNameCStr]

    by adding a:
    puts $pName

    statement immediately after it. This will help confirm whether the expected value is being retrieved.

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

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

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