• 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. Is it possible to have a "Copy and Paste" function like...

Stats

  • Locked Locked
  • Replies 9
  • Subscribers 143
  • Views 7699
  • 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

Is it possible to have a "Copy and Paste" function like the "Yank and Paste" ?

zeroskills
zeroskills over 15 years ago

Is it possible to have a "Copy and Paste" function like the "Yank and Paste"?

The Yank  function some what is a Copy function except it literaly "cut" what ever is drawn over by a selection box, if you select half of a device using Yank, you'll only get half of it.

Is it possible to have something like this:

- select devices, wires etc. either by selection box (dragging a mouse from 1 point to another) or by selecting individual or by group,

- then which ever you selected, you can "copy it" like a Yank, then you can paste it.

Some uses for it for exmaple:

I've done this with Yank and Paste but i don't know what origin it's using. instead of opening the contact window to instanciate a via, you can just copy a via then when you want a via, just paste it. yes, you can do it manually, select a via then copy, then copy etc. but would it be nice to just copy once then paste it endlessly? 

 

 

  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett over 15 years ago

    Here's the revised code. Now if you have promptRefPoint off (the default), it will still prompt you for a reference point if one is not set, so you won't get the stack trace. However, if you're not used to setting a reference point (you can see the current reference point by turning on Options->Editor->Display Reference Point, and the + key on the numeric keypad is normally bound to setting the reference point manually), you'll probably find it easier to continue turning promptRefPoint on as I suggested before.

    /* 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         Sep 17, 2009 
    
    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
    
    ; 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, but can also prompt
    ; for it
    abCopyPaste->setOption('promptRefPoint t)
    
    ***************************************************
    
    SCCS Info: @(#) abCopyPaste.ils 09/17/09.22:09:31 1.2
    
    */
    
    (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)
    	    (setq buffer 
    		  (dbOpenCellViewByType
    		    (or (arrayref options 'bufferLib)
    			(getq cv libName))
    		    (arrayref options 'bufferCell)
    		    (arrayref options 'bufferView)
    		    "maskLayout"
    		    "w"
    		    ))
    	    (unless buffer
    	      (error "Could not create copy buffer %s/%s/%s"
    		     (or (arrayref options 'bufferLib)
    			 (getq cv libName))
    		     (arrayref options 'bufferCell)
    		     (arrayref options 'bufferView)
    		     ))
    	    (setq refPoint
    		  (if (or (arrayref options 'promptRefPoint)
    			  (null (leGetRefPoint cv)))
    		    (enterPoint ?prompts 
    				(list "Point at the reference point for the copy:"))
    		    (leGetRefPoint cv)))
    	    (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)
    	    (when done
    	      (setq transform (list (car points) "R0" 1.0))
    	      (setq cv (geGetEditCellView wid))
    	      (setq buffer (dbOpenCellViewByType
    			     (or (arrayref options 'bufferLib)
    				 (getq cv libName))
    			     (arrayref options 'bufferCell)
    			     (arrayref options 'bufferView)
    			     "maskLayout"
    			     "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)
    		      (arrayref options '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
    

    Best Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Andrew Beckett
    Andrew Beckett over 15 years ago

    Here's the revised code. Now if you have promptRefPoint off (the default), it will still prompt you for a reference point if one is not set, so you won't get the stack trace. However, if you're not used to setting a reference point (you can see the current reference point by turning on Options->Editor->Display Reference Point, and the + key on the numeric keypad is normally bound to setting the reference point manually), you'll probably find it easier to continue turning promptRefPoint on as I suggested before.

    /* 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         Sep 17, 2009 
    
    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
    
    ; 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, but can also prompt
    ; for it
    abCopyPaste->setOption('promptRefPoint t)
    
    ***************************************************
    
    SCCS Info: @(#) abCopyPaste.ils 09/17/09.22:09:31 1.2
    
    */
    
    (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)
    	    (setq buffer 
    		  (dbOpenCellViewByType
    		    (or (arrayref options 'bufferLib)
    			(getq cv libName))
    		    (arrayref options 'bufferCell)
    		    (arrayref options 'bufferView)
    		    "maskLayout"
    		    "w"
    		    ))
    	    (unless buffer
    	      (error "Could not create copy buffer %s/%s/%s"
    		     (or (arrayref options 'bufferLib)
    			 (getq cv libName))
    		     (arrayref options 'bufferCell)
    		     (arrayref options 'bufferView)
    		     ))
    	    (setq refPoint
    		  (if (or (arrayref options 'promptRefPoint)
    			  (null (leGetRefPoint cv)))
    		    (enterPoint ?prompts 
    				(list "Point at the reference point for the copy:"))
    		    (leGetRefPoint cv)))
    	    (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)
    	    (when done
    	      (setq transform (list (car points) "R0" 1.0))
    	      (setq cv (geGetEditCellView wid))
    	      (setq buffer (dbOpenCellViewByType
    			     (or (arrayref options 'bufferLib)
    				 (getq cv libName))
    			     (arrayref options 'bufferCell)
    			     (arrayref options 'bufferView)
    			     "maskLayout"
    			     "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)
    		      (arrayref options '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
    

    Best Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

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