• 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. Custom IC SKILL
  3. How to interactively copy a schematic fragment to a new...

Stats

  • Locked Locked
  • Replies 5
  • Subscribers 143
  • Views 2470
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to interactively copy a schematic fragment to a new schematic

SC202501092539
SC202501092539 7 months ago

Hi there,

I want to create a schematic containing useful schematic fragments - e.g. analogLib/vdc power supplies with gnds, CMOS differential pairs, who knows. I'd like to make a skill function that I can tie to a hot key that will copy the fragment (which will be defined by coordinates of a rectangle on the reference schematic) to the working schematic - but interactively. By this I mean that the fragment will be highlighted and follow the mouse and not be placed into the schematic until the user clicks somewhere.

Ideally I'd like the reference schematic to not need to open - but if it does for it to close again - or at least for them not to accumulate with multiple uses of the hot key.

Any idea how to approach this problem?

Thanks for any advice,

Simon

  • Cancel
  • ebecheto
    ebecheto 7 months ago

    i don't get it. You want to recode the interactive copy function bindkey 'c' .

    You can select and de-select element of your schematic with shift or control + DragSelection (Left mouse Button maintained down)

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett 7 months ago in reply to ebecheto

    I think the idea is that they want to avoid the selection of the source "fragment" and just do the interactive placement part.

    I have some ideas as to how this might be done, but I need to experiment first to see if it works.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • SC202501092539
    SC202501092539 7 months ago in reply to Andrew Beckett

    Thanks Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett 7 months ago in reply to SC202501092539

    Simon,

    I have something working. I just want to do a bit more testing and commenting of the code and hope to post it tomorrow.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett 7 months ago in reply to Andrew Beckett

    Hi SImon,

    Here's some SKILL++ code to do what (I think) you want. See the comments at the top for an explanation on how to use the functions.

    Regards,

    Andrew

    /* abSchHiCopyFromTemplate.ils
    
    Author     A.D.Beckett
    Group      Custom IC (UK), Cadence Design Systems Ltd.
    Language   SKILL++
    Date       Jan 10, 2025 
    Modified   
    By         
    
    Provides a mechanism to have a template schematic with fragments you
    can copy from with a bindkey. The template schematic is opened in an
    invisible window, and a function is provided to copy a region from that
    template schematic.
    
    Ensure that the file keeps its .ils suffix, as it uses SKILL++ semantics
    (there's a lexically scoped variable to keep track of the template window)
    
    The available functions:
    
    abSchHiCopyOpenTemplate("mylib" "mytemplate" "schematic")
    
      Opens the specific template (only one is opened at a time; the previous
      one is closed when new template is opened).
    
    abSchHiCloseTemplate()
    
      Close the current template cellView
    
    abSchHiCopyFromTemplate(boundingBox [refPoint])
    
      Copy the given rectangular area from the template cellView. You'll
      get a rubberbanded representation showing in the current window -
      click to finish the copy. The default reference point is the lower
      left of the bounding box
    
      To get the area, open the template in a normal schematic window, and use:
    
      box=enterBox() ; click twice for the extent of the selection box
      refPoint=enterPoint() ; click once for the reference point.
    
    abSchHiCopyCancel()
    
      Cancel the current copy (since escape doesn't work with a multi-window copy;
      you need to escape in the source window, and since that's invisible it's not
      possible with the usual escape key).
    
    Some example bindkeys (your coordinates will, of course, vary):
    
    hiSetBindKey("Schematics" "Shift<Key>C" 
      "abSchHiCopyFromTemplate('((2.25 -9.625) (8.125 -7.25)) '(3.75 -9.125))"
    )
    hiSetBindKey("Schematics" "ShiftCtrl<Key>C" 
      "abSchHiCopyFromTemplate('((-1.8125 -7.375) (5.5625 -2.0)) '(-0.375 -2.5625))"
    )
    hiSetBindKey("Schematics" "Shift<Key>EscapeEF" "abSchHiCopyCancel()")
    
    ***************************************************
    
    SCCS Info: @(#) abSchHiCopyFromTemplate.ils 01/10/25.16:49:55 1.1
    
    */
    
    let((templateWindow)
      /***************************************************************
      *                                                              *
      *   abSchHiCopyOpenTemplate(lib cell view @optional visible)   *
      *                                                              *
      *    Open a template cellView in an invisible window. There    *
      *    will be a very short flicker in IC23.1 ISR1 and later;    *
      * before that a slightly longer flicker. The optional visible  *
      * argument is for testing purposes so that the template window *
      *                         is visible.                          *
      *                                                              *
      ***************************************************************/
      globalProc(abSchHiCopyOpenTemplate(lib cell view @optional visible)
        abSchHiCopyCloseTemplate()
        templateWindow=hiCreateWindow(nil "graphics" "schematic")
        hiDisplayWindow(templateWindow)
        unless(visible
          hiUnmapWindow(templateWindow)
        )
        deOpen(
          list(nil 'libName lib 'cellName cell 'viewName view 'accessMode "r") 
          templateWindow
        )
        ; This is for IC23.1 ISR1 and earlier. deOpen forced an unmapped
        ; window to be mapped.
        unless(visible
          hiUnmapWindow(templateWindow)
        )
        t
      )
      /***************************************************************
      *                                                              *
      *                  abSchHiCopyCloseTemplate()                  *
      *                                                              *
      * Close the template (closes the associated invisible window)  *
      *                                                              *
      ***************************************************************/
      globalProc(abSchHiCopyCloseTemplate()
        when(windowp(templateWindow)
          hiCloseWindow(templateWindow)
        )
        templateWindow=nil
      )
      /*****************************************************************
      *                                                                *
      *        abSchHiCopyFromTemplate(bBox [refPoint [curWin])        *
      *                                                                *
      *    Copy from the template cellView using the given bounding    *
      * box as the selection area. The reference point defaults to the *
      * lower left of this box, unless the optional refPoint is given. *
      *       The current window defaults to the current window!       *
      *                                                                *
      *****************************************************************/
      globalProc(abSchHiCopyFromTemplate(bBox @optional refPoint (curWin hiGetCurrentWindow()))
        unless(windowp(templateWindow)
          error("Template has not been opened with abSchHiCopyOpenTemplate(lib cell view)\n")
        )
        hiSetCurrentWindow(templateWindow)
        ;--------------------------------------------------------------------
        ; coordinates for selection
        ;--------------------------------------------------------------------
        preXY(car(bBox))
        preXY(cadr(bBox))
        schSingleSelectBox()
        ;--------------------------------------------------------------------
        ; coordinate for reference point
        ;--------------------------------------------------------------------
        preXY(refPoint || car(bBox))
        hiEnqueueCmd(lsprintf("hiSetCurrentWindow(window(%d))" curWin->windowNum))
        ;--------------------------------------------------------------------
        ; Some messing around to ensure that if you have showOptionForms turned on,
        ; it doesn't do it in this case (it doesn't seem to be useful anyway).
        ; Temporarily turns off the showOptionsForms var
        ;--------------------------------------------------------------------
        let(((showOptionForms envGetVal("ui" "showOptionForms")))
          unwindProtect(
            {
              when(showOptionForms
                envSetVal("ui" "showOptionForms" 'boolean nil)
                hiEnqueueCmd("envSetVal(\"ui\" \"showOptionForms\" 'boolean t)")
              )
              schHiCopy()
            }
            ;----------------------------------------------------------------
            ; just in case, the unwind protect ensures it's restored
            ;----------------------------------------------------------------
            when(showOptionForms
              envSetVal("ui" "showOptionForms" 'boolean t)
            )
          )
        )
      )
      /*********************************************************************
      *                                                                    *
      *                    abSchHiCopyCancel([curWin])                     *
      *                                                                    *
      * Because the normal cancel (escape) doesn't work in the destination *
      *    window when using schHiCopy, this performs the cancel in the    *
      *   invisible source window. Could be bound to (say) shift-Escape    *
      *                                                                    *
      *********************************************************************/
      globalProc(abSchHiCopyCancel(@optional (curWin hiGetCurrentWindow()))
        when(windowp(templateWindow)
          hiSetCurrentWindow(templateWindow)
          cancelEnterFun()
          hiSetCurrentWindow(curWin)
          hiRedraw()
        )
      )
    )
    

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

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