• 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. Copy / Duplicate Pages within a .DSN in Orcad Using TCL

Stats

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

Copy / Duplicate Pages within a .DSN in Orcad Using TCL

Henry Monro
Henry Monro over 1 year ago

set page_present no
foreach item $pages_names {
# Check if the string matches the current element
if {$item!=NULL} {
set lPageName [DboTclHelper_sMakeCString $item]
set lPage1 [$lSchematic GetPage $lPageName $lStatus]
if {$lPage == $lPage1} {
set page_present yes
}
}
}

if {$page_present!="no"} {

####
Help me Here ==>> COPY/DUPLICATE page multiple times within a same DSN with a unique name depends upon the iterations like pageabc_1, pageabc_2, pageabc3...

####

}

Thanks in Advance

  • Sign in to reply
  • Cancel
  • CadAP
    0 CadAP over 1 year ago


    #Just giving an sample code how you can copy paste a selected page. You can create your own code with different page name using iteration.

    set dir [file dirname [info script]]
    set file [open "test.xml" a+]

    if {$page_present!="no"} {

    set pagenumber "10"
    set dir [file dirname [info script]]
    set file [open "$dir/test.xml" a+]

    puts $file {<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    <DialogControls>
    <Control Type="EDIT" Enable="TRUE" Visible="TRUE" Id="2377"> }
    puts $file "<Value><!\[CDATA\[$pagenumber\]\]></Value>"
    puts $file {</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>
    </DialogControls>}

    close $file

    SelectPMItem "SCHEMATIC1/PAGE2" ; #Itertate over page and select the required page for copy.I am manually selecting page for now.

    Menu "Edit::Copy ; #Command to Copy the selected Page

    SelectPMItem "SCHEMATIC1" ;# Now select the schematic under which you want to add page.I am manually selecting schematic for now.

    #Below command will paste the copy page with page number 10

    Capture> Menu "Edit::Paste" | DialogBox "OK" "$dir/"test.xml"


    }

    Hope this helps!

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

    It seems these are the capture commands for copy-pasting that you just mentioned. Isn't there a way to accomplish this using TCL commands? For instance, does a command like 'delete page' exist for copy pasting page, such as in set del_page [$lSchematic DeletePage $lPage] ?

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • tennywhy
    0 tennywhy 11 months ago in reply to CadAP

    hi CadAP how can i rename schematic name and page name ? i have tried all rename command below

             DboSchematic_Rename
             CISDesign_RenameScheamtic
             CISSchematic_RenameScheamticPage
    but it dont work, could you give me some examples ? thanks
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • CadAP
    0 CadAP 11 months ago in reply to tennywhy

    HI tennywhy,

    Tye using $pSchemticObj SetName $lSchiNewNameCString -->schematic rename and $pPageObj SetName $lPageNewNameCString-->Page rename.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • tennywhy
    0 tennywhy 11 months ago in reply to CadAP

    thanks sir. I did the test as you instructed, but I ran into two other issues, the first, The schematics name is not refreshed after the name is changed.,You have to reopen the file to see the new name. The second is that the rename is invalid for the page., my code as below, help me please. 

    proc renameTest { } {
        set TRUE 1
        set FALSE 0
        set lStatus [DboState]
        set lSession $::DboSession_s_pDboSession
            DboSession -this $lSession
        set lNullObj ""
        set lDesign [$lSession GetActiveDesign]
        if { $lDesign == $lNullObj} {
            puts "Active design not found"]
            return
        }
        #get schematic and rename
            set lSchematicIter [$lDesign NewViewsIter $lStatus $::IterDefs_SCHEMATICS]
            set lView [$lSchematicIter NextView  $lStatus]
            set lNullObj NULL
            set i 0
            while { $lView != $lNullObj} {
                set lSchematic [DboViewToDboSchematic $lView]
                #get pages and rename
                    set lPagesIter [$lSchematic NewPagesIter $lStatus]
                    #get the first page
                    set lPage [$lPagesIter NextPage $lStatus]
                    set j 0
                    while {$lPage!=$lNullObj} {
                        #placeholder: do your processing on $lPage
                        set pgNamC [DboTclHelper_sMakeCString]
                        $lPage GetName $pgNamC
                        set pgNamS [DboTclHelper_sGetConstCharPtr $pgNamC]
                        #rename pages
                        set pgNewC [DboTclHelper_sMakeCString "pg_test$j"]
                        show "lPage $lPage $pgNamS $pgNewC"
                        # rename cant work for pages
                        $lPage SetName $pgNewC
                        set lPage [$lPagesIter NextPage $lStatus]
                        incr j
                    }
                    delete_DboSchematicPagesIter $lPagesIter
                #end rename pages
                set schNewC [DboTclHelper_sMakeCString "sch_test$i"]
                # $lSchematic SetName $schNewC
                set lView [$lSchematicIter NextView $lStatus]
                incr i
            }
        #end rename schematics
            delete_DboLibViewsIter $lSchematicIter
        $lStatus -delete
    }
    thanks advance
    • 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