• 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 open a .dsn file with tcl command?

Stats

  • State Verified Answer
  • Replies 10
  • Subscribers 13
  • Views 3453
  • Members are here 0
More Content

How to open a .dsn file with tcl command?

ZB202408042725
ZB202408042725 over 1 year ago

I notice that if I want to open a .dsn file(without .opj file), the cammand is like that : 

MenuCommand "57601"  | FileDialog  "OK" "D:/dsn/b.DSN" 2 | DialogBox  "OK" "D:/a.xml"

a.xml is complex file like this:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>

<DialogControls>

    <Control Type="EDIT" Enable="TRUE" Visible="TRUE" Id="15858">

        <Value><![CDATA[b]]></Value>

    </Control>

    <Control Type="AUTORADIO_BUTTON" Enable="FALSE" Visible="TRUE" Id="15880">

        <Value><![CDATA[0]]></Value>

        <Text><![CDATA[PSpicePWL]]></Text>

    </Control>

    <Control Type="AUTORADIO_BUTTON" Enable="FALSE" Visible="TRUE" Id="15881">

        <Value><![CDATA[1]]></Value>

        <Text><![CDATA[PSpiceAD]]></Text>

    </Control>

    <Control Type="EDIT" Enable="TRUE" Visible="TRUE" Id="15922">

        <Value><![CDATA[D:\dsn\]]></Value>

    </Control>

    <Control Type="PUSH_BUTTON" Enable="TRUE" Visible="TRUE" Id="1">

        <Value><![CDATA[OK]]></Value>

    </Control>

    <Control Type="PUSH_BUTTON" Enable="TRUE" Visible="TRUE" Id="2">

        <Value><![CDATA[Cancel]]></Value>

    </Control>

    <Control Type="PUSH_BUTTON" Enable="TRUE" Visible="TRUE" Id="57670">

        <Value><![CDATA[&Help]]></Value>

    </Control>

    <Control Type="AUTOCHECK_BOX" Enable="TRUE" Visible="TRUE" Id="15882">

        <Value><![CDATA[0]]></Value>

        <Text><![CDATA[Enable PSpice Simulation]]></Text>

    </Control>

</DialogControls>

However, when I run this cammand, it is no always work! Sometime the b.dsn is opened successfully, sometime fail and block in the DialogBox. Therefore I want to know how this cammand work? What's the meaning of DialogBox?

  • Sign in to reply
  • Cancel
Parents
  • ZB202408042725
    0 ZB202408042725 over 1 year ago

    By the way, I post the 2nd question here. I'm learning the OrCAD TCL Script. So I make a practice: place  port to all pins of a selected parts one by one, and connect the pin to the port. I will show my code below, the question is: when the script run, it occupy all my computer memory! I don't kown why this script need so much memory

    Here is my script(just for test, hence it is no elegant):

    set Inch 2.54
    set lStatus [DboState]
    set lInst [GetSelectedObjects]
    set PartX [expr [GetProperty {Location X-Coordinate}]/10*$Inch]
    set PartY [expr [GetProperty {Location Y-Coordinate}]/10*$Inch]
    set PartRef [GetProperty {Part Reference}]
    set lNullObj NULL
    set lIter [$lInst NewPinsIter $lStatus]
    set lPin [$lIter NextPin $lStatus]
    set lPinName [DboTclHelper_sMakeCString]
    set lPinNumber [DboTclHelper_sMakeCString]

    PlacePower [expr $PartX - 8*$Inch] [expr $PartY - 8*$Inch] "D:/Cadence/CandenceSPB17.4/Cadence/Cadence_SPB_17.4-2019/tools/capture/library/capsym.olb" "VCC_ARROW" "VCC"
    PlaceGround [expr $PartX + 38*$Inch] [expr $PartY + 38*$Inch] "D:/Cadence/CandenceSPB17.4/Cadence/Cadence_SPB_17.4-2019/tools/capture/library/capsym.olb" "GND_POWER" "GND"

    while {$lPin !=$lNullObj } {

        $lPin GetPinName $lPinName
        $lPin GetPinNumber $lPinNumber
        set PinName [DboTclHelper_sGetConstCharPtr $lPinName]
        set lStartPoint [$lPin GetStartPoint $lStatus]
        set lStartPointX [expr [DboTclHelper_sGetCPointX $lStartPoint]/10*$Inch]
        set lStartPointY [expr [DboTclHelper_sGetCPointY $lStartPoint]/10*$Inch]
        puts $lStartPointX
        puts $lStartPointY
        set lHotSpot [$lPin GetHotSpot $lStatus]
        set lHotSpotX [expr [DboTclHelper_sGetCPointX $lHotSpot]/10*$Inch]
        set lHotSpotY [expr [DboTclHelper_sGetCPointY $lHotSpot]/10*$Inch]
        set DelX [expr $lStartPointX-$lHotSpotX]
        set DelY [expr $lStartPointY-$lHotSpotY]

        if {$DelX > 0} {
            PlacePort [expr $PartX + $lStartPointX - 10*$Inch] [expr $PartY + $lStartPointY - $Inch] "D:/CADENCE/CANDENCESPB17.4/CADENCE/CADENCE_SPB_17.4-2019/TOOLS/CAPTURE/LIBRARY/CAPSYM.OLB" "PORTLEFT-R" $PinName
            PlaceWire [expr $PartX + $lStartPointX - 10*$Inch + 3*$Inch] [expr $PartY + $lStartPointY] [expr $PartX + $lStartPointX ] [expr $PartY + $lStartPointY]
        } elseif {$DelX < 0} {
            PlacePort [expr $PartX + $lStartPointX + 7*$Inch] [expr $PartY + $lStartPointY - $Inch] "D:/CADENCE/CANDENCESPB17.4/CADENCE/CADENCE_SPB_17.4-2019/TOOLS/CAPTURE/LIBRARY/CAPSYM.OLB" "PORTRIGHT-L" $PinName
            PlaceWire [expr $PartX + $lStartPointX + 7*$Inch ] [expr $PartY + $lStartPointY] [expr $PartX + $lStartPointX ] [expr $PartY + $lStartPointY]
        }
        puts [format "%s.%2s:%s" $PartRef [DboTclHelper_sGetConstCharPtr $lPinNumber] $PinName]

        unset PinName
        unset lStartPoint
        unset lStartPointX
        unset lStartPointY
        unset lHotSpot
        unset lHotSpotX
        unset lHotSpotY
        unset DelX
        unset DelY
        unset lPin
        #get the next pin of the part
        set lPin [$lIter NextPin $lStatus]
    }
    delete_DboPartInstPinsIter $lIter
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • CadAP
    0 CadAP over 1 year ago in reply to ZB202408042725

    Hi ZB202408042725,

    For opening design please try below command and do not provide any extra arguments:

    MenuCommand "57601"  | FileDialog  "OK" "D:/dsn/b.DSN" 2  ; # if opening .dsn

    MenuCommand "57601"  | FileDialog  "OK" "D:/dsn/b.opj" 1 ; # if opening .opj.

    Please try and let me know your observations.

    For second concern,

    Please try to check the time required by api to provide the information by using command time {<tcl_api/proc>}

    Also check if any other program does not overload the processors.

    Regards

    CadAP

                                                                    

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • ZB202408042725
    +1 ZB202408042725 over 1 year ago in reply to CadAP

    em, MenuCommand "57601"  | FileDialog  "OK" "D:/dsn/b.DSN" 2 ,this command return nothing, does it open the designed invisibly? I want to open the design just like what's happending when I click File->Open->Design and choose the design file as follow pic:

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Reject Answer
    • Cancel
  • CadAP
    0 CadAP over 1 year ago in reply to ZB202408042725

    Hi ZB202408042725,

    em, MenuCommand "57601"  | FileDialog  "OK" "D:/dsn/b.DSN" 2 ,this command return nothing, does it open the designed invisibly

    What do you mean by invisibly? Are you not able to see the design open in Orcad Capture canvas?

    I believe the FIle-->Open--> Design , we are using MenuCommandID

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • ZB202408042725
    0 ZB202408042725 over 1 year ago in reply to CadAP

    After the command :MenuCommand "57601"  | FileDialog  "OK" "D:/dsn/b.DSN"  had been executed, this is nothing like this pic:

    By the way ,the B.DSNlck is generated:

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • CadAP
    0 CadAP over 1 year ago in reply to ZB202408042725

    When manually try to open the same design (going to File-->Open-->Design), Are you able to Project manager opened in left side for Capture canvas?

    Or Project Manager window is floating?

    Regards

    CadAP

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • CadAP
    0 CadAP over 1 year ago in reply to ZB202408042725

    When manually try to open the same design (going to File-->Open-->Design), Are you able to Project manager opened in left side for Capture canvas?

    Or Project Manager window is floating?

    Regards

    CadAP

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
  • ZB202408042725
    0 ZB202408042725 over 1 year ago in reply to CadAP

    Manually open the same design, I need to choose the design file in a dialog windows:

    After choosing the design file and clicking the open, the Project manager will opened in left side for Capture canvas. But what I want is, one command line open the file automatically, no need to click anything

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • CadAP
    +1 CadAP over 1 year ago in reply to ZB202408042725

    Please try the below command:

    Menu "File::Open::Design" | FileDialog  "OK" "D:/dsn/b.DSN" 1

    Still not work, let me know your Orcad Capture version information

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Reject Answer
    • Cancel
  • ZB202408042725
    0 ZB202408042725 over 1 year ago in reply to CadAP

    Command doesn't work:

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • CadAP
    0 CadAP over 1 year ago in reply to ZB202408042725

    As per screenshot, you are on the base version of SPB17.4, which might have problems with running some commands.

    Please make sure you are on the latest SPB version for better tool performance and enhanced functions.

    Please update to the latest hotfix of SPB17.4 or download and install the latest version SPB23.1 hotfix 006.

    Once you have installed the latest hotfix for SPB, then try to run the tcl commands.

    Regards,

    CadAP

    • 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