Home > Community > Forums > PCB Design > Hierarchical traverse with TCL script

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 Hierarchical traverse with TCL script 

Last post Wed, Jun 18 2014 3:00 AM by Loic TCL. 0 replies.
Started by Loic TCL 18 Jun 2014 03:00 AM. Topic has 0 replies and 1013 views
Page 1 of 1 (1 items)
Sort Posts:
  • Wed, Jun 18 2014 3:00 AM

    • Loic TCL
    • Not Ranked
    • Joined on Wed, Jun 18 2014
    • Posts 2
    • Points 25
    Hierarchical traverse with TCL script Reply

    Hello everyboby,

    First of all I want to say that I am a beginner in TCL scripting, also excuse my English (because I am French).

    So, I have an Orcad design with many schematics and pages. My goal is to display all components references that are on my design. I actually can display components properties with something like that (2 procedures):

    proc Process { Page } {

    set NullObject NULL

    set status [DboState]

    set Reference ""

    set lPageName [DboTclHelper_sMakeCString]

    $Page GetName $lPageName

    set pageName [DboTclHelper_sGetConstCharPtr $lPageName]

    set lPartInstsIter [$Page NewPartInstsIter $status] 

    set lInst [$lPartInstsIter NextPartInst $status] 

    while {$lInst != $NullObject} {

    set schOcc [GetInstanceOccurrence]

    set lInstOcc [$schOcc GetInstOccurrence $lInst $status]

    set NullObject NULL

    set status [DboState]

    set userPropValue [DboTclHelper_sMakeCString]

    set userPropName [DboTclHelper_sMakeCString]

    set DBPropIter [$lInstOcc NewDBPropsIter $status]

    set DBProp [$DBPropIter NextDBProp $status]

    while { $DBProp != $NullObject } {

    $DBProp GetName $userPropName

    if { [DboTclHelper_sGetConstCharPtr $userPropName] == "Reference" } {

    $DBProp GetStringValue $lInstOcc $userPropValue

    set Reference [DboTclHelper_sGetConstCharPtr $userPropValue]

    }

    set DBProp [$DBPropIter NextDBProp $status]

    }

    delete_DboDBPropsIter $DBPropIter

    puts "$Reference"

    set lInst [$lPartInstsIter NextPartInst $status]

    }

    delete_DboPagePartInstsIter $lPartInstsIter

    puts "End of page\n"

     

    proc ProcessAll {} {

    set NullObject NULL

    set status [DboState]

    set lSession $::DboSession_s_pDboSession

    DboSession -this $lSession

    set lDesign [$lSession GetActiveDesign]

    set lSchematicIter [$lDesign NewViewsIter $status $::IterDefs_SCHEMATICS] 

    set lView [$lSchematicIter NextView $status] 

    set Schematic [DboViewToDboSchematic $lView]

    while { $lView != $NullObject} {

    set lPagesIter [$Schematic NewPagesIter $status] 

    set Page [$lPagesIter NextPage $status] 

    while {$Page != $NullObject} { 

    set lPageName [DboTclHelper_sMakeCString]

    $Page GetName $lPageName

    set pageName [DboTclHelper_sGetConstCharPtr $lPageName]

    puts "\nPAGE : $pageName"

    Process $Page

    set Page [$lPagesIter NextPage $status] 

    delete_DboSchematicPagesIter $lPagesIter

    set lView [$lSchematicIter NextView $status] 

    set Schematic [DboViewToDboSchematic $lView]

    delete_DboLibViewsIter $lSchematicIter

    }

     

    When I call the procedure "Process" on a specific page, I obtain what I want, it displays all the references of the components of the page. The goal of the procedure called "ProcessAll" is to call "Process" on all the pages of my design. This procedure seems to work fine too.

    But, my problem is that some schematics have multiples occurences in my design ( with hierarchical blocks), and, I don't know how to "take" all this occurences. For example I have a page called "Page 1" that have multiple occurences in my design thanks to hierarchical blocks (but only one "Page 1" in my design tree), and I actually can "take" only one "Page 1". But the references of the components are different between all the occurences of "Page 1" and I need all of them. So can you help me on that?

    I found the procedure called "traverse_hierarchy" in the PDF doc "OrCAD_Capture_TclTk_Extensions" that can maybe help me but I don't understand clearly it's functionning and how can I use it for my problem.

    Thanks 

    • Post Points: 5
Page 1 of 1 (1 items)
Sort Posts:
Started by Loic TCL at 18 Jun 2014 03:00 AM. Topic has 0 replies.