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 Need help , getting one TEXT Object and access properties...

Stats

  • State Verified Answer
  • Replies 2
  • Subscribers 11
  • Views 296
  • Members are here 0
More Content

Need help , getting one TEXT Object and access properties (SETTERS /GETTERS )

Mhawley1
Mhawley1 1 month ago

Hello Everyone . 

I just started to dive into the TCL scripting language and im hitting some hard walls just because its nothing like the SKILL language . So to get started with something really simple I want to do the following :

I have a DSN , Its completely empty except for a Graphical Object of text . 

I want to iterate over the design and read that text and set that text . Thats all . If I can just get that working maybe I can get a grip of how the language works and begin the access other objects . But right now im really struggling with the basics . 

  • Sign in to reply
  • Cancel
  • CadAP
    +1 CadAP 1 month ago

    Hi Mhawley1,

    Please find a sample tcl code iterating over comment text dumping previous value and changing the value.

    set lSession $::DboSession_s_pDboSession
    DboSession -this $lSession
    set lNullObj NULL
    set lStatus [DboState]
    set lDesign [$lSession GetActiveDesign]
    #setting my value in cstring.
    set lMyText [DboTclHelper_sMakeCString "Cadence"]
    #Getting schematic iter.
    set lSchematicIter [$lDesign NewViewsIter $lStatus $::IterDefs_SCHEMATICS]
    #get the first schematic view
    set lView [$lSchematicIter NextView $lStatus]
    # set lPage_Name [DboTclHelper_sMakeCString]
    while { $lView != $lNullObj} {
    #dynamic cast from DboView to DboSchematic
    set lSchematic [DboViewToDboSchematic $lView]
    $lSchematic GetName $lSchi_Name
    set lPagesIter [$lSchematic NewPagesIter $lStatus]
    #get the first page
    set lPage [$lPagesIter NextPage $lStatus]
    # puts [DboTclHelper_sGetConstCharPtr $lSchi_Name]
    while {$lPage!=$lNullObj} {
    # puts [DboTclHelper_sGetConstCharPtr $lPage_Name]
    # set lPartInstsIter [$lPage NewPartInstsIter $lStatus]
    set lCommentsIter [$lPage NewCommentGraphicsIter $lStatus]
    set lGraphic [$lCommentsIter NextCommentGraphic $lStatus]
    while {$lGraphic!=$lNullObj} {

    set lType [$lGraphic GetObjectType]
    if {$lType == $::DboBaseObject_GRAPHIC_COMMENTTEXT_INST} {

    set lTextInst [DboGraphicInstanceToDboGraphicCommentTextInst $lGraphic]
    #Get commnet box dbid
    set lDef [$lTextInst GetDboCommentText]
    #Getting the current value
    set lState [$lDef GetText $lGetCString]
    #COnverting cs string to tcl string.
    puts [DboTclHelper_sGetConstCharPtr $lGetCString]
    #Setting a new value of comment text box
    set lState [$lDef SetText $lMyText]
    if {[$lState OK] == 1} {

    puts "successfully updated the text value"

    }
    #placeholder: do your processing on $lTextInst
    #get the next graphics of the page

    }

    set lGraphic [$lCommentsIter NextCommentGraphic $lStatus]
    }
    delete_DboPageCommentGraphicsIter $lCommentsIter
    set lPage [$lPagesIter NextPage $lStatus]
    }
    delete_DboSchematicPagesIter $lPagesIter
    #get the next schematic view
    set lView [$lSchematicIter NextView $lStatus]
    }
    delete_DboLibViewsIter $lSchematicIter

    Hope it helps

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Reject Answer
    • Cancel
  • Mhawley1
    0 Mhawley1 1 month ago in reply to CadAP

    YES !!! , this does help thank you so much . I scanned through the code and was intimidated like I knew I would be but I did gleam through one line I really REALLY cared about .

     set lState [$lDef SetText $lMyText]

    I started to cobble together a different script and I could not modify text block text and thats the piece I needed . Here the code . 


    set lStatus [DboState]
    set lNullObj NULL
    set lObject [GetSelectedObjects]
    puts $lObject
    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 } {
    puts "went into while loop iu"
    #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]


    # AH HA < SO NOOWWWWW IT WORKS > MUAHAHAHAH makes all the text TEST
    set name [DboTclHelper_sMakeCString "test"]

    set lState [$lDProp SetValueString $name]


    set lDProp [$lPropsIter NextProp $lStatus]
    }
    delete_DboDisplayPropsIter $lPropsIter
    $lStatus -delete


    # note there is also a SETNAME !!!!!! ,

    So in THANK you so much , this gives me a baseline so I can build from there . 

    • 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