Home
  • Products
  • Solutions
  • Support
  • Company

This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  • Products
  • Solutions
  • Support
  • Company
Community PCB Design & IC Packaging (Allegro X) Allegro X Scripting - TCL TCL Replace all the Pat on that page

Stats

  • State Verified Answer
  • Replies 5
  • Subscribers 11
  • Views 1227
  • Members are here 0
More Content

TCL Replace all the Pat on that page

ZH202409115233
ZH202409115233 6 months ago

I took a part from the CIS library and I want to replace all similar components on the page, such as a resistor 0201 with a 0402 from the CIS library (I will first put the 0402 from the CIS into the page to obtain its information).Could you please tell me how to use TCL script?

  • Sign in to reply
  • Cancel
  • rg13
    0 rg13 6 months ago

    This is being looked upon. Once script is ready, it will be shared.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • CadAP
    +1 CadAP 6 months ago in reply to rg13

    Hi ZH202409115233 

    Please the try the below tck code. 

    It will dump the properties of a CIS library part (part number start with EMA) and then replace the other selected instance with the CIS part library.

    Please check and lt me know your feedback.


    proc dumpproperties {} {

    set lNullObj NULL
    set lCounter 0
    set lPropertieslist {}
    set lStatus [DboState]
    set lPartNameCString [DboTclHelper_sMakeCString "Part_Number"]
    set lPartValueCString [DboTclHelper_sMakeCString]
    set lSelectedParts [GetSelectedObjects]
    #create the input/output parameters
    set lPrpName [DboTclHelper_sMakeCString]
    set lPrpValue [DboTclHelper_sMakeCString]
    set lPrpType [DboTclHelper_sMakeDboValueType]
    set lEditable [DboTclHelper_sMakeInt]
    foreach part $lSelectedParts {

    set lStatus [$part GetEffectivePropStringValue $lPartNameCString $lPartValueCString]
    set lPartValue [DboTclHelper_sGetConstCharPtr $lPartValueCString]
    if {[regexp {EMA} $lPartValue ] == 1} {

    set lPropsIter [$part NewEffectivePropsIter $lStatus]
    #get the first effective property
    set lStatus [$lPropsIter NextEffectiveProp $lPrpName $lPrpValue $lPrpType $lEditable]
    while {[$lStatus OK] == 1 && [DboTclHelper_sGetInt $lEditable] == 1} {

    set lPropname [DboTclHelper_sGetConstCharPtr $lPrpName]
    set lPropVal [DboTclHelper_sGetConstCharPtr $lPrpValue]
    # puts "$lPropname :== $lPropVal"
    # puts [DboTclHelper_sGetInt $lEditable]
    lappend lPropertieslist $lPropname $lPropVal
    #placeholder: do your processing for $lPrpName $lPrpValue $lPrpType $lEditable
    #get the next effective property
    set lStatus [$lPropsIter NextEffectiveProp $lPrpName $lPrpValue $lPrpType $lEditable]
    incr lCounter
    }


    delete_DboEffectivePropsIter $lPropsIter

    }

    if {$lCounter > 0} {

    return $lPropertieslist

    }
    }

    }


    set lSession $::DboSession_s_pDboSession
    DboSession -this $lSession
    set lNullObj NULL
    set lStatus [DboState]
    set lPkgCSName [DboTclHelper_sMakeCString]
    set lPartRefernce [DboTclHelper_sMakeCString]
    set lPartRefernce1 [DboTclHelper_sMakeCString]
    set lSelcedtedObj [lindex [GetSelectedObjects] 0]
    # puts $lSelcedtedObj

    set lAllDbProps [dumpproperties]
    set lPkgName [$lSelcedtedObj GetPackage $lStatus]
    set lLibPart [$lSelcedtedObj GetPart $lStatus]
    set lDboDevice [$lSelcedtedObj GetDevice $lStatus]
    set lSourcePckgnName [$lSelcedtedObj GetSourcePackageName $lPkgCSName]
    set lRef [$lSelcedtedObj GetReference $lPartRefernce]
    set lPartRef [DboTclHelper_sGetConstCharPtr $lPartRefernce]
    puts $lPkgName
    puts $lLibPart
    puts $lDboDevice
    puts $lPartRef
    puts [DboTclHelper_sGetConstCharPtr $lPkgCSName]
    set lselob [GetSelectedObjects]
    foreach obj $lselob {
    set lPage [$obj GetOwner]
    set lRef1 [$obj GetReference $lPartRefernce1]
    set lPartRef1 [DboTclHelper_sGetConstCharPtr $lPartRefernce1]
    puts $lPartRef1
    if {$lPartRef1 != $lPartRef} {
    puts "changing"
    $lPage ReplaceInst $obj $lPkgCSName $lLibPart $lDboDevice $lStatus 1 1 1 1 1
    DboTclHelper_sEvalPage $lPage
    Menu "File::Save"
    Menu "View::Zoom::Redraw"
    puts "[llength $lAllDbProps]"
    for {set i 0} {$i <= [expr {[llength $lAllDbProps]/2}]} {incr i} {

    # puts [lindex $lAllDbProps $i]
    # puts [lindex $lAllDbProps [expr {$i + 1}]]
    set lpropname [DboTclHelper_sMakeCString [lindex $lAllDbProps $i]]
    set lpropvalu [DboTclHelper_sMakeCString [lindex $lAllDbProps [expr {$i + 1}]] ]
    # puts $lpropname
    # puts $lpropvalu
    # $obj SetEffectivePropStringValue $lpropname $lpropvalu 0
    $obj SetUserPropStringValue $lpropname $lpropvalu
    incr i
    }
    }


    }

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

    I understand the logic of this code, but the code lines # $obj SetEffectivePropStringValue $lpropname $lpropvalu 0 and $obj SetUserPropStringValue $lpropname $lpropvalu are not working, why?(Cadence 17.2)

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • CadAP
    0 CadAP 5 months ago in reply to ZH202409115233

    ZH202409115233  it should work. 

    Can you let me know the current hotfix for you SPB17.2 version?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • ZH202409115233
    0 ZH202409115233 5 months ago in reply to CadAP

    Thank you. That works

    • 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