• 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. Virtuoso graphical window - get absolute scale

Stats

  • Locked Locked
  • Replies 13
  • Subscribers 143
  • Views 5982
  • 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

Virtuoso graphical window - get absolute scale

caver456
caver456 over 4 years ago

What's the best way to determine the absolute scale (in the same definition as hiZoomAbsoluteScale) of an existing window?  I'd like to set one window to have the same absolute scale as another window - even if the windows are different sizes / aspect raios.

  • Cancel
Parents
  • skillUser
    skillUser over 4 years ago

    Hi,

    I think you need hiGetViewBBox()

    hiGetViewBBox( 
      [ w_window ] 
    )     => l_bBox

    So you don't get a 'scale' just the viewing area as a bounding box.

    Best regards,

    Lawrence.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 4 years ago in reply to skillUser

    Lawrence,

    You beat me to it. I was just looking at some very old code to copy the zoom level of one window to another:

    /* abCopyWinView.il
    
    Author     A.D.Beckett
    Group      Structured Custom, Cadence Design Systems Ltd
    Machine    SUN
    Date       Apr 25, 1994 
    Modified   
    By         
    
    Copies a window view from one window to another,
    not necessarily of the same cellView
    
    ***************************************************
    
    SCCS Info: @(#) abCopyWinView.il 11/20/08.15:26:12 1.1
    
    */
    
    (procedure (abCopyWinViewCB win done points)
      (let (bbox)
           (setq win (hiGetCurrentWindow))
           (when (and done (windowp win) (windowp abCopyWinViewFrom))
                 (setq bbox (hiGetViewBBox abCopyWinViewFrom))
                 (hiZoomIn win bbox))))
    
    /***************************************************************
    *                                                              *
    *             (abCopyWinView @optional (win nil))              *
    *                                                              *
    *     Procedure to copy a view from one window to another      *
    *                                                              *
    ***************************************************************/
    
    (procedure (abCopyWinView @optional (win nil))
      (unless win (setq win (hiGetCurrentWindow)))
      (setq abCopyWinViewFrom win)
      (hiSetCurrentWindow win)
      (when (windowp win)
            (enterMultiRep ?prompts '("Point to the source window" "Point to the destination window")
                           ?points '((0 0))
                           ?doneProc "abCopyWinViewCB"
                           ?dontDraw t
                           ))
      t)

    The absolute scale could be computed (if you were really keen on doing so) by figuring out the ratio between the cellView bBox and the hiGetViewBBox (I'm assuming it will be the greater or smaller of the width or height ratios, but that's a guess and I've not done the experiments). I'm not sure how useful that would be.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • caver456
    caver456 over 4 years ago in reply to Andrew Beckett

    Thanks - that was generally my guess too: get the ratio of hiGetViewBBox to hiGetAbsWindowScreenBBox.  I was hoping for a reciprocal function to hiZoomAbsoluteScale, something like hiGetAbsoluteScale.

    For context, this is to help in the general "make this layout look like layout that" task, where 'this' is not initially identical to 'that' meaning that a cell copy isn't sufficient / doesn't get you all the way there.  Also I found the Background Cellview functions - those are excellent for a quick visual XOR of sorts, but that method also doesn't fit the bill all of the time.  So I set up a zoom-linking thing that basically just intercepts all the zoom and pan and scroll bindkeys, and applies them to multiple windows, making sure to keep the windows centered on the same spot.  (I tried hiRegZoomPanProc - it has some bugginess that remains even after unregistering the zoomPanProc.)  I've been zoom-linking for a bit and determined that it would be even more helpful to have both windows forced to the same absolute scale as well. 

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 4 years ago in reply to caver456

    If you want them at the same absolute scale, and centred in the same spot, then I think you'd just use hiGetViewBBox and hiZoomIn - that would effectively do the same thing - they'd both be showing the same zoom area, which I think is in effect the same as what you're asking...

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • caver456
    caver456 over 4 years ago in reply to Andrew Beckett

    Not sure if that works when the windows are different sizes.  hiZoomIn uses relative scale - hopefully once the windows are initially set to the same absolute scale, then you can do the same relative zooms from then on.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 4 years ago in reply to caver456
    caver456 said:
    hiZoomIn uses relative scale

    No, it doesn't. It zooms to an absolute bounding box. hiZoomRelativeScale zooms using a relative scale, and that's not what I'm using here.

    I originally wrote this code 27 years ago to allow me to have two windows open (such as an extracted view and a layout view, or two layout views on the same design) and replicate the zoom region in one window from another (even if the windows are different sizes).

    There's not really a concept in the window itself of keeping track of an "absolute scale".The absolute scale is just a means of determining how much of the overall bounding box of the cellView should be displayed in the window.

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Andrew Beckett
    Andrew Beckett over 4 years ago in reply to caver456
    caver456 said:
    hiZoomIn uses relative scale

    No, it doesn't. It zooms to an absolute bounding box. hiZoomRelativeScale zooms using a relative scale, and that's not what I'm using here.

    I originally wrote this code 27 years ago to allow me to have two windows open (such as an extracted view and a layout view, or two layout views on the same design) and replicate the zoom region in one window from another (even if the windows are different sizes).

    There's not really a concept in the window itself of keeping track of an "absolute scale".The absolute scale is just a means of determining how much of the overall bounding box of the cellView should be displayed in the window.

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
  • caver456
    caver456 over 4 years ago in reply to Andrew Beckett

    Ah - sorry bout that, I was thinking of hiZoomInAtMouse / hiZoomOutAtMouse / hiZoomWindowAtMouse etc that use relative scales.  Anyway I will give this code a shot verbatim - I didn't grasp initially that it should be a full solution.  Thanks

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • caver456
    caver456 over 4 years ago in reply to caver456

    Hi Andrew, I did try your code - I think was jut not clear about my use of the term "scale".  What I'd like to do is match the pixels-per-micron from one window to another, so that e.g. a 3-microon-wide-resistor in one large window, zoomed such that it is an inch wide on the screen, would also take one inch on the screen when viewed in a much smaller window.  If the two windows are identically sized, then your code accomplishes this pixels-per-micron matching.  I guess my use of the term 'absolute scale' was incorrect.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 4 years ago in reply to caver456

    I'm not sure that's really doable. You'd need to know the number of pixels on the canvas itself together with the hiGetViewBBox - and then use that to compute the equivalent zoom area in the other window using the canvas size of that window. You can find the screen coordinates (in pixels) of the entire window, but that includes the toolbars, assistants and so on, but not sure there's a way of finding the canvas area in pixels.

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • caver456
    caver456 over 4 years ago in reply to Andrew Beckett

    I'll probably just go with the entire window size, figuring/hoping that it's "close enough", and see how that goes.  Regardless, thanks for your quick help.

    • 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