• 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. Use Tcl command to "Generate BOM" with ASC

Stats

  • State Verified Answer
  • Replies 4
  • Subscribers 13
  • Views 479
  • Members are here 0
More Content

Use Tcl command to "Generate BOM" with ASC

Gelzone
Gelzone 1 month ago

Recently I try to use invokeBomHDL command to generate BOM but it just show the dialog box and not generate the BOM.

If I manually use: Tools -> Generate BOM -> Generate, it works well.

I have used similar way to generate BOM in the OrCAD (e.g. Menu "Tools::Bill of Materials" | DialogBox "OK" "~/Bill_of_Materials.xml") before and it worked well.

I wonder that if there is any way to generate BOM with tcl in ASC?

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

    Gelzone 

    Below is a sample tcl script to generate hdl bom using tcl from ASC.


    # Sample script to genarte bom

    set projectpath [ file dirname [pwd]]
    set projectcpm [ cps::getProjectCPM ]
    set projectcpm [ cps::getProjectMainCPM ]
    set projectDir [ cps::getProjectMainDir ]

    set projectName [ sch::dbGetRootDesignName ]

    set template "C:/Cadence/SPB_24.1/share/cdssetup/template.bom" ; #chnage if your using different PSB version.
    set delimeter {,}
    set reportFormat "CSV"
    set variantFile "variant.dat"
    set varinatCompare {}
    set varaintName {}
    puts $projectDir
    if {$reportFormat eq "HTML"} {


    set outfile "[file join $projectDir "output" $projectName]/bom/BOM.html"

    } else {set outfile "$projectDir/output/$projectName/bom/BOM.csv"}

    if {$varaintName != "NULL" || $varaintName != "" } {

    exec bomhdl.exe -proj $projectcpm -nographic -t $template -f $reportFormat -delim $delimeter -o $outfile -a NO -var $variantFile $varaintName

    }

    if {$varaintName == "NULL" || $varaintName == ""} {

    exec bomhdl.exe -proj $projectcpm -nographic -t $template -f $reportFormat -delim $delimeter -o $outfile -a NO

    }

    Please try and let me know your feedback.

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

    CadAP 

    Thanks it worked.

    But there is a little bug that if I first open the "Generate BOM" window and select the output format as HTML and close, and then I use your code to get the BOM (I will get a csv format if I don't change your code) which is a .csv extension but has a HTML content.

    Process: (Manually) Tools -> Generate BOM -> Report Format select HTML -> Close -> Run your code in the command window -> Get a .csv extension BOM but with HTML content

    ASC Ver. 23.1 S006

    Can you help me to figure it out?

    BTW if I change back to Spreadsheet Format manually, the output file get the correct result.

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

    Gelzone 

    Please use updated code, for reportFormat variable we have to select option from a list [ TEXT HTML SS], I used csv which is not a correct args.

    Now I have passed the correct args.

    # bomhdl.exe -proj <Project_File_Name> [-nographic] [-t <Template_File_Name>] [-f HTML | SS|TEXT] [-delim <delimeter>] [-o <outfile name>] [-a YES | NO] [-var <Variant_Database> [variant1 variant2...] [COMPARE] [ALL]]
    #Command to generate Bom with inputs.
    # Sample script to genarte bom

    set projectpath [ file dirname [pwd]]
    # set projectcpm [ cps::getProjectCPM ]
    set projectcpm [ cps::getProjectMainCPM ]
    set projectDir [ cps::getProjectMainDir ]
    # set project [file join $projectpath $projectcpm]
    # set projectName [string range $projectcpm 0 [expr [string last "." $projectcpm] - 1]]
    set projectName [ sch::dbGetRootDesignName ]


    # puts "projectpath: = [join "$projectpath" "ouput" "$projectName" "/"] "
    # puts "projectcpm: =$projectcpm"
    # puts "projectName: =$project"
    # puts "projectName: =$projectName"


    set template "C:/Cadence/SPB_24.1/share/cdssetup/template.bom"
    set delimeter {,}
    set reportFormat "SS" ;#report value [TEXT][HTML][SS]
    set variantFile "variant.dat"
    set varinatCompare {}
    set varaintName {}
    # puts $projectDir
    if {$reportFormat eq "HTML"} {


    set outfile "[file join $projectDir "output" $projectName]/bom/BOM.html"

    } else {set outfile "$projectDir/output/$projectName/bom/BOM.csv"}

    if {$varaintName != "NULL" || $varaintName != "" } {

    exec bomhdl.exe -proj $projectcpm -nographic -t $template -f $reportFormat -delim $delimeter -o $outfile -a NO -var $variantFile $varaintName

    }

    if {$varaintName == "NULL" || $varaintName == ""} {

    exec bomhdl.exe -proj $projectcpm -nographic -t $template -f $reportFormat -delim $delimeter -o $outfile -a NO

    }

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

    CadAP 

    It got the right result thanks.

    I wonder how to find such information associated with ASC but not show in the "C:\Cadence\SPB_23.1\doc\scap_tcl_comms\scap_tcl_commsTOC.html"?

    I found the commands related to HDL but unfortunately I have not used it before.

    • 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