• 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. How to select a project and save it with Tcl Command

Stats

  • State Suggested Answer
  • Replies 15
  • Answers 1
  • Subscribers 12
  • Views 2624
  • Members are here 0
More Content

How to select a project and save it with Tcl Command

Morgan
Morgan 5 months ago

Hi friends of the community,

I want to use Tcl Command to select the last opened project name(or library) in capture cis, such as .dsn(.olb), and then, save and close it, but I encounter some troubles:

1.When I iter all open designs in the session with 3.2.5, it get the design name, but not listed in the order in which they were opened, so I can't find the last opened project; and sometimes, it listed the project name I have closed;

2.When I try to select the .dsn or .olb name use <ui::PMActivate "d:/cadence/work/test/mytest.opj"> and <SelectPMItem "./mytest.dsn">, and catch the error, it report errors with "RuntimeError Item Not Found" frequently. Is there any Tcl Command that implements this function?

3.When I save the project or library after modify with the code blow, It will pop up a window that needs to be confirmed, but I don't need the step, I want just save it directly.

#

#

# the code use this:


DboSession_MarkAllLibForSave $lLibSession $lDboLibrary
DboSession_SaveLib $lLibSession $lDboLibrary

#

#

# the confirm window like this:

  • Sign in to reply
  • Cancel
  • Morgan
    0 Morgan 5 months ago in reply to CadAP

    Hi CadAP, 

    I use V24.1, and open 5 dsn files.

    With your code, it just process the time minimum dsn file, if I modify variable lTimeIndex, such as "set lTimeIndex 3", the code always not work(can't switch to that dsn window), and if I add SelectPMItem "./$lDesignName" after ui::PMActivate, if always fail and print message:RuntimeError Item Not Found.

    The last few lines of code I modified were:

    #set lTimeIndex [lsearch $lDesignTime $lLastDesignTime]
    set lTimeIndex 3
    # puts $lTimeIndex
    set lDesignfromIndex [lindex $lDesignloc $lTimeIndex]
    # ui::PMActivate "$lDesignloc"
    set lDesgnLoc [split $lDesignfromIndex "\\"]
    set lDesignName [lindex $lDesgnLoc [expr { [llength $lDesgnLoc] - 1}]]

    if {$lDesignfromIndex != ""} {
    ui::PMActivate "$lDesignfromIndex"
    SelectPMItem "./$lDesignName"
    puts "/$lDesignName"

    catch the SelectPMItem message, print like this:

    So the issue is, can't process other dsn file name but the time minimum one, can you help me solve the problem?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • CadAP
    0 CadAP 5 months ago in reply to Morgan

    HI Morgan,

    Please dump list value "$lDesignloc", then check correct output is stored in the variable "lDesignfromIndex".

    Also check "lDesignName" variable is storing correct value.

    I think somewhere variable are messing up with the values.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • Morgan
    0 Morgan 5 months ago in reply to CadAP

    Hi CadAP, 

    When I puts this 3 variable, see command log as follows, Looks like nothing is wrong.

    Now "set lTimeIndex 4", get the dsn name T5.DSN, but Actually PMActivate the dsn file T3, and SelectPMItem it failed.

    #this is command log

    Capture> source [file normalize {G:/Cadence/Work/GetLastOpenedProject.tcl}]
    lDesignloc: {G:\CADENCE\WORK\TEST\T1.DSN} {G:\CADENCE\WORK\TEST\T2.DSN} {G:\CADENCE\WORK\TEST\T3.DSN} {G:\CADENCE\WORK\TEST\T4.DSN} {G:\CADENCE\WORK\TEST\T5.DSN}
    lDesgnLoc: G: CADENCE WORK TEST T5.DSN
    lDesignfromIndex: G:\CADENCE\WORK\TEST\T5.DSN
    lDesignName: T5.DSN

    Capture> ui::PMActivate "G:/CADENCE/WORK/TEST/T3.opj"
    Capture> [ 1]RuntimeError Item Not Found

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Morgan
    0 Morgan 5 months ago in reply to CadAP

    Hi CadAP,

    I puts this 3 variable, all the values look like not wrong.

    Now "set lTimeIndex 4", get the lDesignName T5.DSN, but Actually PMActivate file T3, and SelectPMItem failed.

    #the command log as below:

    Capture> source [file normalize {G:/Cadence/Work/GetLastOpenedProject.tcl}]
    lDesignloc: {G:\CADENCE\WORK\TEST\T1.DSN} {G:\CADENCE\WORK\TEST\T2.DSN} {G:\CADENCE\WORK\TEST\T3.DSN} {G:\CADENCE\WORK\TEST\T4.DSN} {G:\CADENCE\WORK\TEST\T5.DSN}
    lDesgnLoc: G: CADENCE WORK TEST T5.DSN
    lDesignfromIndex: G:\CADENCE\WORK\TEST\T5.DSN
    lDesignName: T5.DSN

    Capture> ui::PMActivate "G:/CADENCE/WORK/TEST/T3.opj"
    Capture> [ 1]RuntimeError Item Not Found

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Morgan
    0 Morgan 5 months ago in reply to CadAP

    Hi CadAP,

    I puts this 3 variable, all the values look like not wrong.

    Now "set lTimeIndex 4", get the lDesignName T5.DSN, but Actually PMActivate file T3, and SelectPMItem failed.

    #the command log as below:

    Capture> source [file normalize {G:/Cadence/Work/GetLastOpenedProject.tcl}]
    lDesignloc: {G:\CADENCE\WORK\TEST\T1.DSN} {G:\CADENCE\WORK\TEST\T2.DSN} {G:\CADENCE\WORK\TEST\T3.DSN} {G:\CADENCE\WORK\TEST\T4.DSN} {G:\CADENCE\WORK\TEST\T5.DSN}
    lDesgnLoc: G: CADENCE WORK TEST T5.DSN
    lDesignfromIndex: G:\CADENCE\WORK\TEST\T5.DSN
    lDesignName: T5.DSN

    Capture> ui::PMActivate "G:/CADENCE/WORK/TEST/T3.opj"
    Capture> [ 1]RuntimeError Item Not Found

    • 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