• 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. Modifying Part Instance Occurrence REFERENCE

Stats

  • State Verified Answer
  • Replies 7
  • Subscribers 12
  • Views 2356
  • Members are here 0
More Content

Modifying Part Instance Occurrence REFERENCE

karthikeyank
karthikeyank 10 months ago

Hi,

I'm trying to modify part instance occurrence reference name by TCL Script. I can be able to get the name from property but, I couldn't be able to modify them. I've added my code below can anyone please help me out to solve this problem that would be so helpful. 

Code:

set selectedobjs [GetSelectedPMItems]
set objlength [llength $selectedobjs]
set lStatus [DboState]
set lNullObj NULL
for {set j 0} {$j < $objlength} {incr j} {
set lPage [lindex $selectedobjs $j]
set lPageNameCS [DboTclHelper_sMakeCString]
set lPageNameCS1 [DboTclHelper_sMakeCString]
$lPage GetName $lPageNameCS
set lPageName [DboTclHelper_sGetConstCharPtr $lPageNameCS]
puts $lPageName
set PlIter [$lPage NewPartInstsIter $lStatus]
set lPart [$PlIter NextPartInst $lStatus]
while {$lPart != $lNullObj } {
set lReferenceName [DboTclHelper_sMakeCString]
$lPart GetReference $lReferenceName
set lReferenceNameS [DboTclHelper_sGetConstCharPtr $lReferenceName]
puts $lReferenceNameS
set lOccCount [$lPart GetOccurrencesCount]
puts $lOccCount
for {set i 0} {$i<$lOccCount} {incr i} {
set lOcc [$lPart GetOccurrencesAtPos $i]
set lReferenceName1 [DboTclHelper_sMakeCString]
$lOcc GetPathName $lReferenceName1
set lReferenceNameS1 [DboTclHelper_sGetConstCharPtr $lReferenceName1]
puts $lReferenceNameS1
set lPropsIter [$lOcc NewEffectivePropsIter $lStatus]
set lPrpName [DboTclHelper_sMakeCString]
set lPrpValue [DboTclHelper_sMakeCString]
set lPrpType [DboTclHelper_sMakeDboValueType]
set lEditable [DboTclHelper_sMakeInt]
set lStatus [$lPropsIter NextEffectiveProp $lPrpName $lPrpValue $lPrpType $lEditable]
while {[$lStatus OK] == 1} {
set RefFilt [DboTclHelper_sGetConstCharPtr $lPrpName]
if {$RefFilt == "Reference" } {
puts "Name = [DboTclHelper_sGetConstCharPtr $lPrpName] Value = [DboTclHelper_sGetConstCharPtr $lPrpValue]"
set GetVal [DboTclHelper_sGetConstCharPtr $lPrpValue]
set a "AA"
set upVal "$GetVal$a"

# Error Part-----------------------------------------
set lPrpName [DboTclHelper_sMakeCString "Reference"]
set lPrpValue [DboTclHelper_sMakeCString $upVal]
set PropVal [$lPropsIter SetEffectivePropStringValue $lPrpName $upVal]
#---------------------------------------------------

}
set lStatus [$lPropsIter NextEffectiveProp $lPrpName $lPrpValue $lPrpType $lEditable]
}
delete_DboEffectivePropsIter $lPropsIter
}

set lPart [$PlIter NextPartInst $lStatus]
}
delete_DboPagePartInstsIter $PlIter
}

Actual Prop:

Expected Output:

  • Sign in to reply
  • Cancel
  • karthikeyank
    0 karthikeyank 10 months ago in reply to CadAP

    Hi CADAP,

    Appreciate your support. 

    $aPartObj SetEffectivePropStringValue $lPropname $lPopval

    to

    $lOccObj SetEffectivePropStringValue $lPropname $lPopval

     

    It works perfectly good now, Thanks 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • CadAP
    0 CadAP 10 months ago in reply to karthikeyank

    @karthikeyank Thanks for making that correction.

    You are right I missed to pass the correct argument.

    • 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