• 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. OrCAD how to create a correct Variant report through TC...

Stats

  • State Suggested Answer
  • Replies 2
  • Answers 1
  • Subscribers 13
  • Views 133
  • Members are here 0
More Content

OrCAD how to create a correct Variant report through TCL

PatEscher
PatEscher 5 days ago

Hello, 
we are trying to build a Variant BOM Report through tcl and have been inspired by the sample tcl file capCIS.tcl.

Everything works fine, as long as you do the Group assignment through the Part Manager.

However, if you do it through the Schematic Right Mouse button Action, you will most likely get into trouble as soon as you use Components with multiple parts (does not matter if homogenous or heterogenous).

So what I do is the following:

I place a multi part component, so let's say K401A and K401B in my schematic

Looking at the Part Manager I see that K401 (Designator A) is added to the common Group. --> so far so good --> the Component is Mounted
then I add it to a Variant group and set it to "Not present" --> so far so good --> the Component is Unmounted

Then I go ahead in the schematic, select the Part K401B and use the right Mouse button to add it to a Variant  Group --> WOW, why I am allowed to do this, the "Physical Part" should already been added before.

Now,back in Part Manager, I still see that the Part K401 (Designator A) is  set to "Not present"... but... when we now run the tcl code to get the Variant BOM, I see both part entries, K401A and K401B, both in the same group, but one as present and the other one as not present --> why is it be possible to have such a situation. I have ONE physical Component which is a MultiPart package (or fractured Symbol). I should be be able to assign the individual parts to different groups. If I add one part to a group, then it must be valid for all the parts (once again, we are dealing with one physical Component).

My debug output verifies this:

[DEBUG] 2026-07-30 11:22:34:557 SubGroup Ch4-Relay Duplicator unmounted PartId:4293  and refDes K401A

[DEBUG] 2026-07-30 11:22:34:557 SubGroup Ch4-Relay Duplicator MOUNTED PartId:4296 and refDes K401B   

So what I am missing here? What is the usecase which makes this required/useful?


in addition, I have absolutely no possibility to visualize this issue nor to correct it. I would need to know what is going wrong somehow and then manually remove K401B through the Command action in the schematic.

How can we identify and deal with this situation and make sure, that the BOM is created on the physical components and not the instantiated parts. Not clear to me which tcl functions to use for this.

I though about considering the Reference Designator/Designator, but this would also not be really working, as I can manually assign a RefDes and therefore they could be the same but are indeed different physical components (--> yes, this is a design error, but we would need to deal with it somehow). So I would need to have a possibility to identify if a component is mounted or not across all available parts of this component (essentially it seems that if one part is set to not present, then the component is not present)

When I create a BOM report through the Part Manager, then everything is fine, so it means to me that there must be somehow a possibility to work on the physical components.

Any idea appreciated

+Patrick

  • Sign in to reply
  • Cancel
  • PatEscher
    0 PatEscher 4 days ago

    ok, to make this a little bit simpler (hopefully)Slight smile

    The idea now is to get the "Do Not Stuff" string (the name I can get from the CIS Configuration) and then use this as a filter
    But I am not clear on how to get this information. I tried a lot of things like looking t the EffectiveProperties etc., but did not find this 'override' in case that a part is not stuffed

    Can you provide me an example how to get to this info, assuming that I have the partId which is provided through the Part Manager


    set uintPartId [CISTclHelper_sGetUINTFromInt $partId]
    set cisInstOcc [$cisDesign GetPartOccForID $uintPartId]


    Thanks

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • TechnoBobby
    0 TechnoBobby 4 days ago in reply to PatEscher

    Hi PatEscher ,

    You can try the following script. Give it a RefDes and it will report all groups/subgroups where that part is present and whether it is marked as stuffed (present) or not stuffed (DNI).


    set targetRefDes "C20"

    proc cs {obj} {
    if {$obj == "" || $obj == "NULL"} {
    return ""
    }
    return [DboTclHelper_sGetConstCharPtr $obj]
    }

    set cisDesign [CPartMgmt_GetCisDesign [GetActivePMDesign]]
    set grpCont [$cisDesign GetGroupsContainer]

    puts "Checking $targetRefDes"

    set groupCount [$grpCont GetGroupCount]

    for {set g 0} {$g < $groupCount} {incr g} {

    set groupCS [$grpCont GetGroupByIndex $g]
    set groupName [cs $groupCS]

    if {[$grpCont IsGroupHasSubGroups $groupCS]} {

    set subCnt [$grpCont GetSubGroupCount $groupCS]

    for {set s 0} {$s < $subCnt} {incr s} {

    set subCS [$grpCont GetSubGroupByIndex $groupCS $s]
    set subName [cs $subCS]

    set partArr [CISTclHelper_sMakeCUIntArray]
    $grpCont GetPartsFromSubGroup $groupCS $subCS $partArr

    set cnt [CISTclHelper_sGetCUIntArraySize $partArr]

    for {set i 0} {$i < $cnt} {incr i} {

    set partId [CISTclHelper_sGetUInt $partArr $i]
    set occ [$cisDesign GetPartOccForID [CISTclHelper_sGetUINTFromInt $partId]]

    if {$occ == "NULL" || $occ == ""} {
    continue
    }

    set rdObj [$occ GetPartRefDes]
    set refdes [cs [$rdObj GetRefDes]]

    if {[string equal -nocase $refdes $targetRefDes]} {

    set stuffed [$grpCont IsPartStuffedSubGroup $groupCS $subCS [CISTclHelper_sGetUINTFromInt $partId]]

    puts "Group=$groupName SubGroup=$subName PartId=$partId Stuffed=$stuffed"

    if {$stuffed} {
    puts " Status : PRESENT"
    } else {
    puts " Status : NOT PRESENT / DNI"
    }
    }

    delete_CISInstOccurrence $occ
    }
    }
    }
    }


    Hope this helps!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • 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.

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

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