OK, here's the updated version that should work with schematics (sorry, ran out of time to do it the other day). If you define two bindkeys, one with abCopyPaste->copy() and another with abCopyPaste->paste() it will do what you want - if you have infix turned on, it won't prompt you for a reference point (you can control that separately for layout - see the comments at the top for details).
Andrew.
/* abCopyPaste.ils
Author A.D.Beckett
Group Custom IC (UK), Cadence Design Systems Ltd.
Language SKILL
Date Nov 24, 2008
Modified A.D.Beckett
By Dec 02, 2012
A package to copy and paste into a buffer (default lib/copyBuffer/copyBuffer
where lib is the same library you're working in). Smarter than yank/paste.
Updated in Dec 2012 to handle views other than layout.
; copy into buffer cellView
abCopyPaste->copy()
; paste from buffer cellView
abCopyPaste->paste()
; without this, the copyBuffer is in the same library as
; the cell being edited
abCopyPaste->setOption('bufferLib "mylib")
; normally uses the reference point (for layout), but can also prompt
; for it
abCopyPaste->setOption('promptRefPoint t)
***************************************************
SCCS Info: @(#) abCopyPaste.ils 12/02/12.15:25:04 1.3
*/
(importSkillVar abCopyPaste)
(setq abCopyPaste
(let (
(options (makeTable 'options nil))
(optionNames '(bufferLib bufferCell bufferView
promptRefPoint))
)
/***************************************************************
* *
* (setOption option value "sg") *
* *
* Exported function for setting an option for the copy/paste *
* package. Needs the name of the option and a value. The *
* name is checked to ensure it is a valid option name. *
* *
***************************************************************/
(defun setOption (option value "sg")
(if (memq option optionNames)
(setarray options option
(if (listp value) (copy value) value)
)
(error "Unrecognised option %L - must be one of %L\n"
option optionNames)
)
) ; defun setOption
/***************************************************************
* *
* (getOption @optional option) *
* *
* Exported function for getting the value of an option or a *
* list of the legal option names. *
* *
***************************************************************/
(defun getOption (@optional option)
(if option
(if (memq option optionNames)
(arrayref options option)
(error "Unrecognised option %L - must be one of %L\n"
option optionNames)
)
(sort (copy optionNames) 'alphalessp)
)
) ; defun getOption
/***************************************************************
* *
* (copyToBuf [cv]) *
* *
* Exported function to copy selected objects into a buffer *
* *
***************************************************************/
(defun copyToBuf (@optional (cv (geGetEditCellView)))
(let (buffer refPoint transform bufferView
(cellViewType (getq cv cellViewType)))
(setq bufferView
(strcat (arrayref options 'bufferView) "_" cellViewType))
(setq buffer
(dbOpenCellViewByType
(or (arrayref options 'bufferLib)
(getq cv libName))
(arrayref options 'bufferCell)
bufferView
cellViewType
"w"
))
(unless buffer
(error "Could not create copy buffer %s/%s/%s"
(or (arrayref options 'bufferLib)
(getq cv libName))
(arrayref options 'bufferCell)
bufferView
))
(setq refPoint
(if (or (arrayref options 'promptRefPoint)
(null (leGetRefPoint cv))
(nequal (getq cv cellViewType) "maskLayout"))
(enterPoint ?prompts
(list "Point at the reference point for the copy:"))
(leGetRefPoint cv)))
(when (equal (getq cv cellViewType) "maskLayout")
(leSetRefPoint cv refPoint))
(setq transform
(list (mapcar minus refPoint) "R0" 1.0))
(foreach fig (geGetSelectedSet cv)
(dbCopyFig fig buffer transform)
)
(dbSave buffer)
(dbClose buffer)
)
)
/***************************************************************
* *
* (paste) *
* *
* Exported function to paste buffer into cellView at prompted *
* point *
* *
***************************************************************/
(defun paste ()
(enterPoint ?prompts (list "Point at destination location:")
?doneProc "abCopyPaste->pasteDone"
)
t
)
/***************************************************************
* *
* (pasteDone wid done points) *
* *
* Exported function (used by enterFunction in (paste)) to *
* actually do the pasting. *
* *
***************************************************************/
(defun pasteDone (wid done points)
(let (transform cv buffer cellViewType bufferView)
(when done
(setq transform (list (car points) "R0" 1.0))
(setq cv (geGetEditCellView wid))
(setq cellViewType (getq cv cellViewType))
(setq bufferView
(strcat (arrayref options 'bufferView) "_" cellViewType))
(setq buffer (dbOpenCellViewByType
(or (arrayref options 'bufferLib)
(getq cv libName))
(arrayref options 'bufferCell)
bufferView
cellViewType
"r"
))
(if buffer
(progn
(foreach objs
(list
(getSGq buffer shapes)
(getSGq buffer instances)
(getSGq buffer vias)
(getSGq buffer figGroups)
(getSGq buffer mosaics)
(getSGq buffer blockages)
(getSGq buffer rows)
(getSGq buffer markers)
(getSGq buffer areaBoundaries)
(getSGq buffer guides)
(getSGq buffer routes)
(getSGq buffer steiners)
)
(foreach fig objs
(dbCopyFig fig cv transform)
) ; foreach fig
) ; foreach objs
(dbClose buffer)
)
(warn "Could not open copy buffer %s/%s/%s"
(or (arrayref options 'bufferLib)
(getq cv libName))
(arrayref options 'bufferCell)
bufferView
)
)
t
) ; when
) ; let
) ; defun pasteDone
;----------------------------------------------------------------
; Defaults
;----------------------------------------------------------------
(setarray options 'bufferLib nil)
(setarray options 'bufferCell "copyBuffer")
(setarray options 'bufferView "copyBuffer")
;----------------------------------------------------------------
; The DPL containing all the exported functions for the
; package
;----------------------------------------------------------------
(list nil
'setOption setOption
'getOption getOption
'copy copyToBuf
'paste paste
'pasteDone pasteDone
) ; list
) ; let
) ; setq abCopyPaste