• 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. Iterate occurrences of title blocks

Stats

  • State Verified Answer
  • Replies 2
  • Subscribers 12
  • Views 923
  • Members are here 0
More Content

Iterate occurrences of title blocks

Mhawley1
Mhawley1 2 months ago

So I used this code to get all the Occurrences of the title blocks .

but is the getting and setting of properties the same as a regular title block ? 

set lname [DboTclHelper_sMakeCString]
set lValue [DboTclHelper_sMakeCString]
$lTitleBlockOcc GetName $lname
$lTitleBlockOcc GetValueString $lValue

set lState [$lTitleBlockOccSetValueString $lname ]

if this is redundant to my other posts or just simple feel free to shame me . Im a slow learner. 

  • Cancel
  • Sign in to reply
Parents
  • TechnoBobby
    +1 TechnoBobby 2 months ago

    Hi Mhawley1 ,

    When iterating through the title block occurrences, note that $lTitleBlockOcc returns a DboOccurrence object. Therefore, you cannot directly use methods like GetValueString, which belong to the DboDisplayProp class.

    To retrieve a property such as Name, Rev, etc., you can use:

    set lProp [DboTclHelper_sMakeCString "Name"]
    set lname [DboTclHelper_sMakeCString]
    $lTitleBlockOcc GetEffectivePropStringValue $lProp $lname

    Similarly, you can retrieve other property values using their respective names.
    To modify a property, use the SetEffectivePropStringValue method in the same way.

    Hope this helps!

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Reject Answer
    • Cancel
Reply
  • TechnoBobby
    +1 TechnoBobby 2 months ago

    Hi Mhawley1 ,

    When iterating through the title block occurrences, note that $lTitleBlockOcc returns a DboOccurrence object. Therefore, you cannot directly use methods like GetValueString, which belong to the DboDisplayProp class.

    To retrieve a property such as Name, Rev, etc., you can use:

    set lProp [DboTclHelper_sMakeCString "Name"]
    set lname [DboTclHelper_sMakeCString]
    $lTitleBlockOcc GetEffectivePropStringValue $lProp $lname

    Similarly, you can retrieve other property values using their respective names.
    To modify a property, use the SetEffectivePropStringValue method in the same way.

    Hope this helps!

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Reject Answer
    • Cancel
Children
  • Mhawley1
    +1 Mhawley1 2 months ago in reply to TechnoBobby

    Yep that allowed me to get the rev's of the title block . THANK YOU !!!! 

    proc iterate_title_block {pInstOcc} {


    global lStatus

    set lTitleBlockOccIter [$pInstOcc NewChildrenIter $lStatus $::IterDefs_TITLEBLOCKS]

    #get the first child TitleBlock occurrence
    set lTitleBlockOcc [$lTitleBlockOccIter NextOccurrence $lStatus]
    set lNullObj NULL
    while { $lTitleBlockOcc!= $lNullObj} {

    # placeholder: do your processing on $lTitleBlockOcc
    puts $lTitleBlockOcc

    set lname [DboTclHelper_sMakeCString]
    puts " right before rev"
    #can not run
    set lProp [DboTclHelper_sMakeCString "RevCode"]
    set lname [DboTclHelper_sMakeCString]
    $lTitleBlockOcc GetEffectivePropStringValue $lProp $lname
    puts [DboTclHelper_sGetConstCharPtr $lname]
    puts $lname

    #get the next child TitleBlock occurrence
    set lTitleBlockOcc [$lTitleBlockOccIter NextOccurrence $lStatus]
    # puts $lTitleBlockOcc

    }

    delete_DboOccurrenceChildrenIter $lTitleBlockOccIter

    }

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • 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.

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

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