• 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 Capture CIS: How to set SetPartPresent/SetPartNot...

Stats

  • State Verified Answer
  • Replies 3
  • Answers 1
  • Subscribers 13
  • Views 1672
  • Members are here 0
More Content

OrCAD Capture CIS: How to set SetPartPresent/SetPartNotPresent

BT202504251050
BT202504251050 5 months ago

Hi All,

I would like to achieve seperated BOM by the two steps.

1. Keep one group with all its parts set to "Present", and set all parts in the other groups to "Not Present".

2. Use standard BOM to generate report.

       

The issue I’m facing is that the CPMgtCfg commands SetPartPresent and SetPartNotPresent only work correctly after I manually select any component in the Part Manager. However, I don’t know how to make this process apply on the TCL script.

=================================================================

set DboDesign [GetActivePMDesign]
set CISDesign [CPartMgmt_GetCisDesign $DboDesign]
set lCfg      [OrCISGetDbcConfig]

set CVariantGroupsContainer [$CISDesign GetGroupsContainer]
set groupArray  [CISTclHelper_sMakeCStringArray]
set subGrpArray [CISTclHelper_sMakeCStringArray]

set allGroup    [$CVariantGroupsContainer GetAllGroups $groupArray]
set groupSize  [CISTclHelper_sGetCStringArraySize $groupArray]

for {set i 0} {$i < $groupSize} {incr i} {
    set grpCStringName [CISTclHelper_sGetCString $groupArray $i]
    set grpName [DboTclHelper_sGetConstCharPtr $grpCStringName]
    puts "=== Group Name : $grpName ==="

    set partCUIntArray [CISTclHelper_sMakeCUIntArray]
    $CVariantGroupsContainer GetPartsFromGroup $grpCStringName $partCUIntArray


    set arraySize [CISTclHelper_sGetCUIntArraySize $partCUIntArray]
    for {set x 0} {$x <=$arraySize} {incr x} {
        set lPartId [CISTclHelper_sGetUInt $partCUIntArray $x]
        if {$lPartId != 0} {
            set lUINTPartId [CISTclHelper_sGetUINTFromInt $lPartId]
            set lCISInstOcc [$CISDesign GetPartOccForID $lUINTPartId]
            if {$lCISInstOcc != "NULL"} {
                set lRefDes [$lCISInstOcc GetPartRefDes]
                set lRefDes [$lRefDes GetRefDes]
                set lRefDes [DboTclHelper_sMakeCString $lRefDes]
                set lRefDesStr [DboTclHelper_sGetConstCharPtr $lRefDes]
                puts $lRefDesStr
                SetPartNotPresent  <= Not Work
            }
        }
    }
}
  • Cancel
  • Sign in to reply
Parents
  • andakConsultingLtd
    0 andakConsultingLtd 5 months ago

    Have a look at below code. I extracted it from a script that does pretty much the same thing that you want, but with a custom property.

    set noPopCStr [DboTclHelper_sMakeCString "NOPOP"]
    set voidCStr [DboTclHelper_sMakeCString ""]
    while {$compProp != $lNullObj } {
        set lName [DboTclHelper_sMakeCString]
        set lValue [DboTclHelper_sMakeCString]
        $compProp GetName $lName
        $compProp GetStringValue $lValue

        if {[DboTclHelper_sGetConstCharPtr $lName] == "MY_PROP"} {
            if {[DboTclHelper_sGetConstCharPtr $lValue] != "NOPOP"} {
                $compProp SetStringValue $noPopCStr
            } else {
                $compProp SetStringValue $voidCStr
            }
        }  
        #get the next user property on the object
        set compProp [$lPropsIter NextUserProp $lStatus]
    }

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • BT202504251050
    0 BT202504251050 4 months ago in reply to andakConsultingLtd

    Thank you. I’m still new to TCL script, so I’ll need some time to determine if it’s feasible.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • BT202504251050
    +1 BT202504251050 4 months ago in reply to BT202504251050

    Hi All,

    I have been solved my problem about present/not present by follow code.

    if {$lCISInstOcc != "NULL"} {
        set lRefDes [$lCISInstOcc GetPartRefDes]
        set lRefDes [$lRefDes GetRefDes]
        set lRefDes [DboTclHelper_sMakeCString $lRefDes]
        set lRefDesStr [DboTclHelper_sGetConstCharPtr $lRefDes]
        # puts "Part Reference: $lRefDesStr"
        SelectGroup Groups $grpName $lRefDesStr; SetPartNotPresent;
    }

    However, I found this methed cannot generate BOM for each group by MenuCommand in advance.


    standard_bill_of_materials $root $enabledGrp
    Menu "Reports::CIS Bill of Materials::Standard" | DialogBox "OK" "${root}/standard_bom_${enabledGrp}.xml"
    MenuCommand 57927 | MessageBox "YES" "Save changes to C:/Cadence/SPB_17.2" | FileDialog "OK" "C:/SPB_Data/${enabledGrp}.BOM" 1


    Finally, i reference the sample code "C:\Cadence\SPB_17.2\tools\capture\tclscripts\capCustomSamples\capGenerateBOM.tcl" to complete my job.Smile

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

    Hi All,

    I have been solved my problem about present/not present by follow code.

    if {$lCISInstOcc != "NULL"} {
        set lRefDes [$lCISInstOcc GetPartRefDes]
        set lRefDes [$lRefDes GetRefDes]
        set lRefDes [DboTclHelper_sMakeCString $lRefDes]
        set lRefDesStr [DboTclHelper_sGetConstCharPtr $lRefDes]
        # puts "Part Reference: $lRefDesStr"
        SelectGroup Groups $grpName $lRefDesStr; SetPartNotPresent;
    }

    However, I found this methed cannot generate BOM for each group by MenuCommand in advance.


    standard_bill_of_materials $root $enabledGrp
    Menu "Reports::CIS Bill of Materials::Standard" | DialogBox "OK" "${root}/standard_bom_${enabledGrp}.xml"
    MenuCommand 57927 | MessageBox "YES" "Save changes to C:/Cadence/SPB_17.2" | FileDialog "OK" "C:/SPB_Data/${enabledGrp}.BOM" 1


    Finally, i reference the sample code "C:\Cadence\SPB_17.2\tools\capture\tclscripts\capCustomSamples\capGenerateBOM.tcl" to complete my job.Smile

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Reject Answer
    • Cancel
Children
No Data
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