• 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. Why can not get the display property of a part with tcl...

Stats

  • State Verified Answer
  • Replies 4
  • Subscribers 13
  • Views 2103
  • Members are here 0
More Content

Why can not get the display property of a part with tcl script in ORCAD

Jadystone
Jadystone over 1 year ago
I want to get the name of a display property for a part. But it can't work. Why?
 
proc ShowDisplayProperty { } {
    set lStatus [DboState]
    set lNullObj NULL

    set lObject [GetSelectedObjects]

    set lname [DboTclHelper_sMakeCString]

    set lPropsIter [$lObject NewDisplayPropsIter $lStatus]
    #get the first display property on the object
    set lDProp [$lPropsIter NextProp $lStatus]
    while {$lDProp != $lNullObj } {
        #can not run
        $lDProp GetName $lname
        set strName [DboTclHelper_sGetConstCharPtr $lname]
        puts [format "%30s = %-30s" GetName $strName]
    }
    delete_DboDisplayPropsIter $lPropsIter
    $lStatus -delete
}
 
  • Sign in to reply
  • Cancel
Parents
  • CadAP
    +1 CadAP over 1 year ago

    Hi Jadystone,

    The problem with your code is that once your code enters the while loop it is not getting out of it, because you are not taking the next property from the propIter.

    I have fixed the code by adding the line "set lDProp [$lPropsIter NextProp $lStatus]" and also added line in the code to get the property value.

    proc ShowDisplayProperty { } {
    set lStatus [DboState]
    set lNullObj NULL
    set lObject [GetSelectedObjects]
    set lname [DboTclHelper_sMakeCString]
    set lValue [DboTclHelper_sMakeCString]
    set lPropsIter [$lObject NewDisplayPropsIter $lStatus]
    #get the first display property on the object
    set lDProp [$lPropsIter NextProp $lStatus]
    while {$lDProp != $lNullObj } {
    #can not run
    $lDProp GetName $lname
    $lDProp GetValueString $lValue
    set strName [DboTclHelper_sGetConstCharPtr $lname]
    set strValue [DboTclHelper_sGetConstCharPtr $lValue]
    # puts $strName
    puts [format "%30s = %-30s" GetName $strName]
    puts [format "%30s = %-30s" GetValue $strValue]
    set lDProp [$lPropsIter NextProp $lStatus]
    }
    delete_DboDisplayPropsIter $lPropsIter
    $lStatus -delete
    }

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Reject Answer
    • Cancel
  • Jadystone
    0 Jadystone over 1 year ago in reply to CadAP

    Thank your reply.  I am sorry for that My code miss the "set lDProp [$lPropsIter NextProp $lStatus]" line.

    The next picture is my actual code. I can get the uncomment properties (location /color /rotation). But can't get the name property, so I comment out from my code.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • CadAP
    +1 CadAP over 1 year ago in reply to Jadystone

    Currently, the tcl code shown in the above picture will not give the name property of the selected object. The reason is that name property is not displayed. 

    Display Prop only works for the property displayed on the schematic canvas. If property is present on the part but not displayed, then it will not be reported.

    To get the name property of the object please add below line line set lname [DboTclHelper_sMakeCString]

    $lobject GetName $lname

    puts [DboTclHelper_sGetConstCharPtr $lname]

    Hope this helps!

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
Reply
  • CadAP
    +1 CadAP over 1 year ago in reply to Jadystone

    Currently, the tcl code shown in the above picture will not give the name property of the selected object. The reason is that name property is not displayed. 

    Display Prop only works for the property displayed on the schematic canvas. If property is present on the part but not displayed, then it will not be reported.

    To get the name property of the object please add below line line set lname [DboTclHelper_sMakeCString]

    $lobject GetName $lname

    puts [DboTclHelper_sGetConstCharPtr $lname]

    Hope this helps!

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
Children
  • Jadystone
    0 Jadystone over 1 year ago in reply to CadAP

    Great Thanks ! I get it.

    • 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