Reg copy of selected objects to the current cellview

Discussion in 'Cadence' started by noreply, Jul 28, 2009.

  1. noreply

    noreply Guest

    Dear All,
    I have made one half of a symmetrical layout with all net connection
    and pin names. And i want to create the other symmetrical half using
    copy command with "R180" rotation(And i want to copy it in the same
    cellview. I tried the dbCopyFig() command but since there where many
    objects the command wasn't properly working).
    How to do this using skill.
    When i tried to do this using interactive mode, some of the objects in
    the layout got disoriented when i did the 180 degree rotation. How to
    go about it?

    Regards,
    Lokesh rajendran.
     
    noreply, Jul 28, 2009
    #1
  2. noreply wrote, on 07/28/09 12:10:
    Lokesh,

    My guess is that you're not computing the transformation properly.

    This code may help. It's written to work on the selected set, but it would be a
    simple modification to pass in the list of figures to process. It can either
    move or copy during the flip (or rotate).

    I think there are a couple of strings (in the (error...) calls) which may have
    got line wrapped - so watch out.

    Regards,

    Andrew.


    /* abFlip.il

    Author A.D.Beckett
    Group Custom IC (UK), Cadence Design Systems Ltd.
    Language SKILL
    Date Jun 22, 2005
    Modified
    By

    Functions to do flipping (and rotation) in place. Examples
    of usage:

    abFlip()
    - does a flip horizontally relative to the centre of the selected figures
    abFlip(?relativeTo 'lowerLeft)
    - does a horizontal flip relative to the lower left corner
    abFlip(?orient "MX" ?relativeTo 'upperRight)
    - does a vertical flip relative to the upperRight corner
    abFlip(?orient "MY" ?relativeTo 'upperRight ?mode 'copy)
    - does a horizontal flipped copy relative to the upperRight corner
    abFlip(?orient "R90" ?relativeTo 'refPoint)
    - does a 90 degree rotation relative to the reference point (often
    the + key on the numeric keypad).

    In this function:

    ?orient can be set to:

    "MY" - mirror in Y axis (i.e. horizontal flip) (default)
    "MX" - mirror in X axis (i.e. vertical flip)
    "R90" - 90 degree anti-clockwise rotate
    "R180" - 180 degree anti-clockwise rotate
    "R270" - 90 degree clockwise rotate
    "R0" - no rotation (not much point!)
    "MYR90" - mirror in Y axis and rotate by 90
    "MXR90" - mirror in X axis and rotate by 90

    ?relativeTo can be set to:

    'centerBox - center of selected figures (default)
    'lowerLeft - lower left of selected figures
    'lowerRight - lower right of selected figures
    'upperLeft - upper left of selected figures
    'upperRight - upper right of selected figures
    'refPoint - the reference point
    'origin - the cellview origin (i.e. 0:0)

    ?mode can be set to

    'move - (the default) flip during a move
    'copy - (the default) flip during a copy

    ?noSnap can be set to t if you don't want it to
    snap the origin of the flip

    abSetRefPoint(?relativeTo 'upperLeft)
    - set the ref point relative to the selected objects

    The ?relativeTo has the same meaning as for abFlip()

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

    SCCS Info: @(#) abFlip.il 02/15/07.13:41:41 1.2

    */

    /******************************************************************
    * *
    * (abFlip [?orient "MY"] [?relativeTo 'centerBox] *
    * [?mode 'move] [?win windowId] [?noSnap nil]) *
    * *
    * Flips the selected objects (if any) relative to somewhere, with *
    * a particular orientation. Can either copy or move. *
    * For details, see the comments at the top of this file *
    * *
    ******************************************************************/

    (procedure (abFlip @key (orient "MY") (relativeTo 'centerBox)
    (mode 'move) noSnap
    (win (hiGetCurrentWindow)))
    (let (bbox figs origin transform)
    (setq figs (geGetSelSet win))
    ;-----------------------------------------------------------------
    ; work out the origin of the transform
    ;-----------------------------------------------------------------
    (setq bbox (abFindBBox figs))
    (setq origin
    (case relativeTo
    (centerBox (centerBox bbox))
    (lowerLeft (lowerLeft bbox))
    (lowerRight (list (xCoord (upperRight bbox))
    (yCoord (lowerLeft bbox))))
    (upperLeft (list (xCoord (lowerLeft bbox))
    (yCoord (upperRight bbox))))
    (upperRight (upperRight bbox))
    (refPoint (leGetRefPoint (geGetEditCellView win)))
    (origin (list 0 0))
    (t (error "Unknown ?relativeTo mode; must be one of 'centerBox, 'lowerLeft,
    'lowerRight, 'upperLeft, 'upperRight, 'refPoint, 'origin"))
    ))
    (when origin
    (unless noSnap
    (setq origin
    (list
    (times (round (quotient
    (xCoord origin)
    (getq win xSnapSpacing)))
    (getq win xSnapSpacing))
    (times (round (quotient
    (yCoord origin)
    (getq win ySnapSpacing)))
    (getq win ySnapSpacing))
    )))
    ;-----------------------------------------------------------
    ; Combine the transform to do a shift to the origin,
    ; rotate/flip, and then shift back again
    ;-----------------------------------------------------------
    (setq transform
    (dbConcatTransform
    (dbConcatTransform
    (list (mapcar 'minus origin) "R0")
    (list 0:0 orient)
    )
    (list origin "R0")
    ))
    ;-----------------------------------------------------------
    ; Then either move or copy all the figures
    ;-----------------------------------------------------------
    (foreach fig figs
    (case mode
    (move
    (dbMoveFig fig (dbGetq fig cellView) transform))
    (copy
    (dbCopyFig fig (dbGetq fig cellView) transform))
    )
    )
    t
    )
    )
    )

    /***************************************************************
    * *
    * (abSetRefPoint [?relativeTo 'centerBox] [?win windowId]) *
    * *
    * Set the reference point relative to somewhere on the *
    * selected set. *
    * *
    ***************************************************************/

    (procedure (abSetRefPoint @key (relativeTo 'centerBox)
    (win (hiGetCurrentWindow)))
    (let (bbox figs origin)
    ;-----------------------------------------------------------------
    ; Work out the new reference point
    ;-----------------------------------------------------------------
    (setq figs (geGetSelSet win))
    (setq bbox (abFindBBox figs))
    (setq origin
    (case relativeTo
    (centerBox (centerBox bbox))
    (lowerLeft (lowerLeft bbox))
    (lowerRight (list (xCoord (upperRight bbox))
    (yCoord (lowerLeft bbox))))
    (upperLeft (list (xCoord (lowerLeft bbox))
    (yCoord (upperRight bbox))))
    (upperRight (upperRight bbox))
    (refPoint (leGetRefPoint (geGetEditCellView win)))
    (origin (list 0 0))
    (t (error "Unknown ?relativeTo mode; must be one of 'centerBox, 'lowerLeft,
    'lowerRight, 'upperLeft, 'upperRight, 'refPoint, 'origin"))
    ))
    (when origin
    (leSetRefPoint (geGetEditCellView win) origin)
    )
    )
    )
     
    Andrew Beckett, Jul 28, 2009
    #2
  3. noreply

    noreply Guest

    Hi andrew,
    I'm still going through the code.
    Just a few doubts:
    *abFindBBox-- Is this some standard function?
    *Is there any command to lock the objects in their position while
    doing a copy. Like, if we call a cellview as an instance, the inner
    components in the hierarchy(instance) remain intact.
    Regards,
    Lokesh rajendran.


     
    noreply, Jul 29, 2009
    #3
  4. noreply

    noreply Guest

    Hi andrew,
    Finally i figured out what the actual problem was, I don't know how
    far this makes sense.
    The layout that i did was a completely automated one in which the
    multipartpath(like substrate ring) and the instance placement
    everything was done with the use of skill code. I also had another
    layout that was a manually routed one. The manual routed layout
    behaves as expected when i do a copy with "MY" orientation but the
    automated layout is behaving in a more weird way while copying, it
    seems as if the autorouted stuff(like multipart path and some other
    path ) does not change their orientation.
    {If i manually click and edit the properties of MPP(after copying
    them) and change their justification the MPP object gets fitted into
    the desired position}
    I guess you might have come across this kind of error before,
    Please do pass your comments.
    Regards,
    Lokesh rajendran.


     
    noreply, Jul 29, 2009
    #4
  5. noreply wrote, on 07/29/09 07:09:
    Apologies, that function is from a different file, which I forgot to include. It's below.

    I don't understand your second question. You want to flip them but not flip them? Confused of Bracknell here...

    /* abZoomSel.il

    Author A.D.Beckett
    Group Structured Custom, Cadence Design Systems Ltd
    Machine SUN
    Modified A.D.Beckett
    By Feb 04, 1998

    Various procedures for zooming to selected set, and for
    zooming to probed things.

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

    SCCS Info: @(#) abZoomSel.il 11/20/08.15:26:22 1.3

    */

    /*************************************************
    * *
    * (abExtendBBox bbox @rest xy) *
    * *
    * procedure to take a bounding box and extend it *
    * by a list of points. *
    * *
    *************************************************/

    (procedure (abExtendBBox bbox @rest xy)
    (let (minx maxx miny maxy coord)
    (if (and (listp xy)
    (listp (car xy))
    (listp (car (car xy))))
    (setq xy (car xy)))
    (if (null bbox)
    (setq bbox (list (car xy) (car xy))))
    (setq minx (xCoord (lowerLeft bbox)))
    (setq maxx (xCoord (upperRight bbox)))
    (setq miny (yCoord (lowerLeft bbox)))
    (setq maxy (yCoord (upperRight bbox)))
    (foreach coord xy
    (if (lessp (xCoord coord) minx) (setq minx (xCoord coord)))
    (if (lessp (yCoord coord) miny) (setq miny (yCoord coord)))
    (if (greaterp (xCoord coord) maxx) (setq maxx (xCoord coord)))
    (if (greaterp (yCoord coord) maxy) (setq maxy (yCoord coord))))
    /* return the new bbox */
    (list (list minx miny) (list maxx maxy))))

    /******************************************
    * *
    * (abEnlargeBBox bbox percent) *
    * *
    * extend the bounding box by a percentage *
    * *
    ******************************************/

    (procedure (abEnlargeBBox bbox percent)
    (let (extendX extendY)
    /* calculate extensions */
    (setq extendX
    (quotient
    (times
    (difference
    (xCoord (upperRight bbox))
    (xCoord (lowerLeft bbox)))
    percent)
    200.0))
    (setq extendY
    (quotient
    (times
    (difference
    (yCoord (upperRight bbox))
    (yCoord (lowerLeft bbox)))
    percent)
    200.0))
    /* return the enlarged bounding box */
    (list
    (list
    (difference (xCoord (lowerLeft bbox)) extendX)
    (difference (yCoord (lowerLeft bbox)) extendY))
    (list
    (plus (xCoord (upperRight bbox)) extendX)
    (plus (yCoord (upperRight bbox)) extendY)))))

    /******************************************
    * *
    * (abBBoxToPoints bbox) *
    * *
    * Convert a bounding box to a point list. *
    * *
    ******************************************/

    (procedure (abBBoxToPoints bbox)
    (list
    (lowerLeft bbox)
    (list (xCoord (lowerLeft bbox)) (yCoord (upperRight bbox)))
    (upperRight bbox)
    (list (xCoord (upperRight bbox)) (yCoord (lowerLeft bbox)))))


    /**********************************************************
    * *
    * (abFindBBox select) *
    * *
    * Find the bounding box of the list of objects passed in. *
    * Copes with partially selected objects as well. *
    * *
    **********************************************************/

    (procedure (abFindBBox select @optional forceWholeObject)
    (let (bbox)
    (foreach dbp select
    (if (or forceWholeObject (geIsFigAllSelected dbp))
    (setq bbox (abExtendBBox bbox (dbGetq dbp bBox)))
    (let (pointList)
    /* generate a point list for object, either directly or from bbox */
    (unless (setq pointList (dbGetq dbp points))
    (setq pointList (abBBoxToPoints (dbGetq dbp bBox))))
    /* scan two lists, extending bbox if point is selected */
    (mapc '(lambda (point bool)
    (when bool (setq bbox (abExtendBBox bbox point))))
    pointList
    (geGetSelSetFigPoint dbp)))))
    /* return bounding box */
    bbox))


    /*******************************************
    * *
    * (abZoomSel @optional (select nil)) *
    * *
    * Zoom in on the selected set (no overlap) *
    * Copes with partially selected objects *
    * *
    *******************************************/

    (procedure (abZoomSel @optional (select nil))
    (let (bbox wind forceWholeObject)
    /* get current window */
    (setq wind (hiGetCurrentWindow))
    /* get selected set if not passed in */
    (if select
    (setq forceWholeObject t)
    (setq select (geGetSelSet wind)))

    (setq bbox (abFindBBox select forceWholeObject))
    (if bbox
    (hiZoomIn wind (list (geEditToWindowPoint wind (lowerLeft bbox))
    (geEditToWindowPoint wind (upperRight bbox))))
    (hiDisplayAppDBox
    ?name 'abZSnothingSelected
    ?dboxBanner "Nothing Selected"
    ?dboxText "Nothing is selected for Zoom Selected"
    ?dialogType hicMessageDialog
    ?buttonLayout 'Close))))


    /*****************************************
    * *
    * (abZoomSelPlus @optional (select nil)) *
    * *
    * same as abZoomSel, but enlarges by 10% *
    * *
    *****************************************/

    (procedure (abZoomSelPlus @optional (select nil) (percent 10))
    (let (bbox wind forceWholeObject)
    /* get current window */
    (setq wind (hiGetCurrentWindow))
    /* get selected set if not passed in */
    (if select
    (setq forceWholeObject t)
    (setq select (geGetSelSet wind)))

    (setq bbox (abFindBBox select forceWholeObject))
    (if bbox
    (progn
    (setq bbox (abEnlargeBBox bbox percent))
    (hiZoomIn wind (list (geEditToWindowPoint wind (lowerLeft bbox))
    (geEditToWindowPoint wind (upperRight bbox)))))
    (hiDisplayAppDBox
    ?name 'abZSnothingSelected
    ?dboxBanner "Nothing Selected"
    ?dboxText "Nothing is selected for Zoom Selected"
    ?dialogType hicMessageDialog
    ?buttonLayout 'Close))))

    /***************************************************************
    * *
    * (abZoomOrig win) *
    * *
    * simple function for zooming in at the origin *
    * *
    ***************************************************************/

    (procedure (abZoomOrig win)
    (hiZoomIn win '((-0.2 -0.2) (0.2 0.2))))

    /******************************************************************************
    * *
    * (abZoomProbes @optional (window (hiGetCurrentWindow))) *
    * *
    * Zoom into probed objects. Works with nets and instances in extracted views. *
    * Haven't tested with all objects, but seems to work so far! *
    * *
    ******************************************************************************/

    (procedure (abZoomProbes @optional (window (hiGetCurrentWindow)))
    (let (cellView probedObjects probedFigs)
    (setq cellView (geGetEditCellView window))
    ;-----------------------------------------------------------------
    ; find all the probed objects in the current window
    ;-----------------------------------------------------------------
    (setq probedObjects
    (setof obj (foreach mapcar probe
    (geGetAllProbe window) (getq probe objectId))
    (equal (dbGetq obj cellView) cellView)))
    (setq probedFigs
    (foreach mapcan object probedObjects
    (case (dbGetq object objType)
    ("sig"
    ;-------------------------------------------
    ; combine the figures
    ;-------------------------------------------
    (foreach mapcan net
    ;----------------------------------
    ; get from sigs to member nets
    ;----------------------------------
    (foreach mapcar memNet
    (dbGetq object memNets)
    (car memNet))
    (dbGetq net figs))
    )
    ("net"
    (dbGetq object figs)
    )
    (t (list object))
    )))
    ;-----------------------------------------------------------------
    ; zoom into them
    ;-----------------------------------------------------------------
    (abZoomSel probedFigs)
    ))
     
    Andrew Beckett, Jul 30, 2009
    #5
  6. noreply wrote, on 07/29/09 09:53:
    Multipart paths which are not symmetrical about the definition path do not
    get flipped when you do a flip. This is because they are completely defined by
    the points on the master path, and there is no concept of "orientation" for a
    path. It's a known limitation of multi-part paths.

    Regards,

    Andrew.
     
    Andrew Beckett, Jul 30, 2009
    #6
  7. noreply

    noreply Guest

    That's very bad, Anyway its my mistake ,should have known stuff
    regarding MPP previously.
    And Andrew thank you very much for the codes.

    Regards,
    Lokesh rajendran.
     
    noreply, Jul 31, 2009
    #7
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.