• 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 to replace Instance values of whole schematic using...

Stats

  • State Suggested Answer
  • Replies 1
  • Answers 1
  • Subscribers 46
  • Views 44
  • Members are here 0
More Content

How to replace Instance values of whole schematic using Occurrence fields with TCL command or script.

abhisheklogic
abhisheklogic 8 hours ago

Hi,

Hi,

I am using OrCAD Capture CIS 24.1 for schematic design.

I would like to copy values from the Occurrence tab (such as Manufacturer Part Number, Operating Temperature, etc.) to the Instance tab using a TCL command or script.

I want to avoid doing this manually, as the design contains more than 3000 components (over 300 BOM items).

I have attempted this at my end but have not been successful. Could you please assist me with this?

Looking forward to your response.

Thanks & regards,
Raj Kumar

Best Regards,

Raj Kumar

  • Cancel
  • Sign in to reply
  • TechnoBobby
    0 TechnoBobby 1 hour ago

    Hi Raj,

    Please try the below TCL script to copy all Occurrence properties to Instance across the entire design.
    It handles multiple occurrences by matching the Reference; you can tweak according to your DSN.

    I hope it helps!

    Note: Please create a backup of your design before running script.

    namespace eval ::capOcc2Inst {
    }

    # Get property string value
    proc ::capOcc2Inst::GetProp {obj pName} {
    set pCS [DboTclHelper_sMakeCString $pName]
    set outCS [DboTclHelper_sMakeCString]
    $obj GetEffectivePropStringValue $pCS $outCS
    return [string trim [DboTclHelper_sGetConstCharPtr $outCS]]
    }

    # Set property string value
    proc ::capOcc2Inst::SetProp {obj pName val} {
    $obj SetEffectivePropStringValue [DboTclHelper_sMakeCString $pName] [DboTclHelper_sMakeCString $val]
    }

    # Copy Occurrence to Instance for a single part instance
    proc ::capOcc2Inst::ProcessPart {lPart} {

    # Skip non-parts
    if { [$lPart GetObjectType] != $::DboBaseObject_PLACED_INSTANCE } {
    return
    }

    set occCount [$lPart GetOccurrencesCount]
    if {$occCount == 0} {
    puts "No occurrences - skipped"
    return
    }

    # Pick correct occurrence
    set instRef [::capOcc2Inst::GetProp $lPart "Reference"]
    set lOcc [$lPart GetOccurrencesAtPos 0]

    if {$occCount > 1} {
    for {set i 0} {$i < $occCount} {incr i} {
    set cand [$lPart GetOccurrencesAtPos $i]
    if {[::capOcc2Inst::GetProp $cand "Reference"] eq $instRef} {
    set lOcc $cand
    break
    }
    }
    }

    # Build list of all occurrence properties
    set occProps {}
    set lStatus [DboState]
    set iter [$lOcc NewEffectivePropsIter $lStatus]
    set pName [DboTclHelper_sMakeCString]
    set pVal [DboTclHelper_sMakeCString]
    set pType [DboTclHelper_sMakeDboValueType]
    set editable [DboTclHelper_sMakeInt]

    set lStatus [$iter NextEffectiveProp $pName $pVal $pType $editable]
    while {[$lStatus OK] == 1} {
    set name [DboTclHelper_sGetConstCharPtr $pName]
    set val [DboTclHelper_sGetConstCharPtr $pVal]

    # Ignore ID (instance doesn’t have ID)
    if {$name ne "ID" && $val ne ""} {
    ::capOcc2Inst::SetProp $lPart $pName $pVal
    }
    set lStatus [$iter NextEffectiveProp $pName $pVal $pType $editable]
    }
    delete_DboEffectivePropsIter $iter

    puts "Updated instance $instRef from occurrence"
    }

    # Run function: iterate all selected objects
    proc ::capOcc2Inst::CopyOccToInst {} {

    set lSession $::DboSession_s_pDboSession
    DboSession -this $lSession
    set lNullObj NULL
    set lStatus [DboState]

    set lDesign [$lSession GetActiveDesign]
    if {$lDesign == $lNullObj} {
    puts "ERROR: No active design"
    return
    }

    set schIter [$lDesign NewViewsIter $lStatus $::IterDefs_SCHEMATICS]
    set lView [$schIter NextView $lStatus]

    while {$lView != $lNullObj} {

    set lSchematic [DboViewToDboSchematic $lView]
    set pageIter [$lSchematic NewPagesIter $lStatus]
    set page [$pageIter NextPage $lStatus]

    while {$page != $lNullObj} {

    set partIter [$page NewPartInstsIter $lStatus]
    set lPart [$partIter NextPartInst $lStatus]

    while {$lPart != $lNullObj} {
    ::capOcc2Inst::ProcessPart $lPart

    set lPart [$partIter NextPartInst $lStatus]
    }
    delete_DboPagePartInstsIter $partIter
    set page [$pageIter NextPage $lStatus]
    }
    set lView [$schIter NextView $lStatus]
    }
    delete_DboLibViewsIter $schIter

    puts "Done copying all Occ to Inst for selected parts."
    }

    ::capOcc2Inst::CopyOccToInst

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

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

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