Cell lock script needed.

C

cadman

Guest
Hello,
This is a case where we would like to lock down a particular cell
within a design to prevent this from being
moved accidentally (IE : Padring) during editing the layout in
Virtuoso XL/LE.
Thankyou in advance for any help here.
Regards,
Dave (cadman)
 
Hi cadman,

To lock particular cell in the design, you may set the protection
mode.
This will unable user to select/move/delete the protected objects.

Please refer to the script below, its written by Andrew Beckett
( Great guru )

/* abProtect.ils

Author A.D.Beckett
Group Custom IC (UK), Cadence Design Systems Ltd.
Language SKILL
Date Nov 14, 2008
Modified Nov 19, 2008
By A.D.Beckett

Package for implementing a protection mechanism for
layout. The idea is that you can protect objects, and
consequently they are then not selectable.

For example:

; initialize the system
abProtect->init()

; protect the selected objects
abProtect->protectSelected()

; turn off protection mode so everything is
; selectable (t to turn back on)
abProtect->setOption('protectMode nil)

; select all the protected things
abProtect->selectProtected()

; unprotect all the selected objects (have
; to turn off protect mode first, or use selectProtected)
abProtect->unprotectSelected()

; unprotect everything
abProtect->unprotectAll()

; protect everything in a named group
abProtect->protectGroup("groupName")
abProtect->unprotectGroup("groupName")

; hilight the protected objects
abProtect->hilight()
; and unhilight them
abProtect->unhilight()

; using abSelectObjByName code, prompt user to pick
; a figGroup to be protected
abSelectObjByName('figGroups geGetEditCellView() abProtect-
protectObj)
; and to unprotect
abSelectObjByName('figGroups geGetEditCellView() abProtect-
unprotectObj)
; using an alternative select filter registration
; function - e.g. from abLeMultiSelectionFilter.ils
; must be done before init. This allows additional filters to be
; defined
abProtect->setOption('regSelectionFilter
'abLeRegUserObjectSelectionFilter)
abProtect->init()

***************************************************

SCCS Info: @(#) abProtect.ils 12/02/08.13:05:00 1.4

*/

(importSkillVar abProtect)
(setq abProtect
(let (
(options (makeTable 'options nil))
(optionNames '(protectMode
deselectAfterProtect hilightLPP
hilightHalo
haloPosition haloType haloThickness
haloTransparency haloDrawStroke
regSelectionFilter))
)
/***************************************************************
* *
* (setOption option value "sg") *
* *
* Exported function for setting an option for the protect *
* 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
/***************************************************************
* *
* (protectSelected [wid]) *
* *
* Exported function for protecting the selected figures *
* in the specified (or current) window. *
* *
***************************************************************/
(defun protectSelected (@optional (wid (hiGetCurrentWindow)))
(setSGq (geGetSelSet wid) t protected)
;--------------------------------------------------------------
; Deselect if the preference has been set
;--------------------------------------------------------------
(when (arrayref options 'deselectAfterProtect)
(geDeselectAll wid)
)
t
) ; defun protectSelected
/***************************************************************
* *
* (protectGroup name [wid]) *
* *
* Exported function to protect a group (figGroup) given *
* the name. *
* *
***************************************************************/
(defun protectGroup (name @optional (wid (hiGetCurrentWindow)))
(let (theFigGroup)
(setq theFigGroup
(dbGetFigGroupByName (geGetEditCellView wid) name))
(when theFigGroup
(putpropq theFigGroup t protected)
)
) ; let
) ; defun protectGroup
/***************************************************************
* *
* (unprotectGroup name [wid]) *
* *
* Unprotect a group, given its name *
* *
***************************************************************/
(defun unprotectGroup (name @optional (wid (hiGetCurrentWindow)))
(let (theFigGroup)
(setq theFigGroup
(dbGetFigGroupByName (geGetEditCellView wid) name))
(when theFigGroup
(dbDeletePropByName theFigGroup "protected")
)
) ; let
) ; defun unprotectGroup
/***************************************************************
* *
* (protectObj d_obj) *
* *
* Given an object, protect it. *
* *
***************************************************************/
(defun protectObj (obj "d")
(putpropq obj t protected)
)
/***************************************************************
* *
* (unprotectObj d_obj) *
* *
* Given an object, unprotect it. *
* *
***************************************************************/
(defun unprotectObj (obj "d")
(dbDeletePropByName obj "protected")
)
/***************************************************************
* *
* (unprotectSelected [wid]) *
* *
* Exported function to unprotect the selected objects. Of *
* course, you need to select them first, so probably need *
* to either turn off the protectMode, or select the protected *
* items using selectProtected() *
* *
***************************************************************/
(defun unprotectSelected (@optional (wid (hiGetCurrentWindow)))
(foreach fig (geGetSelSet wid)
(dbDeletePropByName fig "protected")
)
t) ; defun unprotectSelected
/***************************************************************
* *
* (operateOnAllObjects cv func) *
* *
* Internal function to apply a specified function to all *
* objects. This avoids having to replicated this iteration *
* in lots of places. *
* *
***************************************************************/
(defun operateOnAllObjects (cv func)
(foreach objs
(list
(getSGq cv shapes)
(getSGq cv instances)
(getSGq cv vias)
(getSGq cv figGroups)
(getSGq cv mosaics)
(getSGq cv blockages)
(getSGq cv rows)
(getSGq cv markers)
(getSGq cv areaBoundaries)
(getSGq cv guides)
(getSGq cv routes)
(getSGq cv steiners)
(list (getq cv prBoundary))
(list (getq cv snapBoundary))
)
(foreach fig objs
(func fig)
)
)
) ; defun operateOnAllObjects
/***************************************************************
* *
* (selectProtected [wid]) *
* *
* External function to select all the protected objects *
* *
***************************************************************/
(defun selectProtected (@optional (wid (hiGetCurrentWindow)))
(let (cv (protectMode (arrayref options 'protectMode)))
(setq cv (geGetEditCellView wid))
;------------------------------------------------------------
; Temporarily suspend the protect mode
;------------------------------------------------------------
(setarray options 'protectMode nil)
(operateOnAllObjects cv
(lambda (fig)
(when (getq fig protected)
(geSelectFig fig)
)
)
)
;------------------------------------------------------------
; And then turn it back on (if on previously)
;------------------------------------------------------------
(setarray options 'protectMode protectMode)
)
) ; defun selectProtected
/***************************************************************
* *
* (unprotectAll [wid]) *
* *
* External function to unprotect everything *
* *
***************************************************************/
(defun unprotectAll (@optional (wid (hiGetCurrentWindow)))
(let (cv (protectMode (arrayref options 'protectMode)))
(setq cv (geGetEditCellView wid))
(setarray options 'protectMode nil)
(errset
(operateOnAllObjects cv
(lambda (fig)
(dbDeletePropByName fig "protected")
)
)
)
(setarray options 'protectMode protectMode)
)
) ; defun unprotectAll
/***************************************************************
* *
* (unhilight [wid]) *
* *
* External function to unhilight the protected objects *
* *
***************************************************************/
(defun unhilight (@optional (wid (hiGetCurrentWindow)))
(let (hs)
(setq hs (getq wid protectHilightSet))
(when (geIsValidHilightSet hs) (geDeleteHilightSet hs))
t
)
)
/***************************************************************
* *
* (hilight [wid]) *
* *
* External function to hilight (with Halos if desired) the *
* protected objects *
* *
***************************************************************/
(defun hilight (@optional (wid (hiGetCurrentWindow)))
(let (hs cv)
(unhilight)
(setq cv (geGetEditCellView wid))
(setq hs (geCreateHilightSet cv (arrayref options 'hilightLPP)))
(operateOnAllObjects cv
(lambda (fig)
(when (getq fig protected)
(geAddHilightRectangle hs
(getq fig bBox))
)
)
)
(when (and
(isCallable 'geSetHilightSetHaloParameters)
(arrayref options 'hilightHalo)
)
(geSetHilightSetHaloParameters
hs
(arrayref options 'haloPosition)
(arrayref options 'haloType)
(arrayref options 'haloThickness)
(arrayref options 'haloTransparency)
(arrayref options 'haloDrawStroke)
))
(putpropq hs t enable)
(putpropq wid hs protectHilightSet)
t
)
) ; defun hilight
/***************************************************************
* *
* (selectFilter fig) *
* *
* Function, exported as abProtectSelectFilter, which is *
* registered as the selection filter function. This is called *
* for each object to determine whether it is selectable. *
* *
***************************************************************/
(defun selectFilter (fig)
(cond
((null (arrayref options 'protectMode)) t)
((getq fig protected) nil)
(t t)
)
) ; defun selectFilter
/***************************************************************
* *
* (init) *
* *
* Exported function to initialize the protect system. *
* *
***************************************************************/
(defun init ()
(funcall
(arrayref options 'regSelectionFilter)
"abProtectSelectFilter")
) ; defun init
;----------------------------------------------------------------
; Export the select filter
;----------------------------------------------------------------
(setq abProtectSelectFilter selectFilter)
;----------------------------------------------------------------
; Defaults
;----------------------------------------------------------------
(setarray options 'protectMode t)
(setarray options 'hilightLPP '("y0" "drawing"))
(setarray options 'hilightHalo t)
(setarray options 'haloPosition "over")
(setarray options 'haloType "plain")
(setarray options 'haloThickness "normal")
(setarray options 'haloTransparency 50)
(setarray options 'haloDrawStroke t)
(setarray options 'regSelectionFilter
'leRegUserObjectSelectionFilter)
;----------------------------------------------------------------
; The DPL containing all the exported functions for the
; package
;----------------------------------------------------------------
(list nil
'setOption setOption
'getOption getOption
'protectSelected protectSelected
'unprotectSelected unprotectSelected
'selectProtected selectProtected
'unprotectAll unprotectAll
'protectGroup protectGroup
'unprotectGroup unprotectGroup
'protectObj protectObj
'unprotectObj unprotectObj
'hilight hilight
'unhilight unhilight
'init init
) ; list
) ; let
) ; setq abProtect


Regards,
How
 
On May 19, 9:37 pm, "KB.How" <kianboon....@gmail.com> wrote:
Hi cadman,

To lock particular cell in the design, you may set the protection
mode.
This will unable user to select/move/delete the protected objects.

Please refer to the script below, its written by Andrew Beckett
( Great guru )

/* abProtect.ils

Author     A.D.Beckett
Group      Custom IC (UK), Cadence Design Systems Ltd.
Language   SKILL
Date       Nov 14, 2008
Modified   Nov 19, 2008
By         A.D.Beckett

Package for implementing a protection mechanism for
layout. The idea is that you can protect objects, and
consequently they are then not selectable.

For example:

; initialize the system
abProtect->init()

; protect the selected objects
abProtect->protectSelected()

; turn off protection mode so everything is
; selectable (t to turn back on)
abProtect->setOption('protectMode nil)

; select all the protected things
abProtect->selectProtected()

; unprotect all the selected objects (have
; to turn off protect mode first, or use selectProtected)
abProtect->unprotectSelected()

; unprotect everything
abProtect->unprotectAll()

; protect everything in a named group
abProtect->protectGroup("groupName")
abProtect->unprotectGroup("groupName")

; hilight the protected objects
abProtect->hilight()
; and unhilight them
abProtect->unhilight()

; using abSelectObjByName code, prompt user to pick
; a figGroup to be protected
abSelectObjByName('figGroups geGetEditCellView() abProtect->protectObj)

; and to unprotect
abSelectObjByName('figGroups geGetEditCellView() abProtect-

unprotectObj)

; using an alternative select filter registration
; function - e.g. from abLeMultiSelectionFilter.ils
; must be done before init. This allows additional filters to be
; defined
abProtect->setOption('regSelectionFilter
'abLeRegUserObjectSelectionFilter)
abProtect->init()

***************************************************

SCCS Info: @(#) abProtect.ils 12/02/08.13:05:00 1.4

*/

(importSkillVar abProtect)
(setq abProtect
      (let (
            (options (makeTable 'options nil))
            (optionNames '(protectMode
                            deselectAfterProtect hilightLPP
                            hilightHalo
                            haloPosition haloType haloThickness
                            haloTransparency haloDrawStroke
                            regSelectionFilter))
            )
        /***************************************************************
        *                                                              *
        *                (setOption option value "sg")                 *
        *                                                              *
        *   Exported function for setting an option for the protect    *
        *    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
        /***************************************************************
        *                                                              *
        *                   (protectSelected [wid])                    *
        *                                                              *
        *    Exported function for protecting the selected figures     *
        *            in the specified (or current) window.             *
        *                                                              *
        ***************************************************************/
        (defun protectSelected (@optional (wid (hiGetCurrentWindow)))
          (setSGq (geGetSelSet wid) t protected)
          ;--------------------------------------------------------------
          ; Deselect if the preference has been set
          ;--------------------------------------------------------------
          (when (arrayref options 'deselectAfterProtect)
            (geDeselectAll wid)
            )
          t
          ) ; defun protectSelected
        /***************************************************************
        *                                                              *
        *                  (protectGroup name [wid])                   *
        *                                                              *
        *    Exported function to protect a group (figGroup) given     *
        *                          the name.                           *
        *                                                              *
        ***************************************************************/
        (defun protectGroup (name @optional (wid (hiGetCurrentWindow)))
          (let (theFigGroup)
            (setq theFigGroup
                  (dbGetFigGroupByName (geGetEditCellView wid) name))
            (when theFigGroup
              (putpropq theFigGroup t protected)
              )
            ) ; let
          ) ; defun protectGroup
        /***************************************************************
        *                                                              *
        *                 (unprotectGroup name [wid])                  *
        *                                                              *
        *              Unprotect a group, given its name               *
        *                                                              *
        ***************************************************************/
        (defun unprotectGroup (name @optional (wid (hiGetCurrentWindow)))
          (let (theFigGroup)
            (setq theFigGroup
                  (dbGetFigGroupByName (geGetEditCellView wid) name))
            (when theFigGroup
              (dbDeletePropByName theFigGroup "protected")
              )
            ) ; let
          ) ; defun unprotectGroup
        /***************************************************************
        *                                                              *
        *                     (protectObj d_obj)                       *
        *                                                              *
        *                 Given an object, protect it.                 *
        *                                                              *
        ***************************************************************/
        (defun protectObj (obj "d")
          (putpropq obj t protected)
          )
        /***************************************************************
        *                                                              *
        *                     (unprotectObj d_obj)                     *
        *                                                              *
        *                Given an object, unprotect it.                *
        *                                                              *
        ***************************************************************/
        (defun unprotectObj (obj "d")
          (dbDeletePropByName obj "protected")
          )
        /***************************************************************
        *                                                              *
        *                  (unprotectSelected [wid])                   *
        *                                                              *
        *   Exported function to unprotect the selected objects. Of    *
        *   course, you need to select them first, so probably need    *
        * to either turn off the protectMode, or select the protected  *
        *                items using selectProtected()                 *
        *                                                              *
        ***************************************************************/
        (defun unprotectSelected (@optional (wid (hiGetCurrentWindow)))
          (foreach fig (geGetSelSet wid)
                   (dbDeletePropByName fig "protected")
                   )
          t) ; defun unprotectSelected
        /***************************************************************
        *                                                              *
        *                (operateOnAllObjects cv func)                 *
        *                                                              *
        *    Internal function to apply a specified function to all    *
        *   objects. This avoids having to replicated this iteration   *
        *                      in lots of places.                      *
        *                                                              *
        ***************************************************************/
        (defun operateOnAllObjects (cv func)
          (foreach objs
                   (list
                     (getSGq cv shapes)
                     (getSGq cv instances)
                     (getSGq cv vias)
                     (getSGq cv figGroups)
                     (getSGq cv mosaics)
                     (getSGq cv blockages)
                     (getSGq cv rows)
                     (getSGq cv markers)
                     (getSGq cv areaBoundaries)
                     (getSGq cv guides)
                     (getSGq cv routes)
                     (getSGq cv steiners)
                     (list (getq cv prBoundary))
                     (list (getq cv snapBoundary))
                     )
                   (foreach fig objs
                            (func fig)
                            )
                   )
          ) ; defun operateOnAllObjects
        /***************************************************************
        *                                                              *
        *                   (selectProtected [wid])                    *
        *                                                              *
        *    External function to select all the protected objects     *
        *                                                              *
        ***************************************************************/
        (defun selectProtected (@optional (wid (hiGetCurrentWindow)))
          (let (cv (protectMode (arrayref options 'protectMode)))
            (setq cv (geGetEditCellView wid))
            ;------------------------------------------------------------
            ; Temporarily suspend the protect mode
            ;------------------------------------------------------------
            (setarray options 'protectMode nil)
            (operateOnAllObjects cv
                                 (lambda (fig)
                                   (when (getq fig protected)
                                     (geSelectFig fig)
                                     )
                                   )
                                 )
            ;------------------------------------------------------------
            ; And then turn it back on (if on previously)
            ;------------------------------------------------------------
            (setarray options 'protectMode protectMode)
            )
          ) ; defun selectProtected
        /***************************************************************
        *                                                              *
        *                     (unprotectAll [wid])                     *
        *                                                              *
        *          External function to unprotect everything           *
        *                                                              *
        ***************************************************************/
        (defun unprotectAll (@optional (wid (hiGetCurrentWindow)))
          (let (cv (protectMode (arrayref options 'protectMode)))
            (setq cv (geGetEditCellView wid))
            (setarray options 'protectMode nil)
            (errset
              (operateOnAllObjects cv
                                   (lambda (fig)
                                     (dbDeletePropByName fig "protected")
                                     )
                                   )
              )
            (setarray options 'protectMode protectMode)
            )
          ) ; defun unprotectAll
        /***************************************************************
        *                                                              *
        *                      (unhilight [wid])                       *
        *                                                              *
        *     External function to unhilight the protected objects     *
        *                                                              *
        ***************************************************************/
        (defun unhilight (@optional (wid (hiGetCurrentWindow)))
          (let (hs)
            (setq hs (getq wid protectHilightSet))
            (when (geIsValidHilightSet hs) (geDeleteHilightSet hs))
            t
            )
          )
        /***************************************************************
        *                                                              *
        *                       (hilight [wid])                        *
        *                                                              *
        *   External function to hilight (with Halos if desired) the   *
        *                      protected objects                       *
        *                                                              *
        ***************************************************************/
        (defun hilight (@optional (wid (hiGetCurrentWindow)))
          (let (hs cv)
            (unhilight)
            (setq cv (geGetEditCellView wid))
            (setq hs (geCreateHilightSet cv (arrayref options 'hilightLPP)))
            (operateOnAllObjects cv
                                 (lambda (fig)
                                   (when (getq fig protected)
                                     (geAddHilightRectangle hs
                                                            (getq fig bBox))
                                     )
                                   )
                                 )
            (when (and
                    (isCallable 'geSetHilightSetHaloParameters)
                    (arrayref options 'hilightHalo)
                    )
              (geSetHilightSetHaloParameters
                hs
                (arrayref options 'haloPosition)
                (arrayref options 'haloType)
                (arrayref options 'haloThickness)
                (arrayref options 'haloTransparency)
                (arrayref options 'haloDrawStroke)
                ))
            (putpropq hs t enable)
            (putpropq wid hs protectHilightSet)
            t
            )
          ) ; defun hilight
        /***************************************************************
        *                                                              *
        *                      (selectFilter fig)                      *
        *                                                              *
        *    Function, exported as abProtectSelectFilter, which is     *
        * registered as the selection filter function. This is called  *
        *    for each object to determine whether it is selectable.    *
        *                                                              *
        ***************************************************************/
        (defun selectFilter (fig)
          (cond
            ((null (arrayref options 'protectMode)) t)
            ((getq fig protected) nil)
            (t t)
            )
          ) ; defun selectFilter
        /***************************************************************
        *                                                              *
        *                            (init)                            *
        *                                                              *
        *     Exported function to initialize the protect system.      *
        *                                                              *
        ***************************************************************/
        (defun init ()
          (funcall
            (arrayref options 'regSelectionFilter)
            "abProtectSelectFilter")
          ) ; defun init
        ;----------------------------------------------------------------
        ; Export the select filter
        ;----------------------------------------------------------------
        (setq abProtectSelectFilter selectFilter)
        ;----------------------------------------------------------------
        ; Defaults
        ;----------------------------------------------------------------
        (setarray options 'protectMode t)
        (setarray options 'hilightLPP '("y0" "drawing"))
        (setarray options 'hilightHalo t)
        (setarray options 'haloPosition "over")
        (setarray options 'haloType "plain")
        (setarray options 'haloThickness "normal")
        (setarray options 'haloTransparency 50)
        (setarray options 'haloDrawStroke t)
        (setarray options 'regSelectionFilter
'leRegUserObjectSelectionFilter)
        ;----------------------------------------------------------------
        ; The DPL containing all the exported functions for the
        ; package
        ;----------------------------------------------------------------
        (list nil
          'setOption setOption
          'getOption getOption
          'protectSelected protectSelected
          'unprotectSelected unprotectSelected
          'selectProtected selectProtected
          'unprotectAll unprotectAll
          'protectGroup protectGroup
          'unprotectGroup unprotectGroup
          'protectObj protectObj
          'unprotectObj unprotectObj
          'hilight hilight
          'unhilight unhilight
          'init init
          ) ; list
        ) ; let
      ) ; setq abProtect

Regards,
How
Thanks again for your help here !! I hope that I can return the favor
someday.
Best regards How !!

cadman (Dave)
 

Welcome to EDABoard.com

Sponsor

Back
Top