Skill : Create a zoom function

Discussion in 'Cadence' started by bedoune, Dec 14, 2007.

  1. bedoune

    bedoune Guest

    hi,

    I use Cadence Virtuoso for my layouts and Calibre (command line) for
    my verifications.

    I would like a function which will zoom for me on my layout after i
    entered (x,y) (these x,y will be errors locations from Calibre errors
    files)

    How can i do ? I'm a dummy in skill programming, but if you have any
    idea ...

    Thanks for your help !
     
    bedoune, Dec 14, 2007
    #1
  2. bedoune

    wre Guest

    Hello,

    Do you have the possibility to use the Calibre interactive (RVE)
    interface in Virtuoso?
    It supports zoom in on location, devices, nodes, and error locations.
    But I also use
    zoom functions. Here is what I collected. The wrWindowName function is
    commented
    out because it is a local function I use. I have not checked this code
    separately
    because it is part of one big file but I guess that it might help you
    further.

    Greetings, William.

    procedure( wrLayoutZoomIn( value)

    let( ( x y x1 y1 x2 y2 xD yD xMid yMid wrBB wrBBNew wrPointOrg)

    wrBB = wrGetBBView( )
    x1 = xCoord( cadr( wrBB))
    y1 = yCoord( cadr( wrBB))
    x2 = xCoord( car( wrBB))
    y2 = yCoord( car( wrBB))
    xD = value * ( x2 - x1) / 2
    yD = value * ( y2 - y1) / 2
    wrPointMid = geWindowToEditPoint( wrWindow list( ( x2 + x1) / 2
    ( y2 + y1) / 2))
    xMid = xCoord( wrPointMid)
    yMid = yCoord( wrPointMid)
    wrPointOrg = geWindowToEditPoint( wrWindow hiGetPoint( wrWindow))
    xOrg = xCoord( wrPointOrg)
    yOrg = yCoord( wrPointOrg)
    x = xOrg + value * ( xMid - xOrg)
    y = yOrg + value * ( yMid - yOrg)
    wrBBNew = list(
    geEditToWindowPoint( wrWindow list( (x - xD) (y - yD)))
    geEditToWindowPoint( wrWindow list( (x + xD) (y + yD))))

    ;; wrWindowName( strcat( wrWriteModeTxt wrDecodeBindKeysText ":
    Zoom to " pcExprToString( x) ", " pcExprToString( y)))
    hiZoomIn( wrWindow wrBBNew)
    )
    )

    procedure( wrLayoutZoomLimit( )

    wrBB = hiGetViewBBox( wrWindow)
    x = ( xCoord( cadr( wrBB)) + xCoord( car( wrBB))) / 2
    y = ( yCoord( cadr( wrBB)) + yCoord( car( wrBB))) / 2
    xD = 1.5
    yD = 1.5
    wrBBNew = list( list( (x - xD) (y - yD)) list( (x + xD) (y + yD)))
    hiZoomIn( wrWindow wrBBNew)
    ;; wrWindowName( strcat( wrWriteModeTxt wrDecodeBindKeysText ": Zoom
    limit"))
    )

    To get a form in which you can enter the x and y points I use:

    procedure( wrZoomXYInput( )

    unless( boundp( 'wrXNumber)
    wrXNumber = 0
    wrYNumber = 0
    )
    wrName=""
    wrEnterNameWithForm( "Enter point" "X coordinate [, ] [Y
    coordinate]")
    rexCompile( "-*[0-9]*.[0-9]*")
    rexExecute( wrName)
    wrXNumber = evalstring( rexSubstitute( "\\0"))
    if( ! floatp( wrXNumber)
    then
    rexCompile( "-*[0-9]*")
    rexExecute( wrName)
    wrXNumber = evalstring( rexSubstitute( "\\0"))
    )
    rexCompile( "[, ]")
    if( rexExecute( wrName)
    then
    rexCompile( "-*[0-9]*.[0-9]*$")
    rexExecute( wrName)
    wrYNumber = evalstring( rexSubstitute( "\\0"))
    if( ! floatp( wrYNumber)
    then
    rexCompile( "-*[0-9]*$")
    rexExecute( wrName)
    wrYNumber = evalstring( rexSubstitute( "\\0"))
    )
    )
    if( wrYNumber == 0
    then
    wrWindowName( strcat( wrWriteModeTxt wrDecodeBindKeysText ": Enter
    Y coordinate" ))
    wrEnterNumberWithForm( "Enter Y coordinate" "Y coordinate")
    wrYNumber = wrNumber
    )
    if( wrXNumber >= 6000 || wrYNumber >= 6000
    then
    wrXNumber = wrXNumber/1000.0
    wrYNumber = wrYNumber/1000.0
    )
    wrZoomXY( list( wrXNumber wrYNumber))
    wrXNumber = 0
    wrYNumber = 0
    )

    This function uses another function to create a form:

    procedure( wrEnterNameWithForm( titletext prompttext)

    unless( boundp( 'wrName)
    wrName = ""
    )

    ;; unless( boundp( 'wrGetNameForm)
    ;; 060818 dont know how to update prompt field, so create form from
    scratch each time.

    wrGetNameField = hiCreateStringField(
    ?name 'wrName
    ?value wrName
    ?prompt prompttext
    ?defValue wrName
    ?editable t
    )

    ;; define the form around the button
    wrGetNameForm = hiCreateAppForm(
    ?name 'wrGetNameForm
    ?formTitle titletext
    ?fields list( wrGetNameField)
    ?buttonLayout 'OKCancelDefApply
    ?initialSize t
    ?callback "wrGetNameCB( )"
    ?unmapAfterCB t
    ) ;; form
    ;; ) ;; unless
    ;; wrGetNameField->prompt=wrText
    hiDisplayForm( wrGetNameForm)
    )

    I'm using bindkeys to move and zoom in and out with the mouse:
    hiSetBindKey( "Layout" "<Btn4Down>" "geScroll(nil \"n\" nil)")
    hiSetBindKey( "Layout" "<Btn5Down>" "geScroll(nil \"s\" nil)")
    hiSetBindKey( "Layout" "Shift <Btn4Down>" "geScroll(nil \"w\"
    nil)")
    hiSetBindKey( "Layout" "Shift <Btn5Down>" "geScroll(nil \"e\"
    nil)")
    hiSetBindKey( "Layout" "Ctrl <Btn4Down>" "wrLayoutZoomIn( 2)")
    hiSetBindKey( "Layout" "Ctrl <Btn5Down>" "wrLayoutZoomIn( 0.5)")

    And I like this in the schematic view too:
    hiSetBindKey( "Schematics" "<Btn4Down>" "geScroll(nil \"n\" nil)")
    hiSetBindKey( "Schematics" "<Btn5Down>" "geScroll(nil \"s\" nil)")
    hiSetBindKey( "Schematics" "Shift <Btn4Down>" "geScroll(nil \"w\"
    nil)")
    hiSetBindKey( "Schematics" "Shift <Btn5Down>" "geScroll(nil \"e\"
    nil)")
    hiSetBindKey( "Schematics" "Ctrl
    <Btn4Down>" "hiZoomOutAtMouse(getCurrentWindow( )")
    hiSetBindKey( "Schematics" "Ctrl
    <Btn5Down>" "hiZoomInAtMouse(getCurrentWindow( )")
     
    wre, Dec 14, 2007
    #2
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.